diff options
author | nyamatongwe <devnull@localhost> | 2010-03-23 05:36:57 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2010-03-23 05:36:57 +0000 |
commit | 7eeabefc7dc4324ce78324d801c496d099520832 (patch) | |
tree | 7d3ec69ef423479367c6d450c78f38d594fb4e13 /test/simpleTests.py | |
parent | 99335bdcf3814c7268bfb3f1a9c0906e59ae11c3 (diff) | |
download | scintilla-mirror-7eeabefc7dc4324ce78324d801c496d099520832.tar.gz |
Upper and lower casing now works on non-ASCII characters.
Diffstat (limited to 'test/simpleTests.py')
-rw-r--r-- | test/simpleTests.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/test/simpleTests.py b/test/simpleTests.py index 99f25afd6..f9a67f59b 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -1047,6 +1047,68 @@ class TestMultiSelection(unittest.TestCase): self.assertEquals(self.ed.GetSelectionNCaret(0), 3) self.assertEquals(self.ed.GetSelectionNCaretVirtualSpace(0), 0) +class TestCaseMapping(unittest.TestCase): + def setUp(self): + self.xite = XiteWin.xiteFrame + self.ed = self.xite.ed + self.ed.ClearAll() + self.ed.EmptyUndoBuffer() + + def tearDown(self): + self.ed.SetCodePage(0) + self.ed.StyleSetCharacterSet(self.ed.STYLE_DEFAULT, self.ed.SC_CHARSET_DEFAULT) + + def testEmpty(self): + # Trying to upper case an empty string caused a crash at one stage + t = b"x" + self.ed.SetText(len(t), t) + self.ed.UpperCase() + self.assertEquals(self.ed.Contents(), b"x") + + def testASCII(self): + t = b"x" + self.ed.SetText(len(t), t) + self.ed.SetSel(0,1) + self.ed.UpperCase() + self.assertEquals(self.ed.Contents(), b"X") + + def testLatin1(self): + t = "å".encode("Latin-1") + r = "Å".encode("Latin-1") + self.ed.SetText(len(t), t) + self.ed.SetSel(0,1) + self.ed.UpperCase() + self.assertEquals(self.ed.Contents(), r) + + def testRussian(self): + self.ed.StyleSetCharacterSet(self.ed.STYLE_DEFAULT, self.ed.SC_CHARSET_RUSSIAN) + t = "Б".encode("Windows-1251") + r = "б".encode("Windows-1251") + self.ed.SetText(len(t), t) + self.ed.SetSel(0,1) + self.ed.LowerCase() + self.assertEquals(self.ed.Contents(), r) + + def testUTF(self): + self.ed.SetCodePage(65001) + t = "å".encode("UTF-8") + r = "Å".encode("UTF-8") + self.ed.SetText(len(t), t) + self.ed.SetSel(0,2) + self.ed.UpperCase() + self.assertEquals(self.ed.Contents(), r) + + def testUTFDifferentLength(self): + self.ed.SetCodePage(65001) + t = "ı".encode("UTF-8") + r = "I".encode("UTF-8") + self.ed.SetText(len(t), t) + self.assertEquals(self.ed.Length, 2) + self.ed.SetSel(0,2) + self.ed.UpperCase() + self.assertEquals(self.ed.Length, 1) + self.assertEquals(self.ed.Contents(), r) + class TestLexer(unittest.TestCase): def setUp(self): self.xite = XiteWin.xiteFrame |