diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-14 14:09:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-14 16:10:30 +0000 |
commit | 1a450f53dbd31a34718f658a81b0fabbbc329764 (patch) | |
tree | 4735f53e84c9aef961017426fe69f493c45c2915 /i18npool | |
parent | 156bd43bd96379d86535afa38ce4d4f8044f45a6 (diff) |
add a unit test to demo broken thai word-boundary detection
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/qa/cppunit/test_breakiterator.cxx | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 661e46acc417..a68bc77231af 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -41,7 +41,8 @@ #include "cppunit/plugin/TestPlugIn.h" #include <com/sun/star/i18n/XBreakIterator.hpp> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> -#include <com/sun/star/i18n/ScriptType.hdl> +#include <com/sun/star/i18n/ScriptType.hpp> +#include <com/sun/star/i18n/WordType.hpp> #include <rtl/strbuf.hxx> @@ -62,12 +63,14 @@ public: void testGraphemeIteration(); void testWeak(); void testAsian(); + void testThai(); CPPUNIT_TEST_SUITE(TestBreakIterator); CPPUNIT_TEST(testLineBreaking); CPPUNIT_TEST(testGraphemeIteration); CPPUNIT_TEST(testWeak); CPPUNIT_TEST(testAsian); +// CPPUNIT_TEST(testThai); CPPUNIT_TEST_SUITE_END(); private: @@ -249,6 +252,25 @@ void TestBreakIterator::testAsian() } } +//A test to ensure that our thai word boundary detection is useful +//http://lists.freedesktop.org/archives/libreoffice/2012-February/025959.html +void TestBreakIterator::testThai() +{ + lang::Locale aLocale; + aLocale.Language = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("th")); + aLocale.Country = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TH")); + + { + const sal_Unicode THAI1[] = { 0x0E01, 0x0E38, 0x0E2B, 0x0E25, 0x0E32, 0x0E1A }; + ::rtl::OUString aTest1(THAI1, SAL_N_ELEMENTS(THAI1)); + + i18n::Boundary aBounds = m_xBreak->getWordBoundary(aTest1, 0, aLocale, + i18n::WordType::DICTIONARY_WORD, true); + CPPUNIT_ASSERT_MESSAGE("Should skip full word", + aBounds.startPos == 0 && aBounds.endPos == aTest1.getLength()); + } +} + TestBreakIterator::TestBreakIterator() { m_xContext = cppu::defaultBootstrap_InitialComponentContext(); |