fix patch to apply

f41
Caolán McNamara 13 years ago
parent 5660ed702f
commit 62d2be4eb9

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

Loading…
Cancel
Save