From 686893888dea2c6b23fa1e6dbab8b99d5ad36a20 Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Wed, 22 Nov 2023 16:41:27 -0800 Subject: [PATCH] ICU-13219 Add test for mark --- icu4c/source/test/intltest/rbbitst.cpp | 33 +++++++++++++++++++ .../com/ibm/icu/dev/test/rbbi/RBBITest.java | 18 ++++++++++ 2 files changed, 51 insertions(+) diff --git a/icu4c/source/test/intltest/rbbitst.cpp b/icu4c/source/test/intltest/rbbitst.cpp index 15a7570c2869..1592543cf09a 100644 --- a/icu4c/source/test/intltest/rbbitst.cpp +++ b/icu4c/source/test/intltest/rbbitst.cpp @@ -3929,6 +3929,23 @@ void RBBITest::TestDXLineBreaks() assertEquals(WHERE, expected[i], actuals[i]); } } + + bi->setText(UnicodeString(u"aaอออaaaaaอออ aaaa")); + c = bi->first(); + actuals.clear(); + do { + actuals.push_back(c); + } while ((c = bi->next()) != BreakIterator::DONE ); + std::vector expected2{ 0, 17, 21 }; + assertEquals(WHERE, + static_cast(expected2.size()), + static_cast(actuals.size())); + if (expected2.size() == actuals.size()) { + for (size_t i = 0; i < expected2.size(); i++) { + assertEquals(WHERE, expected2[i], actuals[i]); + } + } + #endif } @@ -3959,6 +3976,22 @@ void RBBITest::TestDXWordBreaks() assertEquals(WHERE, expected[i], actuals[i]); } } + + bi->setText(UnicodeString(u"aaอออaaaaaอออ aaaa")); + c = bi->first(); + actuals.clear(); + do { + actuals.push_back(c); + } while ((c = bi->next()) != BreakIterator::DONE ); + std::vector expected2{ 0, 13, 17, 21 }; + assertEquals(WHERE, + static_cast(expected2.size()), + static_cast(actuals.size())); + if (expected2.size() == actuals.size()) { + for (size_t i = 0; i < expected2.size(); i++) { + assertEquals(WHERE, expected2[i], actuals[i]); + } + } #endif } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/rbbi/RBBITest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/rbbi/RBBITest.java index 21e129ea7aec..a82edb8773c1 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/rbbi/RBBITest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/rbbi/RBBITest.java @@ -1017,6 +1017,15 @@ public void TestDXLineBreaks() { actuals.add(c); } while ((c = brk.next()) != BreakIterator.DONE); assertEquals("-u-dx- is not working", expected, actuals); + + brk.setText("aaอออaaaaaอออ aaaa"); + actuals.clear(); + expected = new ArrayList(Arrays.asList(0, 17, 21)); + c = brk.first(); + do { + actuals.add(c); + } while ((c = brk.next()) != BreakIterator.DONE); + assertEquals("-u-dx- is not working", expected, actuals); } @Test public void TestDXWordBreaks() { @@ -1031,5 +1040,14 @@ public void TestDXWordBreaks() { actuals.add(c); } while ((c = brk.next()) != BreakIterator.DONE); assertEquals("-u-dx- is not working", expected, actuals); + + brk.setText("aaอออaaaaaอออ aaaa"); + actuals.clear(); + expected = new ArrayList(Arrays.asList(0, 13, 17, 21)); + c = brk.first(); + do { + actuals.add(c); + } while ((c = brk.next()) != BreakIterator.DONE); + assertEquals("-u-dx- is not working", expected, actuals); } }