aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/simpleTests.py
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2013-07-11 10:43:40 +1000
committerNeil <nyamatongwe@gmail.com>2013-07-11 10:43:40 +1000
commitdad0081820141b9823f8a4ad633b28515f055f1f (patch)
tree823e4cc29a3fa9a524aa308bb824cf5406c7b47f /test/simpleTests.py
parent431004e5efda4bddbeb265db3d0e28fda828a808 (diff)
downloadscintilla-mirror-dad0081820141b9823f8a4ad633b28515f055f1f.tar.gz
Include case conversion data in Scintilla so that all platforms will perform
case conversion of Unicode text in accordance with Unicode.
Diffstat (limited to 'test/simpleTests.py')
-rw-r--r--test/simpleTests.py70
1 files changed, 30 insertions, 40 deletions
diff --git a/test/simpleTests.py b/test/simpleTests.py
index 4c669f297..ed55a67f9 100644
--- a/test/simpleTests.py
+++ b/test/simpleTests.py
@@ -1414,39 +1414,35 @@ class TestCaseMapping(unittest.TestCase):
self.assertEquals(self.ed.Contents(), r)
def testUTFGrows(self):
- # FIXME: change to using Unicode compliant case conversion on Windows
- if sys.platform != "win32":
- # This crashed at one point in debug builds due to looking past end of shorter string
- self.ed.SetCodePage(65001)
- # ﬖ is a single character ligature taking 3 bytes in UTF8: EF AC 96
- t = 'ﬖﬖ'.encode("UTF-8")
- self.ed.SetContents(t)
- self.assertEquals(self.ed.Length, 6)
- self.ed.SetSel(0,self.ed.Length)
- self.ed.UpperCase()
- # To convert to upper case the ligature is separated into վ and ն then uppercased to Վ and Ն
- # each of which takes 2 bytes in UTF-8: D5 8E D5 86
- r = 'ՎՆՎՆ'.encode("UTF-8")
- self.assertEquals(self.ed.Length, 8)
- self.assertEquals(self.ed.Contents(), r)
- self.assertEquals(self.ed.SelectionEnd, self.ed.Length)
+ # This crashed at one point in debug builds due to looking past end of shorter string
+ self.ed.SetCodePage(65001)
+ # ﬖ is a single character ligature taking 3 bytes in UTF8: EF AC 96
+ t = 'ﬖﬖ'.encode("UTF-8")
+ self.ed.SetContents(t)
+ self.assertEquals(self.ed.Length, 6)
+ self.ed.SetSel(0,self.ed.Length)
+ self.ed.UpperCase()
+ # To convert to upper case the ligature is separated into վ and ն then uppercased to Վ and Ն
+ # each of which takes 2 bytes in UTF-8: D5 8E D5 86
+ r = 'ՎՆՎՆ'.encode("UTF-8")
+ self.assertEquals(self.ed.Length, 8)
+ self.assertEquals(self.ed.Contents(), r)
+ self.assertEquals(self.ed.SelectionEnd, self.ed.Length)
def testUTFShrinks(self):
- # FIXME: change to using Unicode compliant case conversion on Windows
- if sys.platform != "win32":
- self.ed.SetCodePage(65001)
- # fi is a single character ligature taking 3 bytes in UTF8: EF AC 81
- t = 'fifi'.encode("UTF-8")
- self.ed.SetContents(t)
- self.assertEquals(self.ed.Length, 6)
- self.ed.SetSel(0,self.ed.Length)
- self.ed.UpperCase()
- # To convert to upper case the ligature is separated into f and i then uppercased to F and I
- # each of which takes 1 byte in UTF-8: 46 49
- r = 'FIFI'.encode("UTF-8")
- self.assertEquals(self.ed.Length, 4)
- self.assertEquals(self.ed.Contents(), r)
- self.assertEquals(self.ed.SelectionEnd, self.ed.Length)
+ self.ed.SetCodePage(65001)
+ # fi is a single character ligature taking 3 bytes in UTF8: EF AC 81
+ t = 'fifi'.encode("UTF-8")
+ self.ed.SetContents(t)
+ self.assertEquals(self.ed.Length, 6)
+ self.ed.SetSel(0,self.ed.Length)
+ self.ed.UpperCase()
+ # To convert to upper case the ligature is separated into f and i then uppercased to F and I
+ # each of which takes 1 byte in UTF-8: 46 49
+ r = 'FIFI'.encode("UTF-8")
+ self.assertEquals(self.ed.Length, 4)
+ self.assertEquals(self.ed.Contents(), r)
+ self.assertEquals(self.ed.SelectionEnd, self.ed.Length)
class TestCaseInsensitiveSearch(unittest.TestCase):
def setUp(self):
@@ -1514,15 +1510,9 @@ class TestCaseInsensitiveSearch(unittest.TestCase):
def testUTFDifferentLength(self):
# Searching for a two byte string finds a single byte
self.ed.SetCodePage(65001)
- # The platforms currently have different folding behaviour (should be fixed)
- if sys.platform == "win32":
- # two byte string "İ" single byte "i"
- text = "Fråndi Ååİ $".encode("UTF-8")
- searchString = "İ".encode("UTF-8")
- else:
- # two byte string "ſ" single byte "s"
- text = "Frånds Ååſ $".encode("UTF-8")
- searchString = "ſ".encode("UTF-8")
+ # two byte string "ſ" single byte "s"
+ text = "Frånds Ååſ $".encode("UTF-8")
+ searchString = "ſ".encode("UTF-8")
firstPosition = len("Frånd".encode("UTF-8"))
self.assertEquals(len(searchString), 2)
self.ed.SetContents(text)