aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/simpleTests.py
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2019-05-02 14:14:08 +1000
committerNeil <nyamatongwe@gmail.com>2019-05-02 14:14:08 +1000
commitfd00af6bd9cb38ab9719bce0c1360c395c026a8d (patch)
tree57691e97c9f237898f5a10a4ede135a29d7b88b4 /test/simpleTests.py
parente703a397f626208f54703d8af54f31f21c88259d (diff)
downloadscintilla-mirror-fd00af6bd9cb38ab9719bce0c1360c395c026a8d.tar.gz
Optimize SCI_GETTEXT by calling Document::GetCharRange instead of looping for
each byte.
Diffstat (limited to 'test/simpleTests.py')
-rw-r--r--test/simpleTests.py7
1 files changed, 6 insertions, 1 deletions
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")