From fd00af6bd9cb38ab9719bce0c1360c395c026a8d Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 2 May 2019 14:14:08 +1000 Subject: Optimize SCI_GETTEXT by calling Document::GetCharRange instead of looping for each byte. --- test/simpleTests.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/simpleTests.py') diff --git a/test/simpleTests.py b/test/simpleTests.py index 9a170a2f9..e4512b617 100644 --- a/test/simpleTests.py +++ b/test/simpleTests.py @@ -540,9 +540,14 @@ class TestSimple(unittest.TestCase): def testGetSet(self): self.ed.SetContents(b"abc") self.assertEquals(self.ed.TextLength, 3) - result = ctypes.create_string_buffer(b"\0" * 5) + # String buffer containing exactly 5 digits + result = ctypes.create_string_buffer(b"12345", 5) + self.assertEquals(result.raw, b"12345") length = self.ed.GetText(4, result) + self.assertEquals(length, 3) self.assertEquals(result.value, b"abc") + # GetText has written the 3 bytes of text and a terminating NUL but left the final digit 5 + self.assertEquals(result.raw, b"abc\x005") def testAppend(self): self.ed.SetContents(b"abc") -- cgit v1.2.3