diff options
author | Zufu Liu <unknown> | 2021-07-02 10:13:21 +1000 |
---|---|---|
committer | Zufu Liu <unknown> | 2021-07-02 10:13:21 +1000 |
commit | 7b646db9fbfb71c41c477b01d99e1e1c6c85cef8 (patch) | |
tree | d0886cd0c743eed7d1ef4fca864c1f1bf474e0d3 /test/unit/testDocument.cxx | |
parent | 12dabace25a229d74db880473ecb7a5081bc65b9 (diff) | |
download | scintilla-mirror-7b646db9fbfb71c41c477b01d99e1e1c6c85cef8.tar.gz |
Feature [feature-requests:#1408] Treat valid DBCS lead byte followed by invalid
trail byte as single byte.
Diffstat (limited to 'test/unit/testDocument.cxx')
-rw-r--r-- | test/unit/testDocument.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
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 == '='); + } } |