|
|
|
@ -19,15 +19,15 @@ diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/te
|
|
|
|
|
index 14051d4..ffd590c 100644
|
|
|
|
|
--- a/i18npool/qa/cppunit/test_breakiterator.cxx
|
|
|
|
|
+++ b/i18npool/qa/cppunit/test_breakiterator.cxx
|
|
|
|
|
@@ -42,6 +42,7 @@
|
|
|
|
|
#include <unotest/bootstrapfixturebase.hxx>
|
|
|
|
|
@@ -45,6 +45,7 @@
|
|
|
|
|
#include <com/sun/star/i18n/WordType.hpp>
|
|
|
|
|
|
|
|
|
|
#include <rtl/strbuf.hxx>
|
|
|
|
|
+#include <rtl/ustrbuf.hxx>
|
|
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
|
|
@@ -58,6 +59,9 @@ public:
|
|
|
|
|
@@ -64,6 +65,9 @@
|
|
|
|
|
void testWeak();
|
|
|
|
|
void testAsian();
|
|
|
|
|
void testThai();
|
|
|
|
@ -37,7 +37,7 @@ index 14051d4..ffd590c 100644
|
|
|
|
|
|
|
|
|
|
CPPUNIT_TEST_SUITE(TestBreakIterator);
|
|
|
|
|
CPPUNIT_TEST(testLineBreaking);
|
|
|
|
|
@@ -65,33 +69,54 @@ public:
|
|
|
|
|
@@ -71,6 +75,9 @@
|
|
|
|
|
CPPUNIT_TEST(testWeak);
|
|
|
|
|
CPPUNIT_TEST(testAsian);
|
|
|
|
|
CPPUNIT_TEST(testThai);
|
|
|
|
@ -45,49 +45,52 @@ index 14051d4..ffd590c 100644
|
|
|
|
|
+ CPPUNIT_TEST(testNorthernThai);
|
|
|
|
|
+#endif
|
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
@@ -80,28 +87,46 @@
|
|
|
|
|
uno::Reference<i18n::XBreakIterator> m_xBreak;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
-//See https://bugs.freedesktop.org/show_bug.cgi?id=31271
|
|
|
|
|
-//See https://bugs.freedesktop.org/show_bug.cgi?id=31271 for motivation
|
|
|
|
|
void TestBreakIterator::testLineBreaking()
|
|
|
|
|
{
|
|
|
|
|
- ::rtl::OUString aTest(RTL_CONSTASCII_USTRINGPARAM("(some text here)"));
|
|
|
|
|
- ::rtl::OUString aTest1(RTL_CONSTASCII_USTRINGPARAM("(some text here)"));
|
|
|
|
|
-
|
|
|
|
|
i18n::LineBreakHyphenationOptions aHyphOptions;
|
|
|
|
|
i18n::LineBreakUserOptions aUserOptions;
|
|
|
|
|
lang::Locale aLocale;
|
|
|
|
|
+
|
|
|
|
|
+ //See https://bugs.freedesktop.org/show_bug.cgi?id=31271
|
|
|
|
|
+ {
|
|
|
|
|
+ ::rtl::OUString aTest(RTL_CONSTASCII_USTRINGPARAM("(some text here)"));
|
|
|
|
|
|
|
|
|
|
- aLocale.Language = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en"));
|
|
|
|
|
- aLocale.Country = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US"));
|
|
|
|
|
-
|
|
|
|
|
+ //See https://bugs.freedesktop.org/show_bug.cgi?id=31271
|
|
|
|
|
{
|
|
|
|
|
- //Here we want the line break to leave text here) on the next line
|
|
|
|
|
- i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("(some tex"), aLocale, 0, aHyphOptions, aUserOptions);
|
|
|
|
|
- CPPUNIT_ASSERT_MESSAGE("Expected a break at the the start of the word", aResult.breakIndex == 6);
|
|
|
|
|
+ ::rtl::OUString aTest(RTL_CONSTASCII_USTRINGPARAM("(some text here)"));
|
|
|
|
|
+
|
|
|
|
|
+ aLocale.Language = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en"));
|
|
|
|
|
+ aLocale.Country = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("US"));
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
- {
|
|
|
|
|
- //Here we want the line break to leave text here) on the next line
|
|
|
|
|
- i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest1, strlen("(some tex"), aLocale, 0, aHyphOptions, aUserOptions);
|
|
|
|
|
- CPPUNIT_ASSERT_MESSAGE("Expected a break at the the start of the word", aResult.breakIndex == 6);
|
|
|
|
|
- }
|
|
|
|
|
+ {
|
|
|
|
|
+ //Here we want the line break to leave text here) on the next line
|
|
|
|
|
+ i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("(some tex"), aLocale, 0, aHyphOptions, aUserOptions);
|
|
|
|
|
+ CPPUNIT_ASSERT_MESSAGE("Expected a break at the the start of the word", aResult.breakIndex == 6);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ //Here we want the line break to leave "here)" on the next line
|
|
|
|
|
+ i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("(some text here"), aLocale, 0, aHyphOptions, aUserOptions);
|
|
|
|
|
+ CPPUNIT_ASSERT_MESSAGE("Expected a break at the the start of the word", aResult.breakIndex == 11);
|
|
|
|
|
+ }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //See https://bugs.freedesktop.org/show_bug.cgi?id=49849
|
|
|
|
|
{
|
|
|
|
|
- //Here we want the line break to leave "here)" on the next line
|
|
|
|
|
- i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("(some text here"), aLocale, 0, aHyphOptions, aUserOptions);
|
|
|
|
|
- i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest1, strlen("(some text here"), aLocale, 0, aHyphOptions, aUserOptions);
|
|
|
|
|
- CPPUNIT_ASSERT_MESSAGE("Expected a break at the the start of the word", aResult.breakIndex == 11);
|
|
|
|
|
+ const sal_Unicode HEBREW1[] = { 0x05DE, 0x05D9, 0x05DC, 0x05D9, 0x5DD };
|
|
|
|
|
+ ::rtl::OUString aWord(HEBREW1, SAL_N_ELEMENTS(HEBREW1));
|
|
|
|
@ -104,7 +107,7 @@ index 14051d4..ffd590c 100644
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -295,27 +320,29 @@ void TestBreakIterator::testThai()
|
|
|
|
|
@@ -260,28 +285,30 @@
|
|
|
|
|
aLocale.Language = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("th"));
|
|
|
|
|
aLocale.Country = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TH"));
|
|
|
|
|
|
|
|
|
@ -117,14 +120,7 @@ index 14051d4..ffd590c 100644
|
|
|
|
|
- CPPUNIT_ASSERT_MESSAGE("Should skip full word",
|
|
|
|
|
- aBounds.startPos == 0 && aBounds.endPos == aTest.getLength());
|
|
|
|
|
- }
|
|
|
|
|
+ const sal_Unicode THAI1[] = { 0x0E01, 0x0E38, 0x0E2B, 0x0E25, 0x0E32, 0x0E1A };
|
|
|
|
|
+ ::rtl::OUString aTest(THAI1, SAL_N_ELEMENTS(THAI1));
|
|
|
|
|
+ i18n::Boundary aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale,
|
|
|
|
|
+ i18n::WordType::DICTIONARY_WORD, true);
|
|
|
|
|
+ CPPUNIT_ASSERT_MESSAGE("Should skip full word",
|
|
|
|
|
+ aBounds.startPos == 0 && aBounds.endPos == aTest.getLength());
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-#ifdef TODO
|
|
|
|
|
- {
|
|
|
|
|
- const sal_Unicode NORTHERN_THAI1[] = { 0x0E01, 0x0E38, 0x0E4A, 0x0E2B, 0x0E25, 0x0E32, 0x0E1A };
|
|
|
|
@ -135,6 +131,14 @@ index 14051d4..ffd590c 100644
|
|
|
|
|
- aBounds.startPos == 0 && aBounds.endPos == aTest.getLength());
|
|
|
|
|
- }
|
|
|
|
|
-#endif
|
|
|
|
|
+ const sal_Unicode THAI1[] = { 0x0E01, 0x0E38, 0x0E2B, 0x0E25, 0x0E32, 0x0E1A };
|
|
|
|
|
+ ::rtl::OUString aTest(THAI1, SAL_N_ELEMENTS(THAI1));
|
|
|
|
|
+ i18n::Boundary aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale,
|
|
|
|
|
+ i18n::WordType::DICTIONARY_WORD, true);
|
|
|
|
|
+ CPPUNIT_ASSERT_MESSAGE("Should skip full word",
|
|
|
|
|
+ aBounds.startPos == 0 && aBounds.endPos == aTest.getLength());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+#if TODO
|
|
|
|
|
+void TestBreakIterator::testNorthernThai()
|
|
|
|
|
+{
|
|
|
|
@ -148,11 +152,12 @@ index 14051d4..ffd590c 100644
|
|
|
|
|
+ i18n::WordType::DICTIONARY_WORD, true);
|
|
|
|
|
+ CPPUNIT_ASSERT_MESSAGE("Should skip full word",
|
|
|
|
|
+ aBounds.startPos == 0 && aBounds.endPos == aTest.getLength());
|
|
|
|
|
}
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
|
|
void TestBreakIterator::setUp()
|
|
|
|
|
+
|
|
|
|
|
TestBreakIterator::TestBreakIterator()
|
|
|
|
|
{
|
|
|
|
|
m_xContext = cppu::defaultBootstrap_InitialComponentContext();
|
|
|
|
|
diff --git a/i18npool/source/breakiterator/data/README b/i18npool/source/breakiterator/data/README
|
|
|
|
|
new file mode 100644
|
|
|
|
|
index 0000000..8d7598d
|
|
|
|
|