Commit 8a3e08cf authored by Rafael Monnerat's avatar Rafael Monnerat

"unskip" tests and fix Functional Tests

testERP5WebWithDms will pass now as librsvg is well installed now and
assertion on tests were simplied to become more reliable (it provides
less false positives for image comparation).

The functional test testSurchargeWithInvalidDateTime was improved for
better assertions.
parents 6b0e805d b08ca5f1
...@@ -180,11 +180,35 @@ ...@@ -180,11 +180,35 @@
<td></td>\n <td></td>\n
</tr>\n </tr>\n
<tr>\n <tr>\n
<td>assertText</td>\n <td>verifyValue</td>\n
<td>//div[@class="status"]/div[@class="transition_message"]</td>\n <td>subfield_field_my_start_date_year</td>\n
<td>Data updated.</td>\n <td></td>\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>subfield_field_my_start_date_month</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>subfield_field_my_start_date_day</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>subfield_field_my_start_date_hour</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>verifyValue</td>\n
<td>subfield_field_my_start_date_minute</td>\n
<td></td>\n
</tr>\n
<tr>\n
<td>assertTextNotPresent</td>\n
<td>You did not enter a valid date and time.</td>\n
<td></td>\n
</tr>\n </tr>\n
\n
</tbody></table>\n </tbody></table>\n
</body>\n </body>\n
</html> </html>
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
\n \n
<tr>\n <tr>\n
<td>click</td>\n <td>click</td>\n
<td>//*[@class=\'listbox-data-line-0 DataA\']//input[@type="checkbox"]</td>\n <td>//*[@class=\'listbox-data-line-0 DataA\']/*[@class="listbox-table-select-cell"]/input[@type="checkbox"]</td>\n
<td></td>\n <td></td>\n
</tr>\n </tr>\n
<tr>\n <tr>\n
......
685 688
\ No newline at end of file \ No newline at end of file
...@@ -40,7 +40,6 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\ ...@@ -40,7 +40,6 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase,\
_getConversionServerDict _getConversionServerDict
from Products.ERP5Type.tests.utils import FileUpload, createZODBPythonScript from Products.ERP5Type.tests.utils import FileUpload, createZODBPythonScript
from Products.ERP5.Document.Document import ConversionError from Products.ERP5.Document.Document import ConversionError
from Products.ERP5Type.tests.backportUnittest import expectedFailure
try: try:
from PIL import Image from PIL import Image
...@@ -50,6 +49,8 @@ except ImportError: ...@@ -50,6 +49,8 @@ except ImportError:
import Image import Image
LANGUAGE_LIST = ('en', 'fr', 'de', 'bg',) LANGUAGE_LIST = ('en', 'fr', 'de', 'bg',)
IMAGE_COMPARE_TOLERANCE = 800
def makeFilePath(name): def makeFilePath(name):
return os.path.join(os.path.dirname(__file__), 'test_data', name) return os.path.join(os.path.dirname(__file__), 'test_data', name)
...@@ -806,23 +807,19 @@ return True ...@@ -806,23 +807,19 @@ return True
# Compare images and accept some minimal difference, # Compare images and accept some minimal difference,
difference_value = compare_image(StringIO(converted_data), expected_image) difference_value = compare_image(StringIO(converted_data), expected_image)
self.assertTrue(difference_value < 100, self.assertTrue(difference_value < IMAGE_COMPARE_TOLERANCE,
"Conversion from svg to png create one too small image, " + \ "Conversion from svg to png create one too small image, " + \
"so it failed to download the image. (%s >= 100)" % difference_value) "so it failed to download the image. (%s >= %s)" % (difference_value,
IMAGE_COMPARE_TOLERANCE))
def _testImageConversionFromSVGToPNG_file_url(self, portal_type="Image"):
""" Test Convert one SVG Image with an image using local path (file)
at the url of the image tag. ie:
<image xlink:href="file:///../../user-XXX-XXX"
This is not used by ERP5 in production, but this is way that def _testImageConversionFromSVGToPNG_url(self, image_url, portal_type="Image"):
prooves that conversion from SVG to PNG can use external images. """ Test Convert one SVG Image with an image url. ie:
<image xlink:href="xxx:///../../user-XXX-XXX"
""" """
portal = self.portal portal = self.portal
module = portal.getDefaultModule(portal_type=portal_type) module = portal.getDefaultModule(portal_type=portal_type)
upload_file = makeFileUpload('user-TESTSVG-CASE-FULLURL-TEMPLATE.svg') upload_file = makeFileUpload('user-TESTSVG-CASE-URL-TEMPLATE.svg')
svg_content = upload_file.read().replace("REPLACE_THE_URL_HERE", svg_content = upload_file.read().replace("REPLACE_THE_URL_HERE", image_url)
"file://" + makeFilePath("user-TESTSVG-BACKGROUND-IMAGE.png"))
# Add image using data instead file this time as it is not the goal of # Add image using data instead file this time as it is not the goal of
# This test assert this topic. # This test assert this topic.
...@@ -837,13 +834,43 @@ return True ...@@ -837,13 +834,43 @@ return True
self.assertEquals(image.getContentType(), 'image/svg+xml') self.assertEquals(image.getContentType(), 'image/svg+xml')
mime, converted_data = image.convert("png") mime, converted_data = image.convert("png")
self.assertEquals(mime, 'image/png') self.assertEquals(mime, 'image/png')
expected_image = makeFileUpload('user-TESTSVG-CASE-FULLURL.png') expected_image = makeFileUpload('user-TESTSVG-CASE-URL.png')
# Compare images and accept some minimal difference, # Compare images and accept some minimal difference,
difference_value = compare_image(StringIO(converted_data), expected_image) difference_value = compare_image(StringIO(converted_data), expected_image)
self.assertTrue(difference_value < 100, self.assertTrue(difference_value < IMAGE_COMPARE_TOLERANCE,
"Conversion from svg to png create one too small image, " + \ "Conversion from svg to png create one too small image, " + \
"so it failed to download the image. (%s >= 100)" % difference_value) "so it failed to download the image. (%s >= %s)" % (difference_value,
IMAGE_COMPARE_TOLERANCE))
def _testImageConversionFromSVGToPNG_file_url(self, portal_type="Image"):
""" Test Convert one SVG Image with an image using local path (file)
at the url of the image tag. ie:
<image xlink:href="file:///../../user-XXX-XXX"
This is not used by ERP5 in production, but this is way that
prooves that conversion from SVG to PNG can use external images.
"""
image_url = "file://" + makeFilePath("user-TESTSVG-BACKGROUND-IMAGE.png")
self._testImageConversionFromSVGToPNG_url(image_url, portal_type)
def _testImageConversionFromSVGToPNG_http_url(self, portal_type="Image"):
""" Test Convert one SVG Image with an image with a full
url at the url of the image tag. ie:
<image xlink:href="http://www.erp5.com/user-XXX-XXX"
"""
portal = self.portal
module = portal.getDefaultModule(portal_type=portal_type)
upload_file = makeFileUpload('user-TESTSVG-BACKGROUND-IMAGE.png')
background_image = module.newContent(portal_type=portal_type,
file=upload_file,
reference="NXD-BACKGROUND")
background_image.publish()
transaction.commit()
self.tic()
image_url = background_image.absolute_url() + "?format="
self._testImageConversionFromSVGToPNG_url(image_url, portal_type)
def _testImageConversionFromSVGToPNG_broken_url(self, portal_type="Image"): def _testImageConversionFromSVGToPNG_broken_url(self, portal_type="Image"):
""" Test Convert one broken SVG into PNG. The expected outcome is a """ Test Convert one broken SVG into PNG. The expected outcome is a
...@@ -856,11 +883,11 @@ return True ...@@ -856,11 +883,11 @@ return True
""" """
portal = self.portal portal = self.portal
module = portal.getDefaultModule(portal_type=portal_type) module = portal.getDefaultModule(portal_type=portal_type)
upload_file = makeFileUpload('user-TESTSVG-CASE-FULLURL-TEMPLATE.svg') upload_file = makeFileUpload('user-TESTSVG-CASE-URL-TEMPLATE.svg')
svg_content = upload_file.read().replace("REPLACE_THE_URL_HERE", svg_content = upload_file.read().replace("REPLACE_THE_URL_HERE",
"http://soidjsoidjqsoijdqsoidjqsdoijsqd.idjsijds/../user-XXX-XXX") "http://soidjsoidjqsoijdqsoidjqsdoijsqd.idjsijds/../user-XXX-XXX")
upload_file = makeFileUpload('user-TESTSVG-CASE-FULLURL-TEMPLATE.svg') upload_file = makeFileUpload('user-TESTSVG-CASE-URL-TEMPLATE.svg')
svg2_content = upload_file.read().replace("REPLACE_THE_URL_HERE", svg2_content = upload_file.read().replace("REPLACE_THE_URL_HERE",
"https://www.erp5.com/usXXX-XXX") "https://www.erp5.com/usXXX-XXX")
...@@ -908,8 +935,6 @@ return True ...@@ -908,8 +935,6 @@ return True
self.assertEquals(image.getContentType(), 'image/svg+xml') self.assertEquals(image.getContentType(), 'image/svg+xml')
self.assertRaises(ConversionError, image.convert, "png") self.assertRaises(ConversionError, image.convert, "png")
# "Waiting for rsvg-convert be available for imagemagick"
@expectedFailure
def test_ImageConversionFromSVGToPNG_embeeded_data(self): def test_ImageConversionFromSVGToPNG_embeeded_data(self):
""" Test Convert one SVG Image with an image with the data """ Test Convert one SVG Image with an image with the data
at the url of the image tag.ie: at the url of the image tag.ie:
...@@ -917,7 +942,6 @@ return True ...@@ -917,7 +942,6 @@ return True
""" """
self._testImageConversionFromSVGToPNG("Image") self._testImageConversionFromSVGToPNG("Image")
@expectedFailure
def test_FileConversionFromSVGToPNG_embeeded_data(self): def test_FileConversionFromSVGToPNG_embeeded_data(self):
""" Test Convert one SVG Image with an image with the data """ Test Convert one SVG Image with an image with the data
at the url of the image tag.ie: at the url of the image tag.ie:
...@@ -925,7 +949,6 @@ return True ...@@ -925,7 +949,6 @@ return True
""" """
self._testImageConversionFromSVGToPNG("File") self._testImageConversionFromSVGToPNG("File")
@expectedFailure
def test_WebPageConversionFromSVGToPNG_embeeded_data(self): def test_WebPageConversionFromSVGToPNG_embeeded_data(self):
""" Test Convert one SVG Image with an image with the data """ Test Convert one SVG Image with an image with the data
at the url of the image tag.ie: at the url of the image tag.ie:
...@@ -958,7 +981,6 @@ return True ...@@ -958,7 +981,6 @@ return True
""" """
self._testImageConversionFromSVGToPNG_empty_file("File") self._testImageConversionFromSVGToPNG_empty_file("File")
@expectedFailure
def test_ImageConversionFromSVGToPNG_file_url(self): def test_ImageConversionFromSVGToPNG_file_url(self):
""" Test Convert one SVG Image with an image using local path (file) """ Test Convert one SVG Image with an image using local path (file)
at the url of the image tag. ie: at the url of the image tag. ie:
...@@ -969,7 +991,6 @@ return True ...@@ -969,7 +991,6 @@ return True
""" """
self._testImageConversionFromSVGToPNG_file_url("Image") self._testImageConversionFromSVGToPNG_file_url("Image")
@expectedFailure
def test_FileConversionFromSVGToPNG_file_url(self): def test_FileConversionFromSVGToPNG_file_url(self):
""" Test Convert one SVG Image with an image using local path (file) """ Test Convert one SVG Image with an image using local path (file)
at the url of the image tag. ie: at the url of the image tag. ie:
...@@ -980,7 +1001,6 @@ return True ...@@ -980,7 +1001,6 @@ return True
""" """
self._testImageConversionFromSVGToPNG_file_url("File") self._testImageConversionFromSVGToPNG_file_url("File")
@expectedFailure
def test_WebPageConversionFromSVGToPNG_file_url(self): def test_WebPageConversionFromSVGToPNG_file_url(self):
""" Test Convert one SVG Image with an image using local path (file) """ Test Convert one SVG Image with an image using local path (file)
at the url of the image tag. ie: at the url of the image tag. ie:
...@@ -991,32 +1011,26 @@ return True ...@@ -991,32 +1011,26 @@ return True
""" """
self._testImageConversionFromSVGToPNG_file_url("Web Page") self._testImageConversionFromSVGToPNG_file_url("Web Page")
@expectedFailure
def test_ImageConversionFromSVGToPNG_http_url(self): def test_ImageConversionFromSVGToPNG_http_url(self):
""" Test Convert one SVG Image with an image with a full """ Test Convert one SVG Image with an image with a full
url at the url of the image tag. ie: url at the url of the image tag. ie:
<image xlink:href="http://www.erp5.com/user-XXX-XXX" <image xlink:href="http://www.erp5.com/user-XXX-XXX"
""" """
self._testImageConversionFromSVGToPNG( self._testImageConversionFromSVGToPNG_http_url("Image")
"Image", "user-TESTSVG-CASE-FULLURL")
@expectedFailure
def test_FileConversionFromSVGToPNG_http_url(self): def test_FileConversionFromSVGToPNG_http_url(self):
""" Test Convert one SVG Image with an image with a full """ Test Convert one SVG Image with an image with a full
url at the url of the image tag. ie: url at the url of the image tag. ie:
<image xlink:href="http://www.erp5.com/user-XXX-XXX" <image xlink:href="http://www.erp5.com/user-XXX-XXX"
""" """
self._testImageConversionFromSVGToPNG( self._testImageConversionFromSVGToPNG_http_url("File")
"File", "user-TESTSVG-CASE-FULLURL")
@expectedFailure
def test_WebPageConversionFromSVGToPNG_http_url(self): def test_WebPageConversionFromSVGToPNG_http_url(self):
""" Test Convert one SVG Image with an image with a full """ Test Convert one SVG Image with an image with a full
url at the url of the image tag. ie: url at the url of the image tag. ie:
<image xlink:href="http://www.erp5.com/user-XXX-XXX" <image xlink:href="http://www.erp5.com/user-XXX-XXX"
""" """
self._testImageConversionFromSVGToPNG( self._testImageConversionFromSVGToPNG_http_url("Web Page")
"Web Page", "user-TESTSVG-CASE-FULLURL")
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg2"
version="1.1"
inkscape:version="0.48.2 r9819"
width="524.40942"
height="372.04724"
sodipodi:docname="user-howto.manage.support.requests.assign.event.to.ticket.create.follow.up.ticket-002-en.svg">
<metadata
id="metadata8">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs6" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1024"
inkscape:window-height="718"
id="namedview4"
showgrid="false"
inkscape:zoom="1.3707937"
inkscape:cx="270.63548"
inkscape:cy="273.56415"
inkscape:window-x="-3"
inkscape:window-y="-3"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<image
y="0.99838382"
x="0.11206181"
id="image3065"
xlink:href="http://www.erp5.com/user-howto.manage.support.requests.assign.event.to.ticket.create.follow.up.ticket.screenshot?format=png"
height="369.32098"
width="523.56" />
<rect
style="fill:none;stroke:#ff0000;stroke-width:2.696;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect2987"
width="81.987816"
height="11.938368"
x="64.116737"
y="43.860283"
rx="2.5779424"
ry="0.29129499" />
<rect
style="fill:none;stroke:#ff0000;stroke-width:2.81803679;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect2989"
width="82.598396"
height="9.534873"
x="64.417244"
y="68.28804"
rx="2.4387791"
ry="0.28804284" />
<path
sodipodi:type="arc"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3898"
sodipodi:cx="303.51724"
sodipodi:cy="155.48277"
sodipodi:rx="25.13793"
sodipodi:ry="25.13793"
d="m 328.65517,155.48277 a 25.13793,25.13793 0 1 1 -50.27586,0 25.13793,25.13793 0 1 1 50.27586,0 z"
transform="matrix(0.63956863,0,0,0.63956863,-19.039052,-62.99123)" />
<text
xml:space="preserve"
style="font-size:23px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold"
x="166.65985"
y="45.086403"
id="text3900"
sodipodi:linespacing="125%"
transform="scale(1.0034798,0.99653226)"><tspan
sodipodi:role="line"
id="tspan3902"
x="166.65985"
y="45.086403">1</tspan></text>
<path
sodipodi:type="arc"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="path3898-3"
sodipodi:cx="303.51724"
sodipodi:cy="155.48277"
sodipodi:rx="25.13793"
sodipodi:ry="25.13793"
d="m 328.65517,155.48277 a 25.13793,25.13793 0 1 1 -50.27586,0 25.13793,25.13793 0 1 1 50.27586,0 z"
transform="matrix(0.63956863,0,0,0.63956863,-17.252115,-25.057001)" />
<text
xml:space="preserve"
style="font-size:23px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold"
x="168.57806"
y="83.152695"
id="text3900-2"
sodipodi:linespacing="125%"
transform="scale(1.0034798,0.99653226)"><tspan
sodipodi:role="line"
id="tspan3902-0"
x="168.57806"
y="83.152695">2</tspan></text>
</svg>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
id="defs6" /> id="defs6" />
<sodipodi:namedview <sodipodi:namedview
pagecolor="#ffffff" pagecolor="#ffffff"
bordercolor="#666666" bordercolor="#000000"
borderopacity="1" borderopacity="1"
objecttolerance="10" objecttolerance="10"
gridtolerance="10" gridtolerance="10"
...@@ -58,7 +58,7 @@ ...@@ -58,7 +58,7 @@
height="369.32098" height="369.32098"
width="523.56" /> width="523.56" />
<rect <rect
style="fill:none;stroke:#ff0000;stroke-width:2.696;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" style="fill:none;stroke:#000000;stroke-width:2.696;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect2987" id="rect2987"
width="81.987816" width="81.987816"
height="11.938368" height="11.938368"
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
rx="2.5779424" rx="2.5779424"
ry="0.29129499" /> ry="0.29129499" />
<rect <rect
style="fill:none;stroke:#ff0000;stroke-width:2.81803679;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" style="fill:none;stroke:#000000;stroke-width:2.81803679;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect2989" id="rect2989"
width="82.598396" width="82.598396"
height="9.534873" height="9.534873"
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
transform="matrix(0.63956863,0,0,0.63956863,-19.039052,-62.99123)" /> transform="matrix(0.63956863,0,0,0.63956863,-19.039052,-62.99123)" />
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:23px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ff0000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold" style="font-size:23px;font-style:normal;font-weight:bold;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold"
x="166.65985" x="166.65985"
y="45.086403" y="45.086403"
id="text3900" id="text3900"
...@@ -109,7 +109,7 @@ ...@@ -109,7 +109,7 @@
transform="matrix(0.63956863,0,0,0.63956863,-17.252115,-25.057001)" /> transform="matrix(0.63956863,0,0,0.63956863,-17.252115,-25.057001)" />
<text <text
xml:space="preserve" xml:space="preserve"
style="font-size:23px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#0000ff;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold" style="font-size:23px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans Bold"
x="168.57806" x="168.57806"
y="83.152695" y="83.152695"
id="text3900-2" id="text3900-2"
......
...@@ -32,7 +32,6 @@ from Products.ERP5Form.Form import ERP5Form ...@@ -32,7 +32,6 @@ from Products.ERP5Form.Form import ERP5Form
from DocumentTemplate import String from DocumentTemplate import String
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Form.Selection import Selection from Products.ERP5Form.Selection import Selection
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
...@@ -125,7 +124,6 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -125,7 +124,6 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional):
if error_list: if error_list:
self.fail(''.join(error_list)) self.fail(''.join(error_list))
@expectedFailure
def test_ooo_chart(self): def test_ooo_chart(self):
portal = self.getPortal() portal = self.getPortal()
# Does the form exist ? # Does the form exist ?
...@@ -229,7 +227,6 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -229,7 +227,6 @@ class TestOOoChart(ERP5TypeTestCase, ZopeTestCase.Functional):
# Test Validation Relax NG # Test Validation Relax NG
self._validate(body) self._validate(body)
@expectedFailure
def test_proxy_ooo_chart(self): def test_proxy_ooo_chart(self):
portal = self.getPortal() portal = self.getPortal()
# Does the form exist ? # Does the form exist ?
......
...@@ -30,6 +30,8 @@ import urllib2 ...@@ -30,6 +30,8 @@ import urllib2
from lxml import etree from lxml import etree
from Products.ERP5.Document.Document import ConversionError from Products.ERP5.Document.Document import ConversionError
SVG_DEFAULT_NAMESPACE = "http://www.w3.org/2000/svg"
def getDataURI(url): def getDataURI(url):
try: try:
data = urllib2.urlopen(url) data = urllib2.urlopen(url)
...@@ -45,8 +47,14 @@ def transformUrlToDataURI(content): ...@@ -45,8 +47,14 @@ def transformUrlToDataURI(content):
root = etree.fromstring(content) root = etree.fromstring(content)
# Prevent namespace contains "None" included into svg by mistake # Prevent namespace contains "None" included into svg by mistake
# and fix svg definition as in some images the namespace is not
# well defined by using xmlns="http://www.w3.org/2000/svg" instead
# of xmlns:svg="http://www.w3.org/2000/svg".
namespace_dict = root.nsmap.copy() namespace_dict = root.nsmap.copy()
namespace_dict.pop(None, "discard") discarted = namespace_dict.pop(None, "discard")
if discarted == SVG_DEFAULT_NAMESPACE or \
"svg" not in namespace_dict:
namespace_dict["svg"] = SVG_DEFAULT_NAMESPACE
# Get all images which uses xlink:href # Get all images which uses xlink:href
image_list = root.xpath("//svg:image[@xlink:href]", namespaces=namespace_dict) image_list = root.xpath("//svg:image[@xlink:href]", namespaces=namespace_dict)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment