[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_defaultnumberingprovider.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit f94351f54bfaa6e6da42da2a33b3fa468b878a1f Author: Stephan Bergmann AuthorDate: Sun Nov 19 20:42:07 2023 +0100 Commit: Stephan Bergmann CommitDate: Mon Nov 20 07:26:48 2023 +0100 Extended loplugin:ostr: i18npool Change-Id: Ia0a844bc6e3f27758c869f5e229097085288e8bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159698 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index 69ac73d41a89..7e37f1c28ff7 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -63,7 +63,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testNumberingIdentifi { aFail.emplace_back( "Numbering: " + OString::number(i) + " \"" + aID.toUtf8() + "\"" -+ (aID.isEmpty() ? "" ++ (aID.isEmpty() ? ""_ostr : OString(" duplicate of " + OString::number(aMap[aID]))) + "\n"); } @@ -72,7 +72,7 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testNumberingIdentifi if (!aFail.empty()) { -OString aMsg("Not unique numbering identifiers:\n"); +OString aMsg("Not unique numbering identifiers:\n"_ostr); for (auto const& r : aFail) aMsg += r; CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), false);
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx| 64 +- i18npool/qa/cppunit/test_characterclassification.cxx |4 i18npool/source/breakiterator/breakiteratorImpl.cxx |2 i18npool/source/collator/chaptercollator.cxx |4 i18npool/source/collator/collator_unicode.cxx |4 i18npool/source/indexentry/indexentrysupplier.cxx |2 i18npool/source/indexentry/indexentrysupplier_ja_phonetic.cxx |4 i18npool/source/nativenumber/nativenumbersupplier.cxx |2 i18npool/source/ordinalsuffix/ordinalsuffix.cxx |2 9 files changed, 44 insertions(+), 44 deletions(-) New commits: commit 3bbed358b617eb407184edac9a11aed62e36a2d7 Author: Stephan Bergmann AuthorDate: Thu Oct 19 10:30:18 2023 +0200 Commit: Stephan Bergmann CommitDate: Fri Oct 20 07:06:43 2023 +0200 Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: i18npool Change-Id: If3eb4d8fb3068e26ce42c8cc751c2de38b5d04cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158202 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 9edadaaf4755..4463f46270e1 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -92,7 +92,7 @@ void TestBreakIterator::testLineBreaking() //See https://bugs.libreoffice.org/show_bug.cgi?id=49849 { -static constexpr OUStringLiteral aWord = u"\u05DE\u05D9\u05DC\u05D9\u05DD"; +static constexpr OUString aWord = u"\u05DE\u05D9\u05DC\u05D9\u05DD"_ustr; OUString aTest(aWord + " " + aWord); aLocale.Language = "he"; @@ -148,8 +148,8 @@ void TestBreakIterator::testLineBreaking() //See https://bugs.documentfoundation.org/show_bug.cgi?id=96197 { -static constexpr OUStringLiteral aTest = u"\uc560\uad6D\uac00\uc758 \uac00" - "\uc0ac\ub294"; +static constexpr OUString aTest = u"\uc560\uad6D\uac00\uc758 \uac00" + "\uc0ac\ub294"_ustr; aLocale.Language = "ko"; aLocale.Country = "KR"; @@ -226,7 +226,7 @@ void TestBreakIterator::testWordBoundaries() //See https://bz.apache.org/ooo/show_bug.cgi?id=14904 { -static constexpr OUStringLiteral aTest = +static constexpr OUString aTest = u"Working \u201CWords" " starting wit" "h quotes\u201D Work" @@ -234,7 +234,7 @@ void TestBreakIterator::testWordBoundaries() "?Spanish? doe" "sn\u2019t work. No" "t even \u00BFreal? " -"Spanish"; +"Spanish"_ustr; aBounds = m_xBreak->getWordBoundary(aTest, 4, aLocale, i18n::WordType::DICTIONARY_WORD, false); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); @@ -462,8 +462,8 @@ void TestBreakIterator::testWordBoundaries() break; } -static constexpr OUStringLiteral aTest = -u"I\u200Bwant\u200Bto\u200Bgo"; +static constexpr OUString aTest = +u"I\u200Bwant\u200Bto\u200Bgo"_ustr; sal_Int32 nPos = 0; sal_Int32 aExpected[] = {1, 6, 9, 12}; @@ -498,11 +498,11 @@ void TestBreakIterator::testWordBoundaries() break; } -static constexpr OUStringLiteral aTest = +static constexpr OUString aTest = u"\u1F0C\u03BD\u03B4\u03C1\u03B1 \u1F00" "\u03C1\u03BD\u1F7B\u03BC\u03B5\u03BD\u03BF" "\u03C2 \u1F00\u03BB\u03BB \u1F24" -"\u03C3\u03B8\u03B9\u03BF\u03BD"; +"\u03C3\u03B8\u03B9\u03BF\u03BD"_ustr; sal_Int32 nPos = 0; sal_Int32 aExpected[] = {5, 15, 19, 26}; @@ -569,8 +569,8 @@ void TestBreakIterator::testWordBoundaries() aLocale.Language = "en"; aLocale.Country = "US"; -static constexpr OUStringLiteral aTest = -u"ru\uFB00le \uFB01sh"; +static constexpr OUString aTest = +u"ru\uFB00le \uFB01sh"_ustr; aBounds = m_xBreak->getWordBoundary(aTest, 1, aLocale, i18n::WordType::DICTIONARY_WORD, false); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); @@ -586,8 +586,8 @@ void TestBreakIterator::testWordBoundaries() aLocale.Language = "en"; aLocale.Country = "US"; -static constexpr OUStringLiteral aTest = -u"a\u2013b\u2014c"; +static constexpr OUString aTest = +u"a\u2013b\u2014c"_ustr; aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, i18n::WordType::DICTIONARY_WORD, true); CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); @@ -614,7 +614,7 @@ void TestBreakIterator::testGraphemeIteration() aLocale.Country = "IN"; { -static constexpr OUStringLiteral
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_characterclassification.cxx | 55 +++ 1 file changed, 55 insertions(+) New commits: commit d592e502488857871c44ba5d6e06043b1b6a63c4 Author: Khaled Hosny AuthorDate: Mon Jul 24 20:28:56 2023 +0300 Commit: خالد حسني CommitDate: Mon Jul 24 21:07:02 2023 +0200 i18npool: Test case folding of surrogate pairs Change-Id: I3097651927b85aaa46fc4fc59badf22d24fcb928 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154872 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/i18npool/qa/cppunit/test_characterclassification.cxx b/i18npool/qa/cppunit/test_characterclassification.cxx index 206bcec83882..78397029b71f 100644 --- a/i18npool/qa/cppunit/test_characterclassification.cxx +++ b/i18npool/qa/cppunit/test_characterclassification.cxx @@ -217,6 +217,61 @@ CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testTdf97152) } } +CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testSurrogatePairs) +{ +{ +// No case mapping +OUString sTest(u"\U0001F600"); +OUString sLowerCase = m_xCC->toLower(sTest, 0, sTest.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower", OUString(u"\U0001F600"), sLowerCase); +OUString sUpperCase = m_xCC->toUpper(sLowerCase, 0, sLowerCase.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", sTest, sUpperCase); +} + +{ +// Case mapping +OUString sTest(u"\U00010400"); +OUString sLowerCase = m_xCC->toLower(sTest, 0, sTest.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower", OUString(u"\U00010428"), sLowerCase); +OUString sUpperCase = m_xCC->toUpper(sLowerCase, 0, sLowerCase.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", sTest, sUpperCase); +} +} + +CPPUNIT_TEST_FIXTURE(TestCharacterClassification, testAdlam) +{ +OUString sUpper(u""); +OUString sLower(u""); +OUString sTitle = sLower; // Adlam doesn’t have title case? +{ +// From upper case +OUString sLowerRes = m_xCC->toLower(sUpper, 0, sUpper.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower", sLower, sLowerRes); +OUString sUpperRes = m_xCC->toUpper(sLowerRes, 0, sLower.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", sUpper, sUpperRes); +} + +{ +// From lower case +OUString sTitleRes = m_xCC->toTitle(sLower, 0, sLower.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be title", sTitle, sTitleRes); +OUString sUpperRes = m_xCC->toUpper(sLower, 0, sLower.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", sUpper, sUpperRes); +OUString sLowerRes = m_xCC->toLower(sUpperRes, 0, sUpperRes.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower", sLower, sLowerRes); +} + +{ +// From title case +OUString sTitleRes = m_xCC->toTitle(sTitle, 0, sTitle.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be title", sTitle, sTitleRes); +OUString sUpperRes = m_xCC->toUpper(sTitle, 0, sTitle.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be upper", sUpper, sUpperRes); +OUString sLowerRes = m_xCC->toLower(sTitle, 0, sTitle.getLength(), {}); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be lower", sLower, sLowerRes); +} +} + void TestCharacterClassification::setUp() { BootstrapFixtureBase::setUp();
[Libreoffice-commits] core.git: i18npool/qa i18npool/util
i18npool/qa/cppunit/transliteration.cxx |8 ++-- i18npool/util/i18npool.component|6 +++--- 2 files changed, 5 insertions(+), 9 deletions(-) New commits: commit 65710a8d0098752b1079680563a053c2770ec958 Author: Stephan Bergmann AuthorDate: Tue Apr 4 14:23:49 2023 +0200 Commit: Stephan Bergmann CommitDate: Tue Apr 4 16:42:58 2023 +0200 Fix typos in XML that broke three implementation elements The typos all originated with d2140a6320cd1cf4dea29b174cdb3bcb5261056b "i18npool: create instances with uno constructors", causing three intended constructor attributes to rather be plain character data. Which apparently went unnoticed until recently (see the TODOs resolved here that had been introduced with 456a146b9eb643655ae2bd336740e8c5536913aa "tdf#151971: Fix used implementation names of transliteration services"), in part because the Parser class in cppuhelper/source/servicemanager.cxx silently ignores any unexpected character data via xmlreader::XmlReader::Text::NONE.) Change-Id: Ia8fdbc09c67d10530b4d86dbbbde2b6b84038e66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150021 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/qa/cppunit/transliteration.cxx b/i18npool/qa/cppunit/transliteration.cxx index 77d82aa60eec..712a3c02244a 100644 --- a/i18npool/qa/cppunit/transliteration.cxx +++ b/i18npool/qa/cppunit/transliteration.cxx @@ -68,9 +68,7 @@ public: trans->loadModuleNew({ css::i18n::TransliterationModulesNew_NumToTextUpper_zh_CN }, {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_NumToTextLower_zh_TW }, {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_NumToTextUpper_zh_TW }, {}); -#if 0 //TODO: currently broken - trans->loadModuleNew({css::i18n::TransliterationModulesNew_NumToTextFormalHangul_ko}, {}); -#endif +trans->loadModuleNew({ css::i18n::TransliterationModulesNew_NumToTextFormalHangul_ko }, {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_NumToTextFormalLower_ko }, {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_NumToTextFormalUpper_ko }, {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_NumToTextInformalHangul_ko }, @@ -102,9 +100,7 @@ public: {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_TextToNumInformalUpper_ko }, {}); -#if 0 //TODO: currently broken - trans->loadModuleNew({css::i18n::TransliterationModulesNew_CharToNumLower_zh_CN}, {}); -#endif +trans->loadModuleNew({ css::i18n::TransliterationModulesNew_CharToNumLower_zh_CN }, {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_CharToNumUpper_zh_CN }, {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_CharToNumLower_zh_TW }, {}); trans->loadModuleNew({ css::i18n::TransliterationModulesNew_CharToNumUpper_zh_TW }, {}); diff --git a/i18npool/util/i18npool.component b/i18npool/util/i18npool.component index e3e437c875ee..b540f2bd98e2 100644 --- a/i18npool/util/i18npool.component +++ b/i18npool/util/i18npool.component @@ -226,7 +226,7 @@ constructor="i18npool_CharToNumLower_ko_get_implementation"> - + @@ -354,7 +354,7 @@ - + @@ -380,7 +380,7 @@ constructor="i18npool_NumToTextFullwidth_zh_TW_get_implementation"> - +
[Libreoffice-commits] core.git: i18npool/qa svx/source
i18npool/qa/cppunit/test_breakiterator.cxx | 44 ++--- svx/source/dialog/strarray.cxx | 10 +++--- 2 files changed, 27 insertions(+), 27 deletions(-) New commits: commit eb5c14f305f9c6355bd49bd65ab9175831453cb3 Author: ektagoel12 AuthorDate: Mon Jan 23 11:49:42 2023 +0530 Commit: Hossein CommitDate: Tue Jan 31 13:30:53 2023 + tdf#147021 Use std::size() instead of SAL_N_ELEMENTS() macro Also change some range based for Change-Id: I2e17feaba7a6b219aa0c9126c5046cf3bdf855d8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145988 Tested-by: Jenkins Reviewed-by: Hossein diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index cdcbff9be535..6673fb4b8df5 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -274,9 +274,9 @@ void TestBreakIterator::testWordBoundaries() for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode) { //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary -for (size_t i = 0; i < SAL_N_ELEMENTS(aBreakTests); ++i) +for (auto const& i: aBreakTests) { -OUString aTest = "Word" + OUStringChar(aBreakTests[i]) + "Word"; +OUString aTest = "Word" + OUStringChar(i) + "Word"; aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true); switch (mode) { @@ -307,9 +307,9 @@ void TestBreakIterator::testWordBoundaries() for (int mode = i18n::WordType::ANY_WORD; mode <= i18n::WordType::WORD_COUNT; ++mode) { //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary -for (size_t i = 0; i < SAL_N_ELEMENTS(aJoinTests); ++i) +for (auto const& p: aJoinTests) { -OUString aTest = "Word" + OUStringChar(aJoinTests[i]) + "Word"; +OUString aTest = "Word" + OUStringChar(p) + "Word"; aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true); switch (mode) { @@ -347,21 +347,21 @@ void TestBreakIterator::testWordBoundaries() }; const sal_Int32 aDoublePositions[] = {0, 2, 4, 6, 8, 10, 12, 14}; -for (size_t j = 0; j < SAL_N_ELEMENTS(aTests); ++j) +for (auto const& r: aTests) { -OUString aTest = aBase.replace('x', aTests[j]); +OUString aTest = aBase.replace('x', r); sal_Int32 nPos = -1; size_t i = 0; do { -CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aDoublePositions)); +CPPUNIT_ASSERT(i < std::size(aDoublePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; CPPUNIT_ASSERT_EQUAL(aDoublePositions[i], nPos); ++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); -i = SAL_N_ELEMENTS(aDoublePositions)-1; +i = std::size(aDoublePositions)-1; do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; @@ -379,14 +379,14 @@ void TestBreakIterator::testWordBoundaries() size_t i = 0; do { -CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSinglePositions)); +CPPUNIT_ASSERT(i < std::size(aSinglePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; CPPUNIT_ASSERT_EQUAL(aSinglePositions[i], nPos); ++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); -i = SAL_N_ELEMENTS(aSinglePositions)-1; +i = std::size(aSinglePositions)-1; do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; @@ -404,14 +404,14 @@ void TestBreakIterator::testWordBoundaries() size_t i = 0; do { -CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSingleQuotePositions)); +CPPUNIT_ASSERT(i < std::size(aSingleQuotePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i], nPos); ++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); -i = SAL_N_ELEMENTS(aSingleQuotePositions)-1; +i = std::size(aSingleQuotePositions)-1; do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale,
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_textsearch.cxx | 121 i18npool/source/search/textsearch.cxx | 79 +++- i18npool/source/search/textsearch.hxx |4 - 3 files changed, 148 insertions(+), 56 deletions(-) New commits: commit 2a78fbf4e4a49f2b52aa1352aac41ee024d0cf72 Author: Khaled Hosny AuthorDate: Wed Aug 17 10:45:24 2022 +0200 Commit: خالد حسني CommitDate: Fri Aug 19 19:02:01 2022 +0200 tdf#91764: Combining marks from “complex” scripts can’t be searched for Don’t skip search results that are in the middle of a grapheme cluster (AKA cell in LO speak). It is not clear why it was done like this, as these checks are present all the way back to the first commit of this file: commit 36eb193f4809221af42c01c5ac226a97cf74ec21 Author: Rüdiger Timm Date: Tue Apr 8 15:01:00 2003 + INTEGRATION: CWS calc06 (1.1.2); FILE ADDED 2003/03/26 15:54:42 er 1.1.2.1: #i3393# moved from i18n module, cleaned out tools module usage, and added support for regexp But ignoring such results and only for so-called “complex” scripts seems arbitrary, and as the linked issue shows, people want to be able to search for combining marks. Furthermore, it prevents searching for a base character followed by a combining mark, unless ignoring diacritics is enabled. Change-Id: I530788d928861ddfa18dd7b813d0a13f53c0b77b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138410 Tested-by: Jenkins Reviewed-by: خالد حسني diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 1d72a8d83f18..f224e58c3809 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -38,12 +38,14 @@ public: void testSearches(); void testWildcardSearch(); void testApostropheSearch(); +void testTdf138410(); CPPUNIT_TEST_SUITE(TestTextSearch); CPPUNIT_TEST(testICU); CPPUNIT_TEST(testSearches); CPPUNIT_TEST(testWildcardSearch); CPPUNIT_TEST(testApostropheSearch); +CPPUNIT_TEST(testTdf138410); CPPUNIT_TEST_SUITE_END(); private: uno::Reference m_xSearch; @@ -402,6 +404,125 @@ void TestTextSearch::testApostropheSearch() CPPUNIT_ASSERT( aRes.subRegExpressions > 0 ); } +void TestTextSearch::testTdf138410() +{ +OUString str(u"\u0643\u064f\u062a\u064f\u0628 \u0643\u062a\u0628"); +sal_Int32 startPos = 0, endPos = str.getLength(); + +util::SearchOptions aOptions; +aOptions.algorithmType = util::SearchAlgorithms_ABSOLUTE; + +util::SearchResult aRes; + +// A) base alone +// The search string will be found whether it is followed by a mark in the +// text or not, and whether IGNORE_DIACRITICS_CTL is set or not. + +// set options +aOptions.searchString = u"\u0643"; +aOptions.transliterateFlags = 0; +m_xSearch->setOptions(aOptions); + +// search forward +aRes = m_xSearch->searchForward(str, startPos, endPos); +CPPUNIT_ASSERT(aRes.subRegExpressions > 0); +CPPUNIT_ASSERT_EQUAL(static_cast(0), aRes.startOffset[0]); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aRes.endOffset[0]); + +// search backwards +aRes = m_xSearch->searchBackward(str, endPos, startPos); +CPPUNIT_ASSERT(aRes.subRegExpressions > 0); +CPPUNIT_ASSERT_EQUAL(static_cast(7), aRes.startOffset[0]); +CPPUNIT_ASSERT_EQUAL(static_cast(6), aRes.endOffset[0]); + +// check with transliteration +aOptions.transliterateFlags = static_cast(TransliterationFlags::IGNORE_DIACRITICS_CTL); +m_xSearch->setOptions(aOptions); + +// search forward +aRes = m_xSearch->searchForward(str, startPos, endPos); +CPPUNIT_ASSERT(aRes.subRegExpressions > 0); +CPPUNIT_ASSERT_EQUAL(static_cast(0), aRes.startOffset[0]); +CPPUNIT_ASSERT_EQUAL(static_cast(1), aRes.endOffset[0]); + +// search backwards +aRes = m_xSearch->searchBackward(str, endPos, startPos); +CPPUNIT_ASSERT(aRes.subRegExpressions > 0); +CPPUNIT_ASSERT_EQUAL(static_cast(7), aRes.startOffset[0]); +CPPUNIT_ASSERT_EQUAL(static_cast(6), aRes.endOffset[0]); + +// b) base+mark +// The search string will be found when followed by a mark in the text, or +// when IGNORE_DIACRITICS_CTL is set whether it is followed by a mark or +// not. + +// set options +aOptions.searchString = u"\u0643\u064f"; +aOptions.transliterateFlags = 0; +m_xSearch->setOptions(aOptions); + +// search forward +aRes = m_xSearch->searchForward(str, startPos, endPos); +CPPUNIT_ASSERT(aRes.subRegExpressions > 0); +CPPUNIT_ASSERT_EQUAL(static_cast(0), aRes.startOffset[0]); +CPPUNIT_ASSERT_EQUAL(static_cast(2), aRes.endOffset[0]); + +// search backwards +aRes = m_xSearch->searchBackward(str, endPos, startPos); +CPPUNIT_ASSERT(aRes.subRegExpressions > 0); +CPPUNIT_ASSERT_EQUAL(static_cast(2),
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) New commits: commit 67c577c692faaa0382d26c3c3f47b5ffa9deaa77 Author: Rene Engelhard AuthorDate: Fri Apr 15 08:38:52 2022 +0200 Commit: Eike Rathke CommitDate: Fri Apr 15 20:23:13 2022 +0200 apply ICU test workaround to < 70 to "fix" test with ICU 71 See also 263961306ede0656ebb7904034a2172615ce81d0 Change-Id: Ib64ec43dba59ffddb34fe7f1a0f0d2e589c3455c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133063 Tested-by: René Engelhard Reviewed-by: Eike Rathke diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index b74ff4222be4..cdcbff9be535 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -856,11 +856,11 @@ void TestBreakIterator::testLao() i18n::WordType::DICTIONARY_WORD, true); CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); -#if (U_ICU_VERSION_MAJOR_NUM != 70) +#if (U_ICU_VERSION_MAJOR_NUM < 70) CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aBounds.endPos); #else // FIXME: -// In ICU 70 for yet unknown reason the word boundary 9 is not detected and +// In ICU 70/71 for yet unknown reason the word boundary 9 is not detected and // instead the length 12 is returned as endpos. // Deep in // icu_70::RuleBasedBreakIterator::BreakCache::next()
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_textsearch.cxx |9 - i18npool/source/search/textsearch.cxx | 14 +++--- i18npool/source/search/textsearch.hxx |2 -- 3 files changed, 11 insertions(+), 14 deletions(-) New commits: commit 0dc4cbe342d93ce27b92c5a408adcb009b39b48f Author: Mike Kaganski AuthorDate: Thu Mar 10 09:44:14 2022 +0300 Commit: Mike Kaganski CommitDate: Thu Mar 10 08:45:42 2022 +0100 Use icu::UnicodeString directly Change-Id: I41b4e64d6d3a9310d819904c8d32c689e6300bcd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131296 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 31c66d94cd8d..1d72a8d83f18 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -27,7 +27,6 @@ #include using namespace ::com::sun::star; -typedef U_ICU_NAMESPACE::UnicodeString IcuUniString; class TestTextSearch : public test::BootstrapFixtureBase { @@ -59,11 +58,11 @@ void TestTextSearch::testICU() OUString aString( "abcdefgh" ); OUString aPattern( "e" ); -IcuUniString aSearchPat( reinterpret_cast(aPattern.getStr()), aPattern.getLength() ); +icu::UnicodeString aSearchPat( reinterpret_cast(aPattern.getStr()), aPattern.getLength() ); std::unique_ptr pRegexMatcher(new icu::RegexMatcher( aSearchPat, nSearchFlags, nErr )); -IcuUniString aSource( reinterpret_cast(aString.getStr()), aString.getLength() ); +icu::UnicodeString aSource( reinterpret_cast(aString.getStr()), aString.getLength() ); pRegexMatcher->reset( aSource ); CPPUNIT_ASSERT( pRegexMatcher->find( 0, nErr ) ); @@ -76,10 +75,10 @@ void TestTextSearch::testICU() OUString aString2( "acababaabcababadcdaa" ); OUString aPattern2( "a" ); -IcuUniString aSearchPat2( reinterpret_cast(aPattern2.getStr()), aPattern2.getLength() ); +icu::UnicodeString aSearchPat2( reinterpret_cast(aPattern2.getStr()), aPattern2.getLength() ); pRegexMatcher.reset(new icu::RegexMatcher( aSearchPat2, nSearchFlags, nErr )); -IcuUniString aSource2( reinterpret_cast(aString2.getStr()), aString2.getLength() ); +icu::UnicodeString aSource2( reinterpret_cast(aString2.getStr()), aString2.getLength() ); pRegexMatcher->reset( aSource2 ); CPPUNIT_ASSERT( pRegexMatcher->find( 0, nErr ) ); diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 1df286dfcd35..c80afc19890f 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -877,19 +877,19 @@ void TextSearch::RESrchPrepare( const css::util::SearchOptions2& rOptions) nIcuSearchFlags |= UREGEX_CASE_INSENSITIVE; UErrorCode nIcuErr = U_ZERO_ERROR; // assumption: transliteration didn't mangle regexp control chars -IcuUniString aIcuSearchPatStr( reinterpret_cast(rPatternStr.getStr()), rPatternStr.getLength()); +icu::UnicodeString aIcuSearchPatStr( reinterpret_cast(rPatternStr.getStr()), rPatternStr.getLength()); #ifndef DISABLE_WORDBOUND_EMULATION // for convenience specific syntax elements of the old regex engine are emulated // - by replacing \< with "word-break followed by a look-ahead word-char" -static const IcuUniString aChevronPatternB( "<", -1, IcuUniString::kInvariant); -static const IcuUniString aChevronReplaceB( "b(?=w)", -1, IcuUniString::kInvariant); +static const icu::UnicodeString aChevronPatternB( "<", -1, icu::UnicodeString::kInvariant); +static const icu::UnicodeString aChevronReplaceB( "b(?=w)", -1, icu::UnicodeString::kInvariant); static icu::RegexMatcher aChevronMatcherB( aChevronPatternB, 0, nIcuErr); aChevronMatcherB.reset( aIcuSearchPatStr); aIcuSearchPatStr = aChevronMatcherB.replaceAll( aChevronReplaceB, nIcuErr); aChevronMatcherB.reset(); // - by replacing \> with "look-behind word-char followed by a word-break" -static const IcuUniString aChevronPatternE( ">", -1, IcuUniString::kInvariant); -static const IcuUniString aChevronReplaceE( "(?<=w)b", -1, IcuUniString::kInvariant); +static const icu::UnicodeString aChevronPatternE( ">", -1, icu::UnicodeString::kInvariant); +static const icu::UnicodeString aChevronReplaceE( "(?<=w)b", -1, icu::UnicodeString::kInvariant); static icu::RegexMatcher aChevronMatcherE( aChevronPatternE, 0, nIcuErr); aChevronMatcherE.reset( aIcuSearchPatStr); aIcuSearchPatStr = aChevronMatcherE.replaceAll( aChevronReplaceE, nIcuErr); @@ -957,7 +957,7 @@ SearchResult TextSearch::RESrchFrwrd( const OUString& searchStr, // use the ICU RegexMatcher to find the matches UErrorCode nIcuErr = U_ZERO_ERROR; -const IcuUniString aSearchTargetStr(false, reinterpret_cast(searchStr.getStr()), +const icu::UnicodeString aSearchTargetStr(false,
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 6bc8a1ba5151e44d2ea539fe5f6408fc3d6be02a Author: Stephan Bergmann AuthorDate: Mon Oct 25 10:39:47 2021 +0200 Commit: Stephan Bergmann CommitDate: Mon Oct 25 11:32:02 2021 +0200 Missing `static` ...from aa2064c5c5f23f6f4b7bc44e12345b37f66995bc "Improve loplugin:stringliteralvar", similar to 8b32a3edad52f8ac5e5f0f49b4f4e80954c2fd25 "Fix stack-use-after-scope" (though this case doesn't appear to have caused any actual issues). (After manual inspection, there appear to be no further missing `static` at least in aa2064c5c5f23f6f4b7bc44e12345b37f66995bc "Improve loplugin:stringliteralvar".) Change-Id: I2b3d0d8d2af1d65f0c5bef8a858107020a620974 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124137 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index a341c712f704..936649bb537e 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -96,7 +96,7 @@ void TestBreakIterator::testLineBreaking() //See https://bugs.libreoffice.org/show_bug.cgi?id=49849 { -constexpr OUStringLiteral aWord = u"\u05DE\u05D9\u05DC\u05D9\u05DD"; +static constexpr OUStringLiteral aWord = u"\u05DE\u05D9\u05DC\u05D9\u05DD"; OUString aTest(aWord + " " + aWord); aLocale.Language = "he";
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_defaultnumberingprovider.cxx | 282 ++ i18npool/source/nativenumber/data/numberchar.h|4 2 files changed, 284 insertions(+), 2 deletions(-) New commits: commit 9c13f1ad6384ee05a10ed688b93a46f6489a872a Author: DaeHyun Sung AuthorDate: Wed Aug 18 23:50:43 2021 +0900 Commit: Eike Rathke CommitDate: Thu Aug 19 19:10:24 2021 +0200 tdf#143526 add Korean Numbering test case & fix Hanja number codepoint add Korean Numbering test cases 1. koreanCounting 2. koreanLegal 3. koreanDigital 4. koreanDigital2 fix Korean Hanja number codepoint for Zero(0) Following MS Office's numFmt Strng example https://docs.microsoft.com/en-us/openspecs/office_standards/ms-docx/a1bb5809-e361-4e49-8e16-7f1a67da4121 Korean Hanja notation for Hanja is `零 U+96F6` on MS Word 2019 and that document. So, fix the Korean Hanja number code pointfor Zero(0) `零 U+96F6` Change-Id: I1a5b95640a93e7fbc3a0e724b154587877b198a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120676 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index f7382ede1a9f..1bf0ab521079 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -183,6 +183,288 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5) CPPUNIT_ASSERT_EQUAL(OUString("1"), aActual); } +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanCounting) +{ +// 1 -> "일" +uno::Reference xFormatter( +text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); +uno::Sequence aProperties = { +comphelper::makePropertyValue( +"NumberingType", static_cast(style::NumberingType::NUMBER_HANGUL_KO)), +comphelper::makePropertyValue("Value", static_cast(1)), +}; +lang::Locale aLocale; +OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); +// Without the accompanying fix in place, this test would have failed with a +// lang.IllegalArgumentException, support for NUMBER_HANGUL_KO was missing. +CPPUNIT_ASSERT_EQUAL(OUString(u"\uc77c"), aActual); + +// 10 -> "십" +aProperties = { +comphelper::makePropertyValue( +"NumberingType", static_cast(style::NumberingType::NUMBER_HANGUL_KO)), +comphelper::makePropertyValue("Value", static_cast(10)), +}; +aActual = xFormatter->makeNumberingString(aProperties, aLocale); +CPPUNIT_ASSERT_EQUAL(OUString(u"\uc2ed"), aActual); + +// 100 -> "백" +aProperties = { +comphelper::makePropertyValue( +"NumberingType", static_cast(style::NumberingType::NUMBER_HANGUL_KO)), +comphelper::makePropertyValue("Value", static_cast(100)), +}; +aActual = xFormatter->makeNumberingString(aProperties, aLocale); +CPPUNIT_ASSERT_EQUAL(OUString(u"\ubc31"), aActual); +} + +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal) +{ +// 1 -> "하나" +uno::Reference xFormatter( +text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); +uno::Sequence aProperties = { +comphelper::makePropertyValue( +"NumberingType", static_cast(style::NumberingType::NUMBER_LEGAL_KO)), +comphelper::makePropertyValue("Value", static_cast(1)), +}; +lang::Locale aLocale; +OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); +// Without the accompanying fix in place, this test would have failed with a +// lang.IllegalArgumentException, support for NUMBER_LEGAL_KO was missing. +CPPUNIT_ASSERT_EQUAL(OUString(u"\ud558\ub098"), aActual); + +// 2 -> "둘" +aProperties = { +comphelper::makePropertyValue( +"NumberingType", static_cast(style::NumberingType::NUMBER_LEGAL_KO)), +comphelper::makePropertyValue("Value", static_cast(2)), +}; +aActual = xFormatter->makeNumberingString(aProperties, aLocale); +CPPUNIT_ASSERT_EQUAL(OUString(u"\ub458"), aActual); + +// 3 -> "셋" +aProperties = { +comphelper::makePropertyValue( +"NumberingType", static_cast(style::NumberingType::NUMBER_LEGAL_KO)), +comphelper::makePropertyValue("Value", static_cast(3)), +}; +aActual = xFormatter->makeNumberingString(aProperties, aLocale); +CPPUNIT_ASSERT_EQUAL(OUString(u"\uc14b"), aActual); + +// 4 -> "넷" +aProperties = { +comphelper::makePropertyValue( +"NumberingType", static_cast(style::NumberingType::NUMBER_LEGAL_KO)), +comphelper::makePropertyValue("Value", static_cast(4)), +}; +aActual = xFormatter->makeNumberingString(aProperties, aLocale); +CPPUNIT_ASSERT_EQUAL(OUString(u"\ub137"), aActual); + +// 5
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_defaultnumberingprovider.cxx |4 -- i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 17 ++ 2 files changed, 17 insertions(+), 4 deletions(-) New commits: commit ac80ec817eb07c77a51bc0729985a473c734182e Author: Eike Rathke AuthorDate: Thu Jul 29 17:49:08 2021 +0200 Commit: Eike Rathke CommitDate: Thu Jul 29 23:39:47 2021 +0200 Make duplicate generated numbering identifiers unique, tdf#143526 follow-up Change-Id: I28366c4e868e97b70e016b056b73b88b4cc8b812 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119677 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index 4770abb93808..f7382ede1a9f 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -57,10 +57,6 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testNumberingIdentifi // FIXME: duplicate of NUMBER_UPPER_ZH_TW case css::style::NumberingType::NUMBER_INDIC_DEVANAGARI: // FIXME: duplicate of NUMBER_EAST_ARABIC_INDIC -case css::style::NumberingType::NUMBER_DIGITAL_KO: -// FIXME: duplicate of NUMBER_HANGUL_KO -case css::style::NumberingType::NUMBER_DIGITAL2_KO: -// FIXME: duplicate of NUMBER_LOWER_ZH break; default: if (aID.isEmpty() || !aMap.insert(std::pair(aID, i)).second) diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index b7ee64cac5eb..a5a604903ad6 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -1128,6 +1128,23 @@ OUString DefaultNumberingProvider::makeNumberingIdentifier(sal_Int16 index) result.append(", "); } result.append("..."); +// Make known duplicate generated identifiers unique. +// Note this alone works only for newly added numberings, if duplicates +// are in the wild further handling is needed when loading documents +// and asking for numberings. +switch (aSupportedTypes[index].nType) +{ +case css::style::NumberingType::NUMBER_DIGITAL_KO: +// Duplicate of NUMBER_HANGUL_KO. +result.append(" (ko-x-digital)"); +break; +case css::style::NumberingType::NUMBER_DIGITAL2_KO: +// Duplicate of NUMBER_LOWER_ZH. +result.append(" (ko)"); +break; +default: +; // nothing +} return result.makeStringAndClear(); } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_defaultnumberingprovider.cxx | 61 ++ 1 file changed, 61 insertions(+) New commits: commit c186d09f88d6a4992382a1d15b60db6dbed3a91b Author: Eike Rathke AuthorDate: Thu Jul 29 16:35:24 2021 +0200 Commit: Eike Rathke CommitDate: Thu Jul 29 18:49:57 2021 +0200 Add NumberingIdentifier unit test, tdf#143526 related Change-Id: I9d4df6f63dc9ebc90e99fecce14b3551c74f7f1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119675 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index dbe55050a01c..4770abb93808 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -12,9 +12,12 @@ #include #include #include +#include #include +#include + using namespace ::com::sun::star; /// i18npool defaultnumberingprovider tests. @@ -22,6 +25,64 @@ class I18npoolDefaultnumberingproviderTest : public test::BootstrapFixture { }; +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testNumberingIdentifiers) +{ +// All numbering identifiers must be unique. +std::unordered_map aMap; +std::vector aFail; + +uno::Reference xFormatter( +text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); + +// Do not use getSupportedNumberingTypes() because it depends on +// configuration whether CTL and CJK numberings are included or not. +// Also do not test for known values of +// offapi/com/sun/star/style/NumberingType.idl and miss newly added values. +// Instead, enumerate until an empty ID is returned but also check there +// are at least the known NumberingType values covered, just in case the +// table wasn't maintained. So this may have to be adapted from time to +// time. +constexpr sal_Int16 kLastKnown = css::style::NumberingType::NUMBER_LEGAL_KO; +for (sal_Int16 i = 0; i < SAL_MAX_INT16; ++i) +{ +OUString aID(xFormatter->getNumberingIdentifier(i)); +if (aID.isEmpty() && i > kLastKnown) +break; // for + +switch (i) +{ +case css::style::NumberingType::TRANSLITERATION: +// TODO: why does this have no identifier? +case css::style::NumberingType::NUMBER_UPPER_KO: +// FIXME: duplicate of NUMBER_UPPER_ZH_TW +case css::style::NumberingType::NUMBER_INDIC_DEVANAGARI: +// FIXME: duplicate of NUMBER_EAST_ARABIC_INDIC +case css::style::NumberingType::NUMBER_DIGITAL_KO: +// FIXME: duplicate of NUMBER_HANGUL_KO +case css::style::NumberingType::NUMBER_DIGITAL2_KO: +// FIXME: duplicate of NUMBER_LOWER_ZH +break; +default: +if (aID.isEmpty() || !aMap.insert(std::pair(aID, i)).second) +{ +aFail.emplace_back( +"Numbering: " + OString::number(i) + " \"" + aID.toUtf8() + "\"" ++ (aID.isEmpty() ? "" + : OString(" duplicate of " + OString::number(aMap[aID]))) ++ "\n"); +} +} +} + +if (!aFail.empty()) +{ +OString aMsg("Not unique numbering identifiers:\n"); +for (auto const& r : aFail) +aMsg += r; +CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), false); +} +} + CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero) { // 1 -> "01" ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source i18nutil/source svx/source
i18npool/qa/cppunit/test_breakiterator.cxx|6 -- i18npool/source/collator/collator_unicode.cxx |4 i18nutil/source/utility/unicode.cxx |2 -- svx/source/dialog/charmap.cxx |4 4 files changed, 16 deletions(-) New commits: commit a21fa7312c45b7b0eb331593f1a6fbeb4d27666f Author: Mike Kaganski AuthorDate: Mon Jun 14 13:17:37 2021 +0200 Commit: Mike Kaganski CommitDate: Mon Jun 14 15:26:23 2021 +0200 We only support ICU version 4.6 or newer, so drop these checks The minimal ICU version check is in configure.ac. Change-Id: Ib6480cd3290dabb45d87c6dcbcc9b5513d172e21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117119 Tested-by: Jenkins Reviewed-by: Mike Kaganski diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index a12949c952e1..a341c712f704 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -276,12 +276,6 @@ void TestBreakIterator::testWordBoundaries() //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary for (size_t i = 0; i < SAL_N_ELEMENTS(aBreakTests); ++i) { -#if (U_ICU_VERSION_MAJOR_NUM == 4) && (U_ICU_VERSION_MINOR_NUM <= 2) -//Note the breakiterator test is known to fail on older icu -//versions (4.2.1) for the 200B (ZWSP) Zero Width Space testcase. -if (aBreakTests[i] == 0x200B) -continue; -#endif OUString aTest = "Word" + OUStringChar(aBreakTests[i]) + "Word"; aBounds = m_xBreak->getWordBoundary(aTest, 0, aLocale, mode, true); switch (mode) diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx index 2cff45a6d68d..fc99879759e8 100644 --- a/i18npool/source/collator/collator_unicode.cxx +++ b/i18npool/source/collator/collator_unicode.cxx @@ -360,9 +360,6 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: const sal_uInt8* ruleImage=func(); size_t ruleImageSize = funclen(); -#if (U_ICU_VERSION_MAJOR_NUM == 4) && (U_ICU_VERSION_MINOR_NUM <= 2) -uca_base = new icu::RuleBasedCollator(static_cast(NULL), status); -#else // Not only changed ICU 53.1 the API behavior that a negative // length (ruleImageSize) now leads to failure, but also that // the base RuleBasedCollator passed as uca_base here needs to @@ -374,7 +371,6 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: // NULL (default) locale does not. uca_base.reset( static_cast(icu::Collator::createInstance( icu::Locale::getRoot(), status)) ); -#endif if (! U_SUCCESS(status)) { OUString message = "icu::Collator::createInstance() failed: " + OUString::createFromAscii(u_errorName(status)); SAL_WARN("i18npool", message); diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx index 6a4fdd061f9d..2b8d0a256e99 100644 --- a/i18nutil/source/utility/unicode.cxx +++ b/i18nutil/source/utility/unicode.cxx @@ -572,7 +572,6 @@ OString unicode::getExemplarLanguageForUScriptCode(UScriptCode eScript) case USCRIPT_MANDAEAN: /* Aliased to USCRIPT_MANDAIC in icu 4.6. */ sRet = "mic"; break; -#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4) case USCRIPT_NABATAEAN: //no language with an assigned code yet sRet = "mis"; break; @@ -624,7 +623,6 @@ OString unicode::getExemplarLanguageForUScriptCode(UScriptCode eScript) case USCRIPT_WARANG_CITI: sRet = "hoc"; break; -#endif #if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 8) case USCRIPT_AFAKA: sRet = "djk"; diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index a31c1fff1b68..501c85d6b55d 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -1393,7 +1393,6 @@ void SubsetMap::InitList() case UBLOCK_DOMINO_TILES: aAllSubsets.emplace_back( 0x1F030, 0x1F09F, SvxResId(RID_SUBSETSTR_DOMINO_TILES) ); break; -#if (U_ICU_VERSION_MAJOR_NUM > 4) || (U_ICU_VERSION_MAJOR_NUM == 4 && U_ICU_VERSION_MINOR_NUM >= 4) case UBLOCK_SAMARITAN: aAllSubsets.emplace_back( 0x0800, 0x083F, SvxResId(RID_SUBSETSTR_SAMARITAN) ); break; @@ -1472,8 +1471,6 @@ void SubsetMap::InitList() case UBLOCK_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C: aAllSubsets.emplace_back( 0x2A700, 0x2B73F,
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_textsearch.cxx | 115 i18npool/source/search/textsearch.cxx | 30 i18npool/source/search/textsearch.hxx |3 3 files changed, 148 insertions(+) New commits: commit d40f2d02df26e216f367b5da3f9546b73f250469 Author: László Németh AuthorDate: Thu Nov 12 11:33:05 2020 +0100 Commit: László Németh CommitDate: Fri Nov 13 16:06:25 2020 +0100 tdf#117643 Writer: fix apostrophe search regression During text search, ASCII apostrophe ' (U+0027) of the search term matches the typographic apostrophe ’ (U+2019) of the text, too. There was a UX regression in document editing from commit e6fade1ce133039d28369751b77ac8faff6e40cb (tdf#38395 enable smart apostrophe replacement by default), because Find and Replace window and Find toolbar doesn't replace ASCII apostrophe, so the search term hadn't matched the text (now with the automatically replaced typographic apostrophes), as before the commit. Regex search hasn't been modified, i.e. searching U+2019 is still necessary a search term with U+2019. The typographic apostrophes of a search term only match ASCII apostrophes of the text, if the search term contain also an ASCII apostrophe, too. Note: as a more sophisticated solution, it's possible to add a new default transliteration option for this later. Change-Id: I5121edbef5cf34fdd5b5f9ba3c046a06329a756a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105717 Tested-by: Jenkins Reviewed-by: László Németh diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 3d157e2cbdb4..51e6a11bfc83 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -38,11 +38,13 @@ public: void testICU(); void testSearches(); void testWildcardSearch(); +void testApostropheSearch(); CPPUNIT_TEST_SUITE(TestTextSearch); CPPUNIT_TEST(testICU); CPPUNIT_TEST(testSearches); CPPUNIT_TEST(testWildcardSearch); +CPPUNIT_TEST(testApostropheSearch); CPPUNIT_TEST_SUITE_END(); private: uno::Reference m_xSearch; @@ -265,6 +267,119 @@ void TestTextSearch::testWildcardSearch() CPPUNIT_ASSERT((aRes.startOffset[0] == 6) && (aRes.endOffset[0] == 0)); } +void TestTextSearch::testApostropheSearch() +{ +// A) find typographic apostrophes also by using ASCII apostrophe in searchString +OUString str( u"It\u2019s an apostrophe." ); +sal_Int32 startPos = 0, endPos = str.getLength(); + +// set options +util::SearchOptions aOptions; +aOptions.algorithmType = util::SearchAlgorithms_ABSOLUTE; +aOptions.searchFlag = util::SearchFlags::ALL_IGNORE_CASE; +aOptions.searchString = "'"; +m_xSearch->setOptions( aOptions ); + +util::SearchResult aRes; + +// search forward +aRes = m_xSearch->searchForward( str, startPos, endPos ); +// This was 0. +CPPUNIT_ASSERT( aRes.subRegExpressions > 0 ); +CPPUNIT_ASSERT_EQUAL( static_cast(2), aRes.startOffset[0] ); +CPPUNIT_ASSERT_EQUAL( static_cast(3), aRes.endOffset[0] ); + +// search backwards +aRes = m_xSearch->searchBackward( str, endPos, startPos ); +// This was 0. +CPPUNIT_ASSERT( aRes.subRegExpressions > 0 ); +CPPUNIT_ASSERT_EQUAL( static_cast(3), aRes.startOffset[0] ); +CPPUNIT_ASSERT_EQUAL( static_cast(2), aRes.endOffset[0] ); + +// check with transliteration +aOptions.transliterateFlags = static_cast(TransliterationFlags::IGNORE_CASE +| TransliterationFlags::IGNORE_WIDTH); +m_xSearch->setOptions(aOptions); + +// search forward +aRes = m_xSearch->searchForward( str, startPos, endPos ); +// This was 0. +CPPUNIT_ASSERT( aRes.subRegExpressions > 0 ); +CPPUNIT_ASSERT_EQUAL( static_cast(2), aRes.startOffset[0] ); +CPPUNIT_ASSERT_EQUAL( static_cast(3), aRes.endOffset[0] ); + +// search backwards +aRes = m_xSearch->searchBackward( str, endPos, startPos ); +// This was 0. +CPPUNIT_ASSERT( aRes.subRegExpressions > 0 ); +CPPUNIT_ASSERT_EQUAL( static_cast(3), aRes.startOffset[0] ); +CPPUNIT_ASSERT_EQUAL( static_cast(2), aRes.endOffset[0] ); + +// B) search ASCII apostrophe in a text with ASCII apostrophes +str = str.replace(u'\u2019', '\''); + +// search forward +aRes = m_xSearch->searchForward( str, startPos, endPos ); +CPPUNIT_ASSERT( aRes.subRegExpressions > 0 ); +CPPUNIT_ASSERT_EQUAL( static_cast(2), aRes.startOffset[0] ); +CPPUNIT_ASSERT_EQUAL( static_cast(3), aRes.endOffset[0] ); + +// search backwards +aRes = m_xSearch->searchBackward( str, endPos, startPos ); +CPPUNIT_ASSERT( aRes.subRegExpressions > 0 ); +CPPUNIT_ASSERT_EQUAL( static_cast(3), aRes.startOffset[0] ); +CPPUNIT_ASSERT_EQUAL( static_cast(2), aRes.endOffset[0] ); + +// C) search typographic
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx |1 + 1 file changed, 1 insertion(+) New commits: commit f8f51778053178066113a5e88f1802110d3c60bb Author: Stephan Bergmann AuthorDate: Tue Nov 10 15:04:56 2020 +0100 Commit: Stephan Bergmann CommitDate: Tue Nov 10 17:51:53 2020 +0100 Reinstate o3tl/cppunittraitshelper.hxx use for C++20 ...introduced with 5d8f0fad50f90195a11873c70ddab4644f5839ea "Adapt CPPUNIT_ASSERT to C++20 deleted ostream << for sal_Unicode (aka char16_t)" (see there for details) but erroneously removed with 877f40ac3f2add2b6dc37bae280d4d98dd102286 "tdf#42949 Fix new IWYU warnings in directories [h-r]*" Change-Id: Id22a4c0fdfe1471e2455ec3316f2c6c93cc00b22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105549 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 864387415124..7d900fcfdbac 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -11,6 +11,7 @@ #include #include #include +#include #include #include ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx |4 +--- i18npool/qa/cppunit/test_textsearch.cxx|3 +-- i18npool/source/localedata/LocaleNode.cxx |8 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) New commits: commit 3d20df43c450889ec0a8f61ea12df7338eb1ff97 Author: Stephan Bergmann AuthorDate: Thu Jun 4 09:11:26 2020 +0200 Commit: Stephan Bergmann CommitDate: Thu Jun 4 14:33:50 2020 +0200 Upcoming loplugin:elidestringvar: i18npool Change-Id: I5644ca7f2ef1b251ce1c262d3001ca48f2ed9edd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95482 Tested-by: Jenkins Reviewed-by: Stephan Bergmann diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index a41cd821857c..3be0ea4e8d0d 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -113,14 +113,12 @@ void TestBreakIterator::testLineBreaking() //See https://bz.apache.org/ooo/show_bug.cgi?id=17155 { -OUString const aTest("foo /bar/baz"); - aLocale.Language = "en"; aLocale.Country = "US"; { //Here we want the line break to leave /bar/ba clumped together on the next line -i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("foo /bar/ba"), aLocale, 0, +i18n::LineBreakResults aResult = m_xBreak->getLineBreak("foo /bar/baz", strlen("foo /bar/ba"), aLocale, 0, aHyphOptions, aUserOptions); CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the first slash", static_cast(4), aResult.breakIndex); } diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index b2175b21bfa5..3d157e2cbdb4 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -92,7 +92,6 @@ void TestTextSearch::testSearches() { OUString str( "acababaabcababadcdaa" ); sal_Int32 startPos = 2, endPos = 20 ; -OUString const searchStr( "(ab)*a(c|d)+" ); sal_Int32 const fStartRes = 10, fEndRes = 18 ; sal_Int32 const bStartRes = 18, bEndRes = 10 ; @@ -100,7 +99,7 @@ void TestTextSearch::testSearches() util::SearchOptions aOptions; aOptions.algorithmType = util::SearchAlgorithms_REGEXP ; aOptions.searchFlag = util::SearchFlags::ALL_IGNORE_CASE; -aOptions.searchString = searchStr; +aOptions.searchString = "(ab)*a(c|d)+"; m_xSearch->setOptions( aOptions ); util::SearchResult aRes; diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index ddc8cf46dfd1..3760ac753e06 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -711,12 +711,8 @@ void LCFormatNode::generateCode (const OFileWriter ) const if (strcmp( of.getLocale(), "en_US") != 0) { const OUString& aCode( n->getValue()); -OUString const aPar1( "0)"); -OUString const aPar2( "-)" ); -OUString const aPar3( " )" ); -OUString const aPar4( "])" ); -if (aCode.indexOf( aPar1 ) > 0 || aCode.indexOf( aPar2 ) > 0 || -aCode.indexOf( aPar3 ) > 0 || aCode.indexOf( aPar4 ) > 0) +if (aCode.indexOf( "0)" ) > 0 || aCode.indexOf( "-)" ) > 0 || +aCode.indexOf( " )" ) > 0 || aCode.indexOf( "])" ) > 0) fprintf( stderr, "Warning: FormatCode formatindex=\"%d\" for currency uses parentheses for negative amounts, which probably is not correct for locales not based on en_US.\n", formatindex); } // Check if we have replaceTo for "[CURRENCY]" placeholder. ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source include/editeng offapi/com sw/qa sw/source writerfilter/source
i18npool/qa/cppunit/test_defaultnumberingprovider.cxx | 26 ++ i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |5 + include/editeng/svxenum.hxx |1 offapi/com/sun/star/style/NumberingType.idl |7 ++ sw/qa/extras/odfexport/data/arabic-zero5-numbering.odt|binary sw/qa/extras/odfexport/odfexport.cxx | 13 + sw/qa/extras/ooxmlexport/data/arabic-zero5-numbering.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx| 13 + sw/source/filter/ww8/docxattributeoutput.cxx |4 + writerfilter/source/dmapper/ConversionHelper.cxx |4 + 10 files changed, 73 insertions(+) New commits: commit 8540c7b18bae9c9b46e6feb7658198a7fc62e811 Author: Miklos Vajna AuthorDate: Mon Mar 23 13:37:25 2020 +0100 Commit: Miklos Vajna CommitDate: Mon Mar 23 14:32:37 2020 +0100 sw: add pad-to-5 numbering This is the last padded numbering type that is supported by Word but was not supported by Writer. Change-Id: Ica1a0843897c61a4b569105fd21e5bfe7b5012cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90912 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index a74e92b7c432..dbe55050a01c 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -100,6 +100,32 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4) CPPUNIT_ASSERT_EQUAL(OUString("1000"), aActual); } +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5) +{ +// 1000 -> "01000" +uno::Reference xFormatter( +text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); +uno::Sequence aProperties = { +comphelper::makePropertyValue("NumberingType", + static_cast(style::NumberingType::ARABIC_ZERO5)), +comphelper::makePropertyValue("Value", static_cast(1000)), +}; +lang::Locale aLocale; +OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); +// Without the accompanying fix in place, this test would have failed with a +// lang.IllegalArgumentException, support for ARABIC_ZERO5 was missing. +CPPUNIT_ASSERT_EQUAL(OUString("01000"), aActual); + +// 1 -> "1" +aProperties = { +comphelper::makePropertyValue("NumberingType", + static_cast(style::NumberingType::ARABIC_ZERO5)), +comphelper::makePropertyValue("Value", static_cast(1)), +}; +aActual = xFormatter->makeNumberingString(aProperties, aLocale); +CPPUNIT_ASSERT_EQUAL(OUString("1"), aActual); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index ea308fcaefe9..e2cd4adc6cc4 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -949,6 +949,10 @@ DefaultNumberingProvider::makeNumberingString( const Sequence()); } +DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering, "arabic-zero5-numbering.odt") +{ +auto xNumberingRules += getProperty>(getParagraph(1), "NumberingRules"); +comphelper::SequenceAsHashMap aMap(xNumberingRules->getByIndex(0)); +// Without the accompanying fix in place, this test would have failed with: +// - Expected: 67 +// - Actual : 4 +// i.e. numbering type was ARABIC, not ARABIC_ZERO5. + CPPUNIT_ASSERT_EQUAL(static_cast(style::NumberingType::ARABIC_ZERO5), + aMap["NumberingType"].get()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/data/arabic-zero5-numbering.docx b/sw/qa/extras/ooxmlexport/data/arabic-zero5-numbering.docx new file mode 100644 index ..f7df2c5267fe Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/arabic-zero5-numbering.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index c4cd522caccb..cff728463f28 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -176,6 +176,19 @@ DECLARE_ODFEXPORT_TEST(testArabicZero4Numbering, "arabic-zero4-numbering.docx") aMap["NumberingType"].get()); } +DECLARE_ODFEXPORT_TEST(testArabicZero5Numbering, "arabic-zero5-numbering.docx") +{ +auto xNumberingRules +=
[Libreoffice-commits] core.git: i18npool/qa i18npool/source include/editeng offapi/com
i18npool/qa/cppunit/test_defaultnumberingprovider.cxx | 26 ++ i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |4 + include/editeng/svxenum.hxx |1 offapi/com/sun/star/style/NumberingType.idl |7 ++ 4 files changed, 38 insertions(+) New commits: commit fcef4857e042ff3c9dd8a6c60cf1a58e07f3224c Author: Miklos Vajna AuthorDate: Fri Mar 20 13:38:45 2020 +0100 Commit: Miklos Vajna CommitDate: Fri Mar 20 16:58:53 2020 +0100 sw pad-to-4 numbering: add doc model, UNO API and layout This is the actual numbering the customer needed, pad-to-2 and pad-to-3 was added just for compleness (since Word has it and it's related). Change-Id: I7fdf67488955ab3ee0db169f11fffd21d9cc1e3b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90791 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index fee8df329520..a74e92b7c432 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -74,6 +74,32 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero3) CPPUNIT_ASSERT_EQUAL(OUString("100"), aActual); } +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero4) +{ +// 100 -> "0100" +uno::Reference xFormatter( +text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); +uno::Sequence aProperties = { +comphelper::makePropertyValue("NumberingType", + static_cast(style::NumberingType::ARABIC_ZERO4)), +comphelper::makePropertyValue("Value", static_cast(100)), +}; +lang::Locale aLocale; +OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); +// Without the accompanying fix in place, this test would have failed with a +// lang.IllegalArgumentException, support for ARABIC_ZERO4 was missing. +CPPUNIT_ASSERT_EQUAL(OUString("0100"), aActual); + +// 1000 -> "1000" +aProperties = { +comphelper::makePropertyValue("NumberingType", + static_cast(style::NumberingType::ARABIC_ZERO4)), +comphelper::makePropertyValue("Value", static_cast(1000)), +}; +aActual = xFormatter->makeNumberingString(aProperties, aLocale); +CPPUNIT_ASSERT_EQUAL(OUString("1000"), aActual); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 9abb5ae5c051..17d398077ce0 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -945,6 +945,10 @@ DefaultNumberingProvider::makeNumberingString( const Sequencehttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source include/editeng offapi/com
i18npool/qa/cppunit/test_defaultnumberingprovider.cxx | 26 ++ i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx | 12 +++- include/editeng/svxenum.hxx |3 - offapi/com/sun/star/style/NumberingType.idl |7 ++ 4 files changed, 43 insertions(+), 5 deletions(-) New commits: commit f4dd9ecdc21696b360dedf7fefa371c8858c1830 Author: Miklos Vajna AuthorDate: Tue Mar 17 17:01:05 2020 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 17 17:59:14 2020 +0100 sw pad-to-3 numbering: add doc model, UNO API and layout This is similar to the existing padded numbering, but that one padded to 2. Another difference is pad-to-2 has more file format support: pad-to-3 is not supported in DOC and RTF. Change-Id: Ie2ac2691c58a89e181d24d7002cf873ebab380c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90656 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx index daa464c9ac74..fee8df329520 100644 --- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx +++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx @@ -48,6 +48,32 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero) CPPUNIT_ASSERT_EQUAL(OUString("10"), aActual); } +CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero3) +{ +// 10 -> "010" +uno::Reference xFormatter( +text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY); +uno::Sequence aProperties = { +comphelper::makePropertyValue("NumberingType", + static_cast(style::NumberingType::ARABIC_ZERO3)), +comphelper::makePropertyValue("Value", static_cast(10)), +}; +lang::Locale aLocale; +OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale); +// Without the accompanying fix in place, this test would have failed with a +// lang.IllegalArgumentException, support for ARABIC_ZERO3 was missing. +CPPUNIT_ASSERT_EQUAL(OUString("010"), aActual); + +// 100 -> "100" +aProperties = { +comphelper::makePropertyValue("NumberingType", + static_cast(style::NumberingType::ARABIC_ZERO3)), +comphelper::makePropertyValue("Value", static_cast(100)), +}; +aActual = xFormatter->makeNumberingString(aProperties, aLocale); +CPPUNIT_ASSERT_EQUAL(OUString("100"), aActual); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx index 890855538881..86b64a3d23ad 100644 --- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx +++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx @@ -553,11 +553,11 @@ bool should_ignore( const OUString& s ) } /** - * Turn nNumber into a string and pad the result to 2 using zero characters. + * Turn nNumber into a string and pad the result to nLimit by inserting zero characters at the + * start. */ -static OUString lcl_formatArabicZero(sal_Int32 nNumber) +static OUString lcl_formatArabicZero(sal_Int32 nNumber, sal_Int32 nLimit) { -sal_Int32 nLimit = 2; OUString aRet = OUString::number(nNumber); sal_Int32 nDiff = nLimit - aRet.getLength(); @@ -938,7 +938,11 @@ DefaultNumberingProvider::makeNumberingString( const Sequencehttps://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_textsearch.cxx |5 ++--- i18npool/source/search/textsearch.cxx |8 i18npool/source/search/textsearch.hxx |3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) New commits: commit 78023f61db40028cb30a25ce540aca9a76362660 Author: Eike Rathke AuthorDate: Thu Jun 27 19:19:10 2019 +0200 Commit: Eike Rathke CommitDate: Thu Jun 27 22:19:08 2019 +0200 Ditch "using namespace U_ICU_NAMESPACE;", qualify icu:: instead Specifically no "using ..." in a header file. For the 5 places that actually need it.. Change-Id: I5a9d4efa3b19df51a05e7de0b4a825876290579c Reviewed-on: https://gerrit.libreoffice.org/74814 Reviewed-by: Eike Rathke Tested-by: Jenkins diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 6d08e662ae31..b2175b21bfa5 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -27,7 +27,6 @@ #include using namespace ::com::sun::star; -using namespace U_ICU_NAMESPACE; typedef U_ICU_NAMESPACE::UnicodeString IcuUniString; class TestTextSearch : public test::BootstrapFixtureBase @@ -60,7 +59,7 @@ void TestTextSearch::testICU() OUString aPattern( "e" ); IcuUniString aSearchPat( reinterpret_cast(aPattern.getStr()), aPattern.getLength() ); -std::unique_ptr pRegexMatcher(new RegexMatcher( aSearchPat, nSearchFlags, nErr )); +std::unique_ptr pRegexMatcher(new icu::RegexMatcher( aSearchPat, nSearchFlags, nErr )); IcuUniString aSource( reinterpret_cast(aString.getStr()), aString.getLength() ); pRegexMatcher->reset( aSource ); @@ -76,7 +75,7 @@ void TestTextSearch::testICU() OUString aPattern2( "a" ); IcuUniString aSearchPat2( reinterpret_cast(aPattern2.getStr()), aPattern2.getLength() ); -pRegexMatcher.reset(new RegexMatcher( aSearchPat2, nSearchFlags, nErr )); +pRegexMatcher.reset(new icu::RegexMatcher( aSearchPat2, nSearchFlags, nErr )); IcuUniString aSource2( reinterpret_cast(aString2.getStr()), aString2.getLength() ); pRegexMatcher->reset( aSource2 ); diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 13990e55827f..09841d207dd8 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -838,19 +838,19 @@ void TextSearch::RESrchPrepare( const css::util::SearchOptions2& rOptions) // - by replacing \< with "word-break followed by a look-ahead word-char" static const IcuUniString aChevronPatternB( "<", -1, IcuUniString::kInvariant); static const IcuUniString aChevronReplaceB( "b(?=w)", -1, IcuUniString::kInvariant); -static RegexMatcher aChevronMatcherB( aChevronPatternB, 0, nIcuErr); +static icu::RegexMatcher aChevronMatcherB( aChevronPatternB, 0, nIcuErr); aChevronMatcherB.reset( aIcuSearchPatStr); aIcuSearchPatStr = aChevronMatcherB.replaceAll( aChevronReplaceB, nIcuErr); aChevronMatcherB.reset(); // - by replacing \> with "look-behind word-char followed by a word-break" static const IcuUniString aChevronPatternE( ">", -1, IcuUniString::kInvariant); static const IcuUniString aChevronReplaceE( "(?<=w)b", -1, IcuUniString::kInvariant); -static RegexMatcher aChevronMatcherE( aChevronPatternE, 0, nIcuErr); +static icu::RegexMatcher aChevronMatcherE( aChevronPatternE, 0, nIcuErr); aChevronMatcherE.reset( aIcuSearchPatStr); aIcuSearchPatStr = aChevronMatcherE.replaceAll( aChevronReplaceE, nIcuErr); aChevronMatcherE.reset(); #endif -pRegexMatcher.reset( new RegexMatcher( aIcuSearchPatStr, nIcuSearchFlags, nIcuErr) ); +pRegexMatcher.reset( new icu::RegexMatcher( aIcuSearchPatStr, nIcuSearchFlags, nIcuErr) ); if (nIcuErr) { SAL_INFO( "i18npool", "TextSearch::RESrchPrepare UErrorCode " << nIcuErr); @@ -878,7 +878,7 @@ void TextSearch::RESrchPrepare( const css::util::SearchOptions2& rOptions) } -static bool lcl_findRegex( std::unique_ptr const & pRegexMatcher, sal_Int32 nStartPos, UErrorCode & rIcuErr ) +static bool lcl_findRegex( std::unique_ptr const & pRegexMatcher, sal_Int32 nStartPos, UErrorCode & rIcuErr ) { if (!pRegexMatcher->find( nStartPos, rIcuErr)) { diff --git a/i18npool/source/search/textsearch.hxx b/i18npool/source/search/textsearch.hxx index acc49a00ee5a..aa4c8f522f86 100644 --- a/i18npool/source/search/textsearch.hxx +++ b/i18npool/source/search/textsearch.hxx @@ -37,7 +37,6 @@ namespace com::sun::star::i18n { class XExtendedTransliteration; } namespace com::sun::star::uno { class XComponentContext; } -using namespace U_ICU_NAMESPACE; typedef U_ICU_NAMESPACE::UnicodeString IcuUniString; class WLevDistance; @@ -89,7 +88,7 @@ class TextSearch: public cppu::WeakImplHelper sal_Int32 startPos, sal_Int32 endPos ); // Members and methods for the regular
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx | 23 i18npool/source/breakiterator/breakiterator_ctl.cxx |8 +++--- i18npool/source/breakiterator/breakiterator_th.cxx |2 - 3 files changed, 28 insertions(+), 5 deletions(-) New commits: commit 5dc52ee00102cbf4262805d6e8f338bf0a88f470 Author: Khaled HosnyDate: Mon May 21 14:28:25 2018 +0200 tdf#113694 Fix BreakIterator_CTL surrogate pairs BreakIterator_CTL in the non CharacterIteratorMode::SKIPCELL mode did not handle UTF-16 surrogate pairs at all, causing backspace to delete lone surrogates which is really bad. Just copied the corresponding code from BreakIterator_Unicode. Additionally, BreakIterator_th was not correctly skipping non-Thai text and always treating one character as Thai. Change-Id: Ia379327e042ff602fc19a485c4cbd1a3683f9230 Reviewed-on: https://gerrit.libreoffice.org/54631 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 552274864035..0c132acf3a43 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -919,6 +919,29 @@ void TestBreakIterator::testThai() } while (nPos > 0); } + +// tdf#113694 +{ +const sal_Unicode NON_BMP[] = { 0xD800, 0xDC00 }; +OUString aTest(NON_BMP, SAL_N_ELEMENTS(NON_BMP)); + +sal_Int32 nDone=0; +sal_Int32 nPos; + +nPos = m_xBreak->nextCharacters(aTest, 0, aLocale, +i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full surrogate pair", static_cast(SAL_N_ELEMENTS(NON_BMP)), nPos); +nPos = m_xBreak->previousCharacters(aTest, SAL_N_ELEMENTS(NON_BMP), aLocale, +i18n::CharacterIteratorMode::SKIPCELL, 1, nDone); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full surrogate pair", static_cast(0), nPos); + +nPos = m_xBreak->nextCharacters(aTest, 0, aLocale, +i18n::CharacterIteratorMode::SKIPCHARACTER, 1, nDone); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full surrogate pair", static_cast(SAL_N_ELEMENTS(NON_BMP)), nPos); +nPos = m_xBreak->previousCharacters(aTest, SAL_N_ELEMENTS(NON_BMP), aLocale, +i18n::CharacterIteratorMode::SKIPCHARACTER, 1, nDone); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Should skip full surrogate pair", static_cast(0), nPos); +} } #ifdef TODO diff --git a/i18npool/source/breakiterator/breakiterator_ctl.cxx b/i18npool/source/breakiterator/breakiterator_ctl.cxx index b307c37fd9ac..932fb1b77182 100644 --- a/i18npool/source/breakiterator/breakiterator_ctl.cxx +++ b/i18npool/source/breakiterator/breakiterator_ctl.cxx @@ -71,8 +71,8 @@ sal_Int32 SAL_CALL BreakIterator_CTL::previousCharacters( const OUString& Text, } else nStartPos = 0; } else { // for BS to delete one char. -nDone = std::min(nStartPos, nCount); -nStartPos -= nDone; +for (nDone = 0; nDone < nCount && nStartPos > 0; nDone++) +Text.iterateCodePoints(, -1); } return nStartPos; @@ -98,8 +98,8 @@ sal_Int32 SAL_CALL BreakIterator_CTL::nextCharacters(const OUString& Text, } else nStartPos = len; } else { -nDone = std::min(len - nStartPos, nCount); -nStartPos += nDone; +for (nDone = 0; nDone < nCount && nStartPos < Text.getLength(); nDone++) +Text.iterateCodePoints(); } return nStartPos; diff --git a/i18npool/source/breakiterator/breakiterator_th.cxx b/i18npool/source/breakiterator/breakiterator_th.cxx index 36ced38daba8..49f81047247c 100644 --- a/i18npool/source/breakiterator/breakiterator_th.cxx +++ b/i18npool/source/breakiterator/breakiterator_th.cxx @@ -127,7 +127,7 @@ void BreakIterator_th::makeIndex(const OUString& Text, sal_Int32 const nStartPos sal_Int32 startPos = nStartPos; while (startPos > 0 && is_Thai(str[startPos-1])) startPos--; -sal_Int32 endPos = std::min(len, nStartPos+1); +sal_Int32 endPos = nStartPos; while (endPos < len && is_Thai(str[endPos])) endPos++; sal_Int32 start, end, pos; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx | 16 i18npool/source/breakiterator/breakiterator_cjk.cxx | 19 +++ 2 files changed, 35 insertions(+) New commits: commit 441fded7f7fc8a2564075406933226a6eea73dd1 Author: Mark HungDate: Sun Oct 1 14:53:51 2017 +0800 tdf#96197 do not break Korean words in the middle. Korean words are composed of Hangul and are separated by space or newline. This patch improves line breaking function in CJK break iterator so that it does not break Korean words in the middle. It now breaks at the first character of the last Korean word. Change-Id: I91b20733c0c5ec4755bf68eb0d7c14c42c1f3556 Reviewed-on: https://gerrit.libreoffice.org/42987 Tested-by: Jenkins Reviewed-by: Eike Rathke diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 98a0bca96a77..552274864035 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -158,6 +158,22 @@ void TestBreakIterator::testLineBreaking() (void)m_xBreak->getLineBreak(aTest, 0, aLocale, 0, aHyphOptions, aUserOptions); } } + +//See https://bugs.documentfoundation.org/show_bug.cgi?id=96197 +{ +const sal_Unicode HANGUL[] = { 0xc560, 0xad6D, 0xac00, 0xc758, 0x0020, 0xac00, + 0xc0ac, 0xb294}; +OUString aTest(HANGUL, SAL_N_ELEMENTS(HANGUL)); + +aLocale.Language = "ko"; +aLocale.Country = "KR"; + +{ +i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, aTest.getLength()-2, aLocale, 0, +aHyphOptions, aUserOptions); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break don't split the Korean word!", static_cast(5), aResult.breakIndex); +} +} } //See https://bugs.libreoffice.org/show_bug.cgi?id=49629 diff --git a/i18npool/source/breakiterator/breakiterator_cjk.cxx b/i18npool/source/breakiterator/breakiterator_cjk.cxx index 98115e6c1d32..8a4244631759 100644 --- a/i18npool/source/breakiterator/breakiterator_cjk.cxx +++ b/i18npool/source/breakiterator/breakiterator_cjk.cxx @@ -86,6 +86,8 @@ BreakIterator_CJK::getWordBoundary( const OUString& text, sal_Int32 anyPos, return BreakIterator_Unicode::getWordBoundary(text, anyPos, nLocale, wordType, bDirection); } +#define isHangul(cCh) ((cCh>=0xAC00&<=0xD7AF)||(cCh>=0x1100&<=0x11FF)) + LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( const OUString& Text, sal_Int32 nStartPos, const css::lang::Locale& /*rLocale*/, sal_Int32 /*nMinBreakPos*/, @@ -94,17 +96,34 @@ LineBreakResults SAL_CALL BreakIterator_CJK::getLineBreak( { LineBreakResults lbr; +const sal_Int32 nOldStartPos = nStartPos; + if (bOptions.allowPunctuationOutsideMargin && hangingCharacters.indexOf(Text[nStartPos]) != -1 && (Text.iterateCodePoints( ), nStartPos == Text.getLength())) { ; // do nothing } else if (bOptions.applyForbiddenRules && 0 < nStartPos && nStartPos < Text.getLength()) { + while (nStartPos > 0 && (bOptions.forbiddenBeginCharacters.indexOf(Text[nStartPos]) != -1 || bOptions.forbiddenEndCharacters.indexOf(Text[nStartPos-1]) != -1)) Text.iterateCodePoints( , -1); } +// Prevent cutting Korean words in the middle. +if ( nOldStartPos == nStartPos && isHangul( Text[nStartPos] ) ) +{ +while ( nStartPos >= 0 && isHangul( Text[nStartPos] ) ) +--nStartPos; + +// beginning of the last Korean word. +if ( nStartPos < nOldStartPos ) +++nStartPos; + +if ( nStartPos == 0 ) +nStartPos = nOldStartPos; +} + lbr.breakIndex = nStartPos; lbr.breakType = BreakType::WORDBOUNDARY; return lbr; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx |4 i18npool/source/breakiterator/breakiteratorImpl.cxx |3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) New commits: commit 55ddbfc610d2a00e565ca7bcb0277da33bb90947 Author: Khaled HosnyDate: Tue Mar 28 19:58:25 2017 +0200 tdf#106755: Fix script type for combining marks We are classifying characters in the âCombining Diacritical Marksâ Unicode block with ScriptType::LATIN, but these are combining marks and can combine with any script and should have been ScriptType::WEAK. Just removing them from the range in scriptList does the trick as we will fallback to getting the script classification based on the Unicode script property. Change-Id: I3577f4b03360a1c8e094a207f01b6bbb6abbaf30 Reviewed-on: https://gerrit.libreoffice.org/35811 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index c00c716efac2..fb1a155ae9db 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -759,6 +759,10 @@ void TestBreakIterator::testWeak() { 0x0001, 0x0002, 0x0020, 0x00A0, +0x0300, 0x036F, //Combining Diacritical Marks +0x1AB0, 0x1AFF, //Combining Diacritical Marks Extended +0x1DC0, 0x1DFF, //Combining Diacritical Marks Supplement +0x20D0, 0x20FF, //Combining Diacritical Marks for Symbols 0x2150, 0x215F, //Number Forms, fractions 0x2160, 0x2180, //Number Forms, roman numerals 0x2200, 0x22FF, //Mathematical Operators diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index a81c10733c57..879b925374e1 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -442,7 +442,8 @@ struct UBlock2Script static const UBlock2Script scriptList[] = { {UBLOCK_NO_BLOCK, UBLOCK_NO_BLOCK, ScriptType::WEAK}, -{UBLOCK_BASIC_LATIN, UBLOCK_ARMENIAN, ScriptType::LATIN}, +{UBLOCK_BASIC_LATIN, UBLOCK_SPACING_MODIFIER_LETTERS, ScriptType::LATIN}, +{UBLOCK_GREEK, UBLOCK_ARMENIAN, ScriptType::LATIN}, {UBLOCK_HEBREW, UBLOCK_MYANMAR, ScriptType::COMPLEX}, {UBLOCK_GEORGIAN, UBLOCK_GEORGIAN, ScriptType::LATIN}, {UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO, ScriptType::ASIAN}, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_textsearch.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 2a176fddc5b952f4427f9700f6630ee3d84b1f72 Author: Stephan BergmannDate: Wed Mar 1 09:15:47 2017 +0100 Blind fix for 32-bit builds Change-Id: I056fe8fb3e6b87ecae4e07f757c1a9588bbb1c06 diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 1118b5a..0f286a2 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -128,7 +128,7 @@ void TestTextSearch::testSearches() CPPUNIT_ASSERT_EQUAL( bStartRes, aRes.startOffset[0] ); CPPUNIT_ASSERT_EQUAL( bEndRes, aRes.endOffset[0] ); -aOptions.transliterateFlags = (sal_Int32) (TransliterationFlags::IGNORE_CASE +aOptions.transliterateFlags = (int) (TransliterationFlags::IGNORE_CASE | TransliterationFlags::IGNORE_WIDTH); aOptions.searchString = "([^ ]*)[ ]*([^ ]*)"; m_xSearch->setOptions(aOptions); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx | 30 +++-- 1 file changed, 20 insertions(+), 10 deletions(-) New commits: commit 7543399f7278d573f157a48016f407bde3088e15 Author: Caolán McNamaraDate: Thu Oct 6 16:39:43 2016 +0100 coverity#1373441 Side effect in assertion Change-Id: I10a8298e5379fa93a5d3616202a7802c0eda1cbb diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 1bd2b3d..c00c716 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -364,7 +364,8 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSinglePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; -CPPUNIT_ASSERT_EQUAL(aSinglePositions[i++], nPos); +CPPUNIT_ASSERT_EQUAL(aSinglePositions[i], nPos); +++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); @@ -372,7 +373,8 @@ void TestBreakIterator::testWordBoundaries() do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; -CPPUNIT_ASSERT_EQUAL(aSinglePositions[--i], nPos); +--i; +CPPUNIT_ASSERT_EQUAL(aSinglePositions[i], nPos); } while (nPos > 0); } @@ -387,7 +389,8 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSingleQuotePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; -CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i++], nPos); +CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i], nPos); +++i; } while (nPos < aTest.getLength()); nPos = aTest.getLength(); @@ -395,7 +398,8 @@ void TestBreakIterator::testWordBoundaries() do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; -CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[--i], nPos); +--i; +CPPUNIT_ASSERT_EQUAL(aSingleQuotePositions[i], nPos); } while (nPos > 0); } @@ -416,7 +420,8 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); nPos = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true).endPos; -CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); +CPPUNIT_ASSERT_EQUAL(aExpected[i], nPos); +++i; } while (nPos++ < aTest.getLength()); CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); @@ -458,7 +463,8 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); nPos = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true).endPos; -CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); +CPPUNIT_ASSERT_EQUAL(aExpected[i], nPos); +++i; } while (nPos++ < aTest.getLength()); CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); @@ -499,7 +505,8 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); nPos = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true).endPos; -CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); +CPPUNIT_ASSERT_EQUAL(aExpected[i], nPos); +++i; } while (nPos++ < aTest.getLength()); CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); @@ -522,7 +529,8 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); nPos = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::WORD_COUNT, true).endPos; -CPPUNIT_ASSERT_EQUAL(aExpected[i++], nPos); +CPPUNIT_ASSERT_EQUAL(aExpected[i], nPos); +++i; } while (nPos++ < aTest.getLength()); CPPUNIT_ASSERT_EQUAL(SAL_N_ELEMENTS(aExpected), i); @@ -538,8 +546,10 @@ void TestBreakIterator::testWordBoundaries() CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aExpected)); aBounds = m_xBreak->getWordBoundary(aTest, nPos, aLocale, i18n::WordType::DICTIONARY_WORD, true); -CPPUNIT_ASSERT_EQUAL(aExpected[i++], aBounds.startPos); -
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx | 86 +-- i18npool/qa/cppunit/test_characterclassification.cxx |6 - i18npool/qa/cppunit/test_textsearch.cxx | 74 3 files changed, 83 insertions(+), 83 deletions(-) New commits: commit 6c76ade9516ada09222a18af69eb381b2e859b24 Author: Miklos VajnaDate: Fri Sep 30 09:59:19 2016 +0200 i18npool: fix loplugin:cppunitassertequals warnings Change-Id: I2ebe54af7b769189e248b1a3af55ee1b6a66174a Reviewed-on: https://gerrit.libreoffice.org/29399 Reviewed-by: Miklos Vajna Tested-by: Jenkins diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 58b6a98..dd3e850 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -87,13 +87,13 @@ void TestBreakIterator::testLineBreaking() { //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 start of the word", aResult.breakIndex == 6); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the start of the word", static_cast(6), aResult.breakIndex); } { //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 start of the word", aResult.breakIndex == 11); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the start of the word", static_cast(11), aResult.breakIndex); } } @@ -109,7 +109,7 @@ void TestBreakIterator::testLineBreaking() { //Here we want the line break to happen at the whitespace i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, aTest.getLength()-1, aLocale, 0, aHyphOptions, aUserOptions); -CPPUNIT_ASSERT_MESSAGE("Expected a break at the start of the word", aResult.breakIndex == aWord.getLength()+1); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the start of the word", aWord.getLength()+1, aResult.breakIndex); } } @@ -124,7 +124,7 @@ void TestBreakIterator::testLineBreaking() //Here we want the line break to leave /bar/ba clumped together on the next line i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, strlen("foo /bar/ba"), aLocale, 0, aHyphOptions, aUserOptions); -CPPUNIT_ASSERT_MESSAGE("Expected a break at the first slash", aResult.breakIndex == 4); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the first slash", static_cast(4), aResult.breakIndex); } } @@ -139,7 +139,7 @@ void TestBreakIterator::testLineBreaking() //Here we want the line break to move the whole lot to the next line i18n::LineBreakResults aResult = m_xBreak->getLineBreak(aTest, aTest.getLength()-2, aLocale, 0, aHyphOptions, aUserOptions); -CPPUNIT_ASSERT_MESSAGE("Expected a break at the start of the line, not at ]", aResult.breakIndex == 0); +CPPUNIT_ASSERT_EQUAL_MESSAGE("Expected a break at the start of the line, not at ]", static_cast(0), aResult.breakIndex); } } @@ -339,7 +339,7 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aDoublePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; -CPPUNIT_ASSERT(nPos == aDoublePositions[i++]); +CPPUNIT_ASSERT_EQUAL(aDoublePositions[i++], nPos); } while (nPos < aTest.getLength()); nPos = aTest.getLength(); @@ -347,7 +347,7 @@ void TestBreakIterator::testWordBoundaries() do { nPos = m_xBreak->previousWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; -CPPUNIT_ASSERT(nPos == aDoublePositions[--i]); +CPPUNIT_ASSERT_EQUAL(aDoublePositions[--i], nPos); } while (nPos > 0); } @@ -362,7 +362,7 @@ void TestBreakIterator::testWordBoundaries() { CPPUNIT_ASSERT(i < SAL_N_ELEMENTS(aSinglePositions)); nPos = m_xBreak->nextWord(aTest, nPos, aLocale, i18n::WordType::ANYWORD_IGNOREWHITESPACES).startPos; -CPPUNIT_ASSERT(nPos == aSinglePositions[i++]); +CPPUNIT_ASSERT_EQUAL(aSinglePositions[i++], nPos); } while
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx | 16 i18npool/source/breakiterator/breakiterator_unicode.cxx |2 +- 2 files changed, 17 insertions(+), 1 deletion(-) New commits: commit 5e46e382694587e88ecdebc7fa57e90fbaca7a76 Author: Caolán McNamaraDate: Fri Jul 22 12:59:13 2016 +0100 crashtesting: fix tdf92993-1.docx failure Change-Id: I76f09a09fd6c3b114ba74737d4a1ba5dad0fd28f diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 29fc489..1c8b1f9 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -142,6 +142,22 @@ void TestBreakIterator::testLineBreaking() CPPUNIT_ASSERT_MESSAGE("Expected a break at the start of the line, not at ]", aResult.breakIndex == 0); } } + +//this is an example sequence from tdf92993-1.docx caught by the load crashtesting +{ +const sal_Unicode WEIRD1[] = { 0xd83c, 0xdf56, 0xd83c, 0xdf57, 0xd83c, 0xdf46, + 0xd83c, 0xdf64, 0x2668, 0xfe0f, 0xd83c, 0xdfc6}; + +OUString aTest(WEIRD1, SAL_N_ELEMENTS(WEIRD1)); + +aLocale.Language = "en"; +aLocale.Country = "US"; + +{ +//This must not assert/crash +(void)m_xBreak->getLineBreak(aTest, 0, aLocale, 0, aHyphOptions, aUserOptions); +} +} } //See https://bugs.libreoffice.org/show_bug.cgi?id=49629 diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 8707dd45..117b0ba 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -423,7 +423,7 @@ LineBreakResults SAL_CALL BreakIterator_Unicode::getLineBreak( GlueSpace=false; if (lbr.breakType == BreakType::WORDBOUNDARY) { nStartPos = lbr.breakIndex; -if (Text[nStartPos--] == WJ) +if (nStartPos >= 0 && Text[nStartPos--] == WJ) GlueSpace=true; while (nStartPos >= 0 && (u_isWhitespace(Text.iterateCodePoints(, 0)) || Text[nStartPos] == WJ)) { ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source include/unotools offapi/com sc/inc sc/source unotools/source
i18npool/qa/cppunit/test_textsearch.cxx |3 +++ i18npool/source/search/textsearch.cxx |7 --- include/unotools/textsearch.hxx | 11 ++- offapi/com/sun/star/util/SearchFlags.idl| 14 ++ offapi/com/sun/star/util/SearchOptions2.idl | 14 ++ sc/inc/queryentry.hxx |3 ++- sc/source/core/data/dpcache.cxx |2 +- sc/source/core/data/table3.cxx |4 ++-- sc/source/core/tool/compare.cxx |5 ++--- sc/source/core/tool/interpr1.cxx|2 +- sc/source/core/tool/queryentry.cxx |5 +++-- unotools/source/i18n/textsearch.cxx | 18 +++--- 12 files changed, 71 insertions(+), 17 deletions(-) New commits: commit 1f3357013ba1f319a3bcddf4c9a658c46e8c0390 Author: Eike RathkeDate: Tue Feb 23 23:18:47 2016 +0100 SearchFlags::WILD_MATCH_SELECTION, SearchOptions2::WildcardEscapeCharacter At least '\' (search in Word) and '~' (search in Excel) should be supported as escape character. Being able to restrict a match to entire selection instead of substring speeds up the Calc match whole cell scenario. Change-Id: Ice242b9cd59009f172b724e03c2cc08feda4cd3c diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 1cb14f6..893bed5 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -145,6 +145,9 @@ void TestTextSearch::testWildcardSearch() util::SearchResult aRes; aOptions.AlgorithmType2 = util::SearchAlgorithms2::WILDCARD ; +aOptions.WildcardEscapeCharacter = '~'; +// aOptions.searchFlag = ::css::util::SearchFlags::WILD_MATCH_SELECTION; +// is not set, so substring match is allowed. aOptions.transliterateFlags = ::css::i18n::TransliterationModules::TransliterationModules_IGNORE_CASE; aText = "abAca"; diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 9d2..dab32d1 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -113,8 +113,6 @@ TextSearch::TextSearch(const Reference < XComponentContext > & rxContext) , pJumpTable2( nullptr ) , pRegexMatcher( nullptr ) , pWLD( nullptr ) -, mcWildcardEscapeChar('~') /* TODO: make this option available through API */ -, mbWildcardAllowSubstring(true)/* TODO: make this option available through API */ { SearchOptions2 aOpt; aOpt.AlgorithmType2 = SearchAlgorithms2::ABSOLUTE; @@ -245,6 +243,8 @@ void TextSearch::setOptions2( const SearchOptions2& rOptions ) throw( RuntimeExc break; case SearchAlgorithms2::WILDCARD: +mcWildcardEscapeChar = static_cast(aSrchPara.WildcardEscapeCharacter); +mbWildcardAllowSubstring = ((aSrchPara.searchFlag & SearchFlags::WILD_MATCH_SELECTION) == 0); fnForward = ::WildcardSrchFrwrd; fnBackward = ::WildcardSrchBkwrd; break; @@ -289,7 +289,8 @@ void TextSearch::setOptions( const SearchOptions& rOptions ) throw( RuntimeExcep rOptions.deletedChars, rOptions.insertedChars, rOptions.transliterateFlags, -nAlgorithmType2 +nAlgorithmType2, +0 // no wildcard search, no escape character.. ); setOptions2( aOptions2); } diff --git a/include/unotools/textsearch.hxx b/include/unotools/textsearch.hxx index 1847aab..3a24aac 100644 --- a/include/unotools/textsearch.hxx +++ b/include/unotools/textsearch.hxx @@ -96,9 +96,12 @@ private: SearchType m_eSrchType; // search normal/regular/LevDist +sal_uInt32 m_cWildEscChar; // wildcard escape character + bool m_bWordOnly : 1;// used by normal search bool m_bSrchInSel : 1;// search only in the selection bool m_bCaseSense : 1; +bool m_bWildMatchSel : 1; // wildcard pattern must match entire selection // values for the "weight Levenshtein-Distance" bool bLEV_Relaxed : 1; @@ -114,7 +117,9 @@ public: SearchType eSrchType = SearchParam::SRCH_NORMAL, bool bCaseSensitive = true, bool bWordOnly = false, -bool bSearchInSelection = false ); +bool bSearchInSelection = false, +sal_uInt32 cWildEscChar = '\\', +bool bWildMatchSel = false ); SearchParam( const SearchParam& ); @@ -127,6 +132,10 @@ public: boolIsCaseSensitive() const { return m_bCaseSense; } boolIsSrchInSelection() const { return m_bSrchInSel; } boolIsSrchWordOnly() const { return m_bWordOnly; } +boolIsWildMatchSel() const { return m_bWildMatchSel; } + +//
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_textsearch.cxx | 11 +++ i18npool/source/search/textsearch.cxx |9 ++--- 2 files changed, 17 insertions(+), 3 deletions(-) New commits: commit 4cf1d290bab29e18e1312b63ff862f5102e00387 Author: Mike KaganskiDate: Sun Nov 8 22:23:44 2015 +1000 tdf#94810: fix reverse offset mapping With simple transliteration, TextSearch::searchForward used to use whole string to perform the search, then started to create substring to search. But it left the precautions from commit c00601dab0f5533b152cd63cec0a89bfec1ba95f by Eike Rathke: searching for $ may actually return a result set pointing behind the search string which it does with the ICU regex engine. The precaution made it to skip reverse mapping if index was 0. Commit 9aae521b451269007f03527c83645b8b935eb419 by Michael Stahl didn't consider the case when nStop is 0, and startPos > 0. Then it tried to get offset[-1]. Anyway, using value of startPos in those conditions seems illogical. Removed those precautions (and made assertions for that). Fixed handling zero indexes. Change-Id: I2066abc51fff7fb7323bc7f6198bdea06439d4f3 Reviewed-on: https://gerrit.libreoffice.org/19840 Tested-by: Jenkins Reviewed-by: Eike Rathke Tested-by: Eike Rathke diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index a5713d0..50bab9a 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -122,6 +123,16 @@ void TestTextSearch::testSearches() CPPUNIT_ASSERT( aRes.subRegExpressions > 0 ); CPPUNIT_ASSERT( aRes.startOffset[0] == bStartRes ); CPPUNIT_ASSERT( aRes.endOffset[0] == bEndRes ); + +aOptions.transliterateFlags = ::css::i18n::TransliterationModules::TransliterationModules_IGNORE_CASE +| ::css::i18n::TransliterationModules::TransliterationModules_IGNORE_WIDTH; +aOptions.searchString = "([^ ]*)[ ]*([^ ]*)"; +m_xSearch->setOptions(aOptions); +aRes = m_xSearch->searchForward("11 22 33", 2, 7); +CPPUNIT_ASSERT(aRes.subRegExpressions == 3); +CPPUNIT_ASSERT((aRes.startOffset[0] == 2) && (aRes.endOffset[0] == 5)); +CPPUNIT_ASSERT((aRes.startOffset[1] == 2) && (aRes.endOffset[1] == 2)); +CPPUNIT_ASSERT((aRes.startOffset[2] == 3) && (aRes.endOffset[2] == 5)); } void TestTextSearch::setUp() diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index e480437..fa4cdba 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -301,15 +301,18 @@ SearchResult TextSearch::searchForward( const OUString& searchStr, sal_Int32 sta for ( sal_Int32 k = 0; k < nGroups; k++ ) { const sal_Int32 nStart = sres.startOffset[k] - nExtraOffset; -if (startPos > 0 || nStart > 0) -sres.startOffset[k] = (nStart < nOffsets ? offset[nStart] : (offset[nOffsets - 1] + 1)); +assert(nStart >= 0); // if not (e.g. searching for $ with ICU regex engine), then what? +sres.startOffset[k] = (nStart < nOffsets ? offset[nStart] : (offset[nOffsets - 1] + 1)); // JP 20.6.2001: end is ever exclusive and then don't return // the position of the next character - return the // next position behind the last found character! // "a b c" find "b" must return 2,3 and not 2,4!!! const sal_Int32 nStop = sres.endOffset[k] - nExtraOffset; -if (startPos > 0 || nStop > 0) +assert(nStop >= 0); +if (nStop > 0) sres.endOffset[k] = offset[(nStop <= nOffsets ? nStop : nOffsets) - 1] + 1; +else +sres.endOffset[k] = offset[0]; } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source io/source io/test lingucomponent/source linguistic/source lotuswordpro/qa oox/source
i18npool/qa/cppunit/test_breakiterator.cxx |3 +-- i18npool/qa/cppunit/test_characterclassification.cxx |3 +-- i18npool/qa/cppunit/test_ordinalsuffix.cxx |3 +-- i18npool/qa/cppunit/test_textsearch.cxx |3 +-- i18npool/source/localedata/saxparser.cxx |2 +- io/source/acceptor/acceptor.cxx |3 +-- io/source/connector/connector.cxx|4 ++-- io/source/stm/odata.cxx |2 +- io/test/stm/datatest.cxx | 16 io/test/stm/pumptest.cxx |6 +++--- io/test/testcomponent.cxx|2 +- io/test/testconnection.cxx |2 +- lingucomponent/source/thesaurus/libnth/nthesimp.cxx |2 +- linguistic/source/gciterator.cxx |2 +- linguistic/source/hyphdsp.cxx|7 +++ linguistic/source/lngsvcmgr.cxx | 17 - linguistic/source/spelldsp.cxx |6 ++ linguistic/source/thesdsp.cxx|3 +-- lotuswordpro/qa/cppunit/test_lotuswordpro.cxx|2 +- oox/source/drawingml/chart/converterbase.cxx |2 +- oox/source/drawingml/shape.cxx |4 ++-- oox/source/ppt/slidepersist.cxx |2 +- 22 files changed, 43 insertions(+), 53 deletions(-) New commits: commit fcb8df3bcf551fc3437e6c7c8ddb24dc5a09db02 Author: Noel GrandinDate: Wed Nov 4 14:16:19 2015 +0200 use uno::Reference::set method instead of assignment Change-Id: I11822c50fa66d038a3d6f38054ab35c2e613f077 diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index a1f63d5..29fc489 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -980,8 +980,7 @@ void TestBreakIterator::testChinese() void TestBreakIterator::setUp() { BootstrapFixtureBase::setUp(); -m_xBreak = uno::Reference< i18n::XBreakIterator >(m_xSFactory->createInstance( -"com.sun.star.i18n.BreakIterator"), uno::UNO_QUERY_THROW); + m_xBreak.set(m_xSFactory->createInstance("com.sun.star.i18n.BreakIterator"), uno::UNO_QUERY_THROW); } void TestBreakIterator::tearDown() diff --git a/i18npool/qa/cppunit/test_characterclassification.cxx b/i18npool/qa/cppunit/test_characterclassification.cxx index 9c2b452..16cf087 100644 --- a/i18npool/qa/cppunit/test_characterclassification.cxx +++ b/i18npool/qa/cppunit/test_characterclassification.cxx @@ -96,8 +96,7 @@ void TestCharacterClassification::testStringType() void TestCharacterClassification::setUp() { BootstrapFixtureBase::setUp(); -m_xCC = uno::Reference< i18n::XCharacterClassification >(m_xSFactory->createInstance( -"com.sun.star.i18n.CharacterClassification"), uno::UNO_QUERY_THROW); + m_xCC.set(m_xSFactory->createInstance("com.sun.star.i18n.CharacterClassification"), uno::UNO_QUERY_THROW); } void TestCharacterClassification::tearDown() diff --git a/i18npool/qa/cppunit/test_ordinalsuffix.cxx b/i18npool/qa/cppunit/test_ordinalsuffix.cxx index f09f8ec..fb06a41 100644 --- a/i18npool/qa/cppunit/test_ordinalsuffix.cxx +++ b/i18npool/qa/cppunit/test_ordinalsuffix.cxx @@ -34,8 +34,7 @@ public: void TestOrdinalSuffix::setUp() { BootstrapFixtureBase::setUp(); -m_xOrdinal = uno::Reference< i18n::XOrdinalSuffix >(m_xSFactory->createInstance( -"com.sun.star.i18n.OrdinalSuffix"), uno::UNO_QUERY_THROW); + m_xOrdinal.set(m_xSFactory->createInstance("com.sun.star.i18n.OrdinalSuffix"), uno::UNO_QUERY_THROW); } void TestOrdinalSuffix::tearDown() diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index 405a853..a5713d0 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -127,8 +127,7 @@ void TestTextSearch::testSearches() void TestTextSearch::setUp() { BootstrapFixtureBase::setUp(); -m_xSearch = uno::Reference< util::XTextSearch >(m_xSFactory->createInstance( -"com.sun.star.util.TextSearch"), uno::UNO_QUERY_THROW); +m_xSearch.set(m_xSFactory->createInstance("com.sun.star.util.TextSearch"), uno::UNO_QUERY_THROW); } void TestTextSearch::tearDown() diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx index beb184e..695a36b 100644 --- a/i18npool/source/localedata/saxparser.cxx +++ b/i18npool/source/localedata/saxparser.cxx @@ -143,7 +143,7 @@ Reference< XInputStream > createStreamFromFile( Sequence seqIn(nLength); if (fread( seqIn.getArray(), nLength , 1 , f ) == 1) -r = Reference< XInputStream > ( new OInputStream( seqIn ) ); +r.set( new OInputStream( seqIn ) ); else fprintf(stderr, "failure
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx | 13 ++--- i18npool/source/breakiterator/breakiterator_unicode.cxx |4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) New commits: commit 10199478b841a87e6436996bde221e424d1df708 Author: Nathan WellsDate: Thu Sep 3 12:21:05 2015 +0100 Related: tdf#52020 Disable ICU Breakiterator for Khmer Enabling the ICU Breakiterator causes Khmer spelling checkers to be worthless as well as wrecks havoc on various minority languages that use the Khmer script. See this https://bugs.documentfoundation.org/show_bug.cgi?id=52020 this: https://bugs.freedesktop.org/show_bug.cgi?id=59448 and this: https://bugs.documentfoundation.org/show_bug.cgi?id=59447_from=fdo Change-Id: I84529db9cca72ffe1108d2e12c1885f63a48f89d diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 22aa0d7..693d19c 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -40,11 +40,11 @@ public: void testThai(); #if (U_ICU_VERSION_MAJOR_NUM > 51) void testLao(); -#endif #ifdef TODO void testNorthernThai(); -#endif void testKhmer(); +#endif +#endif void testJapanese(); void testChinese(); @@ -57,12 +57,10 @@ public: CPPUNIT_TEST(testThai); #if (U_ICU_VERSION_MAJOR_NUM > 51) CPPUNIT_TEST(testLao); -#endif #ifdef TODO +CPPUNIT_TEST(testKhmer); CPPUNIT_TEST(testNorthernThai); #endif -#if (U_ICU_VERSION_MAJOR_NUM > 4) -CPPUNIT_TEST(testKhmer); #endif CPPUNIT_TEST(testJapanese); CPPUNIT_TEST(testChinese); @@ -889,12 +887,13 @@ void TestBreakIterator::testNorthernThai() CPPUNIT_ASSERT_MESSAGE("Should skip full word", aBounds.startPos == 0 && aBounds.endPos == aTest.getLength()); } -#endif -#if (U_ICU_VERSION_MAJOR_NUM > 4) // Not sure if any version earlier than 49 did have Khmer word boundary // dictionaries, 4.6 does not. +// As of icu 54, word boundary detection for Khmer is still considered +// insufficient, so icu khmer stuff is disabled + //A test to ensure that our khmer word boundary detection is useful //https://bugs.libreoffice.org/show_bug.cgi?id=52020 void TestBreakIterator::testKhmer() diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 53c1916..0f7512b 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -123,8 +123,8 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: rbi = new OOoRuleBasedBreakIterator(udata_open("OpenOffice", "brk", OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), ), status); } -//use icu's breakiterator for Thai, Khmer, Tibetan and Dzongkha -else if (rLocale.Language != "th" && rLocale.Language != "lo" && rLocale.Language != "km" && rLocale.Language != "bo" && rLocale.Language != "dz") +//use icu's breakiterator for Thai, Tibetan and Dzongkha +else if (rLocale.Language != "th" && rLocale.Language != "lo" && rLocale.Language != "bo" && rLocale.Language != "dz") { status = U_ZERO_ERROR; OStringBuffer aUDName(64); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) New commits: commit 70b598ac14bf5b8e9af4188dbccef332a40a6562 Author: Stephan Bergmann sberg...@redhat.com Date: Fri May 29 12:14:03 2015 +0200 Bring test function lists in sync Change-Id: Ic91ddc695e9f3c7d8ba4d2bb67c8c84de2a22d5c diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 166717f..e0a797b 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -48,26 +48,27 @@ public: void testKhmer(); void testJapanese(); void testChinese(); + CPPUNIT_TEST_SUITE(TestBreakIterator); CPPUNIT_TEST(testLineBreaking); +CPPUNIT_TEST(testWordBoundaries); CPPUNIT_TEST(testGraphemeIteration); CPPUNIT_TEST(testWeak); CPPUNIT_TEST(testAsian); CPPUNIT_TEST(testThai); +#if (U_ICU_VERSION_MAJOR_NUM 51) +CPPUNIT_TEST(testLao); +#endif #ifdef TODO CPPUNIT_TEST(testNorthernThai); #endif - -CPPUNIT_TEST(testWordBoundaries); #if (U_ICU_VERSION_MAJOR_NUM 4) CPPUNIT_TEST(testKhmer); #endif -#if (U_ICU_VERSION_MAJOR_NUM 51) -CPPUNIT_TEST(testLao); -#endif CPPUNIT_TEST(testJapanese); CPPUNIT_TEST(testChinese); CPPUNIT_TEST_SUITE_END(); + private: uno::Referencei18n::XBreakIterator m_xBreak; void doTestJapanese(uno::Reference i18n::XBreakIterator xBreak); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx | 16 1 file changed, 8 insertions(+), 8 deletions(-) New commits: commit 8c8ba8df11eafa7ddb6e65b3c4f11faafb7b6403 Author: Stephan Bergmann sberg...@redhat.com Date: Fri May 29 12:09:20 2015 +0200 Fix execution of testLao ...which had already been conditional on U_ICU_VERSION_MAJOR_NUM 51, so 452a06b70578eb83067c6c744cd97eebafc4003c Activate unit test for Lao breakiterator support should merely have extended that #if to the function declaration/definition in response to loplugin:unreffun, not unconditionally enabled it. Change-Id: Ia1ce4e99b4a960b1e70cae0a61b0d526b0353d9a diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 6e758f6..166717f 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -39,7 +39,9 @@ public: void testWeak(); void testAsian(); void testThai(); +#if (U_ICU_VERSION_MAJOR_NUM 51) void testLao(); +#endif #ifdef TODO void testNorthernThai(); #endif @@ -52,7 +54,6 @@ public: CPPUNIT_TEST(testWeak); CPPUNIT_TEST(testAsian); CPPUNIT_TEST(testThai); -CPPUNIT_TEST(testLao); #ifdef TODO CPPUNIT_TEST(testNorthernThai); #endif @@ -797,6 +798,7 @@ void TestBreakIterator::testAsian() } } +#if (U_ICU_VERSION_MAJOR_NUM 51) //A test to ensure that our Lao word boundary detection is useful void TestBreakIterator::testLao() { @@ -809,18 +811,16 @@ void TestBreakIterator::testLao() i18n::Boundary aBounds = m_xBreak-getWordBoundary(aTest, 0, aLocale, i18n::WordType::DICTIONARY_WORD, true); -CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(0), aBounds.startPos); -//TODO: Expected: 5 | Actual : 12 -//CPPUNIT_ASSERT_EQUAL(5, aBounds.endPos); +CPPUNIT_ASSERT_EQUAL(sal_Int32(0), aBounds.startPos); +CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.endPos); aBounds = m_xBreak-getWordBoundary(aTest, aBounds.endPos, aLocale, i18n::WordType::DICTIONARY_WORD, true); -//TODO: Expected: 5 | Actual : 12 -//CPPUNIT_ASSERT_EQUAL(5, aBounds.startPos); -//TODO: Expected: 9 | Actual : 12 -//CPPUNIT_ASSERT_EQUAL(9, aBounds.endPos); +CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aBounds.startPos); +CPPUNIT_ASSERT_EQUAL(sal_Int32(9), aBounds.endPos); } +#endif //A test to ensure that our thai word boundary detection is useful void TestBreakIterator::testThai() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) New commits: commit 452a06b70578eb83067c6c744cd97eebafc4003c Author: David Ostrovsky da...@ostrovsky.org Date: Thu May 28 13:49:27 2015 +0200 Activate unit test for Lao breakiterator support In f24fa8efad247bdc296e4724b914f73f01ef2d0b added unit test wasn't activated. Activating it now reveals that the test is failing. Add TODOs for the failing asserts. Change-Id: I6c9f36be3aa84a5d5092d2a3f576af39a15b935e diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index be4dd6d..a2820d2 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -52,6 +52,7 @@ public: CPPUNIT_TEST(testWeak); CPPUNIT_TEST(testAsian); CPPUNIT_TEST(testThai); +CPPUNIT_TEST(testLao); #ifdef TODO CPPUNIT_TEST(testNorthernThai); #endif @@ -808,13 +809,17 @@ void TestBreakIterator::testLao() i18n::Boundary aBounds = m_xBreak-getWordBoundary(aTest, 0, aLocale, i18n::WordType::DICTIONARY_WORD, true); -CPPUNIT_ASSERT(aBounds.startPos == 0 aBounds.endPos == 5); +CPPUNIT_ASSERT_EQUAL(0, aBounds.startPos); +//TODO: Expected: 5 | Actual : 12 +//CPPUNIT_ASSERT_EQUAL(5, aBounds.endPos); aBounds = m_xBreak-getWordBoundary(aTest, aBounds.endPos, aLocale, i18n::WordType::DICTIONARY_WORD, true); -CPPUNIT_ASSERT(aBounds.startPos == 5 aBounds.endPos == 9); - +//TODO: Expected: 5 | Actual : 12 +//CPPUNIT_ASSERT_EQUAL(5, aBounds.startPos); +//TODO: Expected: 9 | Actual : 12 +//CPPUNIT_ASSERT_EQUAL(9, aBounds.endPos); } //A test to ensure that our thai word boundary detection is useful ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 788b778d168f5de13479eb9a83369810a06232fb Author: Caolán McNamara caol...@redhat.com Date: Thu May 28 13:02:18 2015 +0100 sal_Int32 as long strikes again Change-Id: I26abf6d0e102712f76977e0763c4a672434a1325 diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index a2820d2..6e758f6 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -809,7 +809,7 @@ void TestBreakIterator::testLao() i18n::Boundary aBounds = m_xBreak-getWordBoundary(aTest, 0, aLocale, i18n::WordType::DICTIONARY_WORD, true); -CPPUNIT_ASSERT_EQUAL(0, aBounds.startPos); +CPPUNIT_ASSERT_EQUAL(static_castsal_Int32(0), aBounds.startPos); //TODO: Expected: 5 | Actual : 12 //CPPUNIT_ASSERT_EQUAL(5, aBounds.endPos); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx| 19 ++- i18npool/source/breakiterator/xdictionary.cxx |6 -- 2 files changed, 22 insertions(+), 3 deletions(-) New commits: commit d8fd15875901d584a4bbcc07c927fa20332e4841 Author: Rohit Deshmukh rohit.deshm...@synerzip.com Date: Fri Dec 6 15:42:53 2013 +0530 fdo#72219: Fix for corruption of symbols in docx Issue: OUString uses UTF-16, so for a Unicode surrogate character there are 2 values stored, not just 1. So we are getting assert failure in rtl_uString_iterateCodePoints method. erAck: Underlying cause was that the dictionary breakiterator misused UTF-16 positions as Unicode code point positions. Change-Id: I923485f56c2d879b63687adaea2b489a3479991c Reviewed-on: https://gerrit.libreoffice.org/6955 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 15ce8a1..2c595cf 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -45,7 +45,7 @@ public: #endif void testKhmer(); void testJapanese(); - +void testChinese(); CPPUNIT_TEST_SUITE(TestBreakIterator); CPPUNIT_TEST(testLineBreaking); CPPUNIT_TEST(testGraphemeIteration); @@ -64,6 +64,7 @@ public: CPPUNIT_TEST(testLao); #endif CPPUNIT_TEST(testJapanese); +CPPUNIT_TEST(testChinese); CPPUNIT_TEST_SUITE_END(); private: uno::Referencei18n::XBreakIterator m_xBreak; @@ -938,6 +939,22 @@ void TestBreakIterator::testJapanese() } } +void TestBreakIterator::testChinese() +{ +lang::Locale aLocale; +aLocale.Language = zh; +aLocale.Country = CN; +i18n::Boundary aBounds; + +{ +const sal_Unicode CHINESE[] = { 0x6A35, 0x6A30, 0x69FE, 0x8919, 0xD867, 0xDEDB }; + +OUString aTest(CHINESE, SAL_N_ELEMENTS(CHINESE)); +aBounds = m_xBreak-getWordBoundary(aTest, 4, aLocale, +i18n::WordType::DICTIONARY_WORD, true); +CPPUNIT_ASSERT(aBounds.startPos == 4 aBounds.endPos == 6); +} +} void TestBreakIterator::setUp() { BootstrapFixtureBase::setUp(); diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index 1200535..ab2dfd9 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -387,9 +387,11 @@ Boundary xdictionary::getWordBoundary(const OUString rText, sal_Int32 anyPos, s if (u_isWhitespace(ch)) i--; } + boundary.endPos = boundary.startPos; -rText.iterateCodePoints(boundary.endPos, aCache.wordboundary[i]); -rText.iterateCodePoints(boundary.startPos, aCache.wordboundary[i-1]); +boundary.endPos += aCache.wordboundary[i]; +boundary.startPos += aCache.wordboundary[i-1]; + } else { boundary.startPos = anyPos; if (anyPos len) rText.iterateCodePoints(anyPos, 1); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 7d3999f2f2170ce836a00f1cbac6a49a4c719e5d Author: Tomofumi Yagi ya...@mknada.sakura.ne.jp Date: Fri Nov 29 02:59:08 2013 +0900 Remove UTF-8 comment. This breaks windows build with localized versions of MSVC. Change-Id: I23c46830f96ae661eced88352476e7ae61fbcc2a Reviewed-on: https://gerrit.libreoffice.org/6847 Reviewed-by: Eike Rathke er...@redhat.com Tested-by: Eike Rathke er...@redhat.com diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 631..15ce8a1 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -794,7 +794,7 @@ void TestBreakIterator::testLao() lang::Locale aLocale; aLocale.Language = lo; aLocale.Country = LA; -//àºàº´àºàºàºµàºà»àºàºàº®àº±àº + const sal_Unicode LAO[] = { 0x0e8d, 0x0eb4, 0x0e99, 0x0e94, 0x0eb5, 0x0e95, 0x0ec9, 0x0ead, 0x0e99, 0x0eae, 0x0eb1, 0x0e9a }; OUString aTest(LAO, SAL_N_ELEMENTS(LAO)); i18n::Boundary aBounds = m_xBreak-getWordBoundary(aTest, 0, aLocale, ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_breakiterator.cxx | 25 i18npool/source/breakiterator/breakiterator_unicode.cxx |2 - 2 files changed, 26 insertions(+), 1 deletion(-) New commits: commit f24fa8efad247bdc296e4724b914f73f01ef2d0b Author: Robert M Campbell robert.rcampb...@gmail.com Date: Wed Nov 13 23:15:13 2013 +0700 Add Lao breakiterator support for selecting and counting Lao words. Change-Id: I6da721dc25394dfee12e3028aefbf0546d1be984 Reviewed-on: https://gerrit.libreoffice.org/6669 Reviewed-by: Caolán McNamara caol...@redhat.com Tested-by: Caolán McNamara caol...@redhat.com diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 8d70250..a81475b 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -39,6 +39,7 @@ public: void testWeak(); void testAsian(); void testThai(); +void testLao(); #ifdef TODO void testNorthernThai(); #endif @@ -59,6 +60,9 @@ public: #if (U_ICU_VERSION_MAJOR_NUM 4) CPPUNIT_TEST(testKhmer); #endif +#if (U_ICU_VERSION_MAJOR_NUM 51) +CPPUNIT_TEST(testLao); +#endif CPPUNIT_TEST(testJapanese); CPPUNIT_TEST_SUITE_END(); private: @@ -784,6 +788,27 @@ void TestBreakIterator::testAsian() } } +//A test to ensure that our Lao word boundary detection is useful +void TestBreakIterator::testLao() +{ +lang::Locale aLocale; +aLocale.Language = OUString(lo); +aLocale.Country = OUString(LA); +//àºàº´àºàºàºµàºà»àºàºàº®àº±àº +const sal_Unicode LAO[] = { 0x0e8d, 0x0eb4, 0x0e99, 0x0e94, 0x0eb5, 0x0e95, 0x0ec9, 0x0ead, 0x0e99, 0x0eae, 0x0eb1, 0x0e9a }; +OUString aTest(LAO, SAL_N_ELEMENTS(LAO)); +i18n::Boundary aBounds = m_xBreak-getWordBoundary(aTest, 0, aLocale, +i18n::WordType::DICTIONARY_WORD, true); + +CPPUNIT_ASSERT(aBounds.startPos == 0 aBounds.endPos == 5); + +aBounds = m_xBreak-getWordBoundary(aTest, aBounds.endPos, aLocale, +i18n::WordType::DICTIONARY_WORD, true); + +CPPUNIT_ASSERT(aBounds.startPos == 5 aBounds.endPos == 9); + +} + //A test to ensure that our thai word boundary detection is useful void TestBreakIterator::testThai() { diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index f85c109..3bb2e3e 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -121,7 +121,7 @@ void SAL_CALL BreakIterator_Unicode::loadICUBreakIterator(const com::sun::star:: OUStringToOString(breakRules[breakType], RTL_TEXTENCODING_ASCII_US).getStr(), status), status); } //use icu's breakiterator for Thai, Khmer, Tibetan and Dzongkha -else if (rLocale.Language != th rLocale.Language != km rLocale.Language != bo rLocale.Language != dz) +else if (rLocale.Language != th rLocale.Language != lo rLocale.Language != km rLocale.Language != bo rLocale.Language != dz) { status = U_ZERO_ERROR; OStringBuffer aUDName(64); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa
i18npool/qa/cppunit/test_breakiterator.cxx |8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) New commits: commit 76e735b26aa834bd9fba83b60905ee870f82dac3 Author: Caolán McNamara caol...@redhat.com Date: Fri Aug 30 17:30:01 2013 +0100 enable building against RHEL-6 system icu Change-Id: I56f08d58d8d8a0e397412580451c90f9605bcb46 diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index b121f6d..6e8b288 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -233,14 +233,18 @@ void TestBreakIterator::testWordBoundaries() } //See https://bugs.freedesktop.org/show_bug.cgi?id=49629 -//Note that the breakiterator test will fail on older icu versions -//(4.2.1) for the 200B (ZWSP) Zero Width Space testcase. sal_Unicode aBreakTests[] = { ' ', 1, 2, 3, 4, 5, 6, 7, 0x91, 0x92, 0x200B, 0xE8FF, 0xF8FF }; for (int mode = i18n::WordType::ANY_WORD; mode = i18n::WordType::WORD_COUNT; ++mode) { //make sure that in all cases isBeginWord and isEndWord matches getWordBoundary for (size_t i = 0; i SAL_N_ELEMENTS(aBreakTests); ++i) { +#if (U_ICU_VERSION_MAJOR_NUM == 4) (U_ICU_VERSION_MINOR_NUM = 2) +//Note the breakiterator test is known to fail on older icu +//versions (4.2.1) for the 200B (ZWSP) Zero Width Space testcase. +if (aBreakTests[i] == 0x200B) +continue; +#endif OUString aTest(Word); aTest += OUString(aBreakTests[i]) + OUString(Word); aBounds = m_xBreak-getWordBoundary(aTest, 0, aLocale, mode, true); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: i18npool/qa i18nutil/source svx/source sw/source
i18npool/qa/cppunit/test_breakiterator.cxx |4 +++- i18nutil/source/utility/unicode.cxx|6 +++--- svx/source/dialog/charmap.cxx |5 +++-- sw/source/core/text/porlay.cxx |4 4 files changed, 13 insertions(+), 6 deletions(-) New commits: commit addc791623288fae7832c78e0c2923937251d1f7 Author: Mark Wielaard m...@klomp.org Date: Mon Jun 3 09:35:25 2013 +0200 Fix icu version checks. commit 30c303 Make charmap.cxx compile with icu = 4.4. was incomplete and had wrong version checks. After ICU 4.8 (4.8.1.1) the next version of ICU was 49 (49.1) so U_ICU_VERSION_MAJOR_NUM contains two digets (49), earlier that it was just one digit (4). The correct header to include to do version checks is unicode/uversion.h. USCRIPT_MANDAEAN is the old alias of USCRIPT_MANDAIC (same numeric value). U_JG_FARSI_YEH is only available since ICU 4.4. Note that on older icu versions (4.2.1) the 200B (ZWSP) Zero Width Space breakiterator testcase fails (others succeed). Change-Id: If73c1402239a28546077437e9382f0bd38642bad Reviewed-on: https://gerrit.libreoffice.org/4139 Reviewed-by: LuboÅ¡ LuÅák l.lu...@suse.cz Tested-by: LuboÅ¡ LuÅák l.lu...@suse.cz diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index b3ec68f..4ba6a79 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -19,7 +19,7 @@ #include com/sun/star/i18n/WordType.hpp #include unotest/bootstrapfixturebase.hxx -#include unicode/uvernum.h +#include unicode/uversion.h #include rtl/strbuf.hxx #include rtl/ustrbuf.hxx @@ -236,6 +236,8 @@ void TestBreakIterator::testWordBoundaries() } //See https://bugs.freedesktop.org/show_bug.cgi?id=49629 +//Note that the breakiterator test will fail on older icu versions +//(4.2.1) for the 200B (ZWSP) Zero Width Space testcase. sal_Unicode aBreakTests[] = { ' ', 1, 2, 3, 4, 5, 6, 7, 0x91, 0x92, 0x200B, 0xE8FF, 0xF8FF }; for (int mode = i18n::WordType::ANY_WORD; mode = i18n::WordType::WORD_COUNT; ++mode) { diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx index 2c2dd42..b46a7f6 100644 --- a/i18nutil/source/utility/unicode.cxx +++ b/i18nutil/source/utility/unicode.cxx @@ -826,6 +826,9 @@ OString SAL_CALL unicode::getExemplerLanguageForUScriptCode(UScriptCode eScript) case USCRIPT_TAI_VIET: sRet = blt; break; +case USCRIPT_MANDAEAN: /* Aliased to USCRIPT_MANDAIC in icu 4.6. */ +sRet = mic; +break; #if (U_ICU_VERSION_MAJOR_NUM 4) || (U_ICU_VERSION_MAJOR_NUM == 4 U_ICU_VERSION_MINOR_NUM = 4) case USCRIPT_NABATAEAN: //no language with an assigned code yet sRet = mis; @@ -833,9 +836,6 @@ OString SAL_CALL unicode::getExemplerLanguageForUScriptCode(UScriptCode eScript) case USCRIPT_PALMYRENE: //no language with an assigned code yet sRet = mis; break; -case USCRIPT_MANDAIC: -sRet = mic; -break; case USCRIPT_BAMUM: sRet = bax; break; diff --git a/svx/source/dialog/charmap.cxx b/svx/source/dialog/charmap.cxx index bc6c83e..907d9f8 100644 --- a/svx/source/dialog/charmap.cxx +++ b/svx/source/dialog/charmap.cxx @@ -1302,7 +1302,7 @@ void SubsetMap::InitList() case UBLOCK_DOMINO_TILES: aAllSubsets.push_back( Subset( 0x1F030, 0x1F09F, RID_SUBSETSTR_DOMINO_TILES ) ); break; -#if U_ICU_VERSION_MAJOR_NUM = 44 +#if (U_ICU_VERSION_MAJOR_NUM 4) || (U_ICU_VERSION_MAJOR_NUM == 4 U_ICU_VERSION_MINOR_NUM = 4) case UBLOCK_SAMARITAN: aAllSubsets.push_back( Subset( 0x0800, 0x083F, RID_SUBSETSTR_SAMARITAN ) ); break; @@ -1382,7 +1382,7 @@ void SubsetMap::InitList() aAllSubsets.push_back( Subset( 0x2A700, 0x2B73F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C ) ); break; #endif -#if U_ICU_VERSION_MAJOR_NUM = 46 +#if (U_ICU_VERSION_MAJOR_NUM 4) || (U_ICU_VERSION_MAJOR_NUM == 4 U_ICU_VERSION_MINOR_NUM = 6) case UBLOCK_MANDAIC: aAllSubsets.push_back( Subset( 0x0840, 0x085F, RID_SUBSETSTR_MANDAIC ) ); break; @@ -1420,6 +1420,7 @@ void SubsetMap::InitList() aAllSubsets.push_back( Subset( 0x2B740, 0x2B81F, RID_SUBSETSTR_CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D ) ); break; #endif +// Note ICU version 49 (NOT 4.9), so the MAJOR_NUM is two digits. #if U_ICU_VERSION_MAJOR_NUM = 49 case UBLOCK_ARABIC_EXTENDED_A: aAllSubsets.push_back( Subset( 0x08A0, 0x08FF, RID_SUBSETSTR_ARABIC_EXTENDED_A ) ); diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index
[Libreoffice-commits] core.git: i18npool/qa i18npool/source
i18npool/qa/cppunit/test_textsearch.cxx |2 +- i18npool/source/search/textsearch.cxx |8 +++- 2 files changed, 8 insertions(+), 2 deletions(-) New commits: commit b514f0ce86e85d9be269ddf2e797befbbf3423f1 Author: Herbert Dürr h...@apache.org Date: Mon Jan 14 09:50:06 2013 + i#121482# fix backwards regexp search for matches overlapping search start (cherry picked from commit 854f4ad6c57be62bd922df08f603d8bfb7b918a5) Additionally fixed unit test, searching backward shall not produce a different result from searching forward. (erAck) Change-Id: I952509276875441005e6a4036e6c3089be627dd9 diff --git a/i18npool/qa/cppunit/test_textsearch.cxx b/i18npool/qa/cppunit/test_textsearch.cxx index c26550b..d7a6c33 100644 --- a/i18npool/qa/cppunit/test_textsearch.cxx +++ b/i18npool/qa/cppunit/test_textsearch.cxx @@ -101,7 +101,7 @@ void TestTextSearch::testSearches() sal_Int32 startPos = 2, endPos = 20 ; OUString searchStr( (ab)*a(c|d)+ ); sal_Int32 fStartRes = 10, fEndRes = 18 ; -sal_Int32 bStartRes = 18, bEndRes = 14 ; +sal_Int32 bStartRes = 18, bEndRes = 10 ; // set options util::SearchOptions aOptions; diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx index 2df126e..65ab5e4 100644 --- a/i18npool/source/search/textsearch.cxx +++ b/i18npool/source/search/textsearch.cxx @@ -774,9 +774,15 @@ SearchResult TextSearch::RESrchBkwrd( const OUString searchStr, // find the last match int nLastPos = 0; +int nFoundEnd = 0; do { nLastPos = pRegexMatcher-start( nIcuErr); -} while( pRegexMatcher-find( nLastPos + 1, nIcuErr)); +nFoundEnd = pRegexMatcher-end( nIcuErr); +if( nFoundEnd = startPos) +break; +if( nFoundEnd == nLastPos) +++nFoundEnd; +} while( pRegexMatcher-find( nFoundEnd, nIcuErr)); // find last match again to get its details pRegexMatcher-find( nLastPos, nIcuErr); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits