From 7b646db9fbfb71c41c477b01d99e1e1c6c85cef8 Mon Sep 17 00:00:00 2001 From: Zufu Liu Date: Fri, 2 Jul 2021 10:13:21 +1000 Subject: Feature [feature-requests:#1408] Treat valid DBCS lead byte followed by invalid trail byte as single byte. --- test/unit/testDocument.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'test') diff --git a/test/unit/testDocument.cxx b/test/unit/testDocument.cxx index 14d5fc22f..cc6255caa 100644 --- a/test/unit/testDocument.cxx +++ b/test/unit/testDocument.cxx @@ -100,4 +100,24 @@ TEST_CASE("Document") { REQUIRE(location == 1); } + SECTION("GetCharacterAndWidth") { + Document doc(DocumentOption::Default); + doc.SetDBCSCodePage(932); + REQUIRE(doc.CodePage() == 932); + const Sci::Position length = doc.InsertString(0, "\x84\xff=", 3); + REQUIRE(3 == length); + REQUIRE(3 == doc.Length()); + Sci::Position width = 0; + int ch = doc.GetCharacterAndWidth(0, &width); + REQUIRE(width == 1); + REQUIRE(ch == 0x84); + width = 0; + ch = doc.GetCharacterAndWidth(1, &width); + REQUIRE(width == 1); + REQUIRE(ch == 0xff); + width = 0; + ch = doc.GetCharacterAndWidth(2, &width); + REQUIRE(width == 1); + REQUIRE(ch == '='); + } } -- cgit v1.2.3