Unittests: Add a test for proper decoding of ISO 8859-15
This commit is contained in:
parent
8984e550b0
commit
946ca3ce4a
3 changed files with 12 additions and 2 deletions
10
testscour.py
10
testscour.py
|
|
@ -604,9 +604,9 @@ class ChangeQuadToShorthandInPath(unittest.TestCase):
|
||||||
self.assertEqual(path.getAttribute('d'), 'm10 100q50-50 100 0t100 0',
|
self.assertEqual(path.getAttribute('d'), 'm10 100q50-50 100 0t100 0',
|
||||||
'Did not change quadratic curves into shorthand curve segments in path')
|
'Did not change quadratic curves into shorthand curve segments in path')
|
||||||
|
|
||||||
class HandleUTF8(unittest.TestCase):
|
class HandleEncodingUTF8(unittest.TestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
doc = scour.scourXmlFile('unittests/utf8.svg')
|
doc = scour.scourXmlFile('unittests/encoding-utf8.svg')
|
||||||
text = u'Hello in many languages:\nar: أهلا\nbn: হ্যালো\nel: Χαίρετε\nen: Hello\nhi: नमस्ते\niw: שלום\nja: こんにちは\nkm: ជំរាបសួរ\nml: ഹലോ\nru: Здравствуйте\nur: ہیلو\nzh: 您好'
|
text = u'Hello in many languages:\nar: أهلا\nbn: হ্যালো\nel: Χαίρετε\nen: Hello\nhi: नमस्ते\niw: שלום\nja: こんにちは\nkm: ជំរាបសួរ\nml: ഹലോ\nru: Здравствуйте\nur: ہیلو\nzh: 您好'
|
||||||
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[0].firstChild.wholeText).strip()
|
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[0].firstChild.wholeText).strip()
|
||||||
self.assertEqual( desc, text, 'Did not handle international UTF8 characters' )
|
self.assertEqual( desc, text, 'Did not handle international UTF8 characters' )
|
||||||
|
|
@ -617,6 +617,12 @@ class HandleUTF8(unittest.TestCase):
|
||||||
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[3].firstChild.wholeText).strip()
|
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[3].firstChild.wholeText).strip()
|
||||||
self.assertEqual( desc, u'⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎', 'Did not handle superscript/subscript UTF8 characters' )
|
self.assertEqual( desc, u'⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁽⁾ⁿⁱ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎', 'Did not handle superscript/subscript UTF8 characters' )
|
||||||
|
|
||||||
|
class HandleEncodingISO_8859_15(unittest.TestCase):
|
||||||
|
def runTest(self):
|
||||||
|
doc = scour.scourXmlFile('unittests/encoding-iso-8859-15.svg')
|
||||||
|
desc = six.text_type(doc.getElementsByTagNameNS(SVGNS, 'desc')[0].firstChild.wholeText).strip()
|
||||||
|
self.assertEqual( desc, u'áèîäöüß€ŠšŽžŒœŸ', 'Did not handle ISO 8859-15 encoded characters' )
|
||||||
|
|
||||||
class HandleSciNoInPathData(unittest.TestCase):
|
class HandleSciNoInPathData(unittest.TestCase):
|
||||||
def runTest(self):
|
def runTest(self):
|
||||||
doc = scour.scourXmlFile('unittests/path-sn.svg')
|
doc = scour.scourXmlFile('unittests/path-sn.svg')
|
||||||
|
|
|
||||||
4
unittests/encoding-iso-8859-15.svg
Normal file
4
unittests/encoding-iso-8859-15.svg
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-15" standalone="no"?>
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<desc>áèîäöüߤ¦¨´¸¼½¾</desc>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 731 B After Width: | Height: | Size: 731 B |
Loading…
Add table
Add a link
Reference in a new issue