diff options
-rw-r--r-- | editeng/qa/unit/core-test.cxx | 15 | ||||
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 4 | ||||
-rw-r--r-- | sw/qa/core/uwriter.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 4 |
4 files changed, 25 insertions, 4 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 8becb860cc0b..c23e94a0f60f 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -89,6 +89,8 @@ public: void testLargeParaCopyPaste(); + void testTransliterate(); + DECL_STATIC_LINK( Test, CalcFieldValueHdl, EditFieldInfo*, void ); CPPUNIT_TEST_SUITE(Test); @@ -107,6 +109,7 @@ public: CPPUNIT_TEST(testParaStartCopyPaste); CPPUNIT_TEST(testSectionAttributes); CPPUNIT_TEST(testLargeParaCopyPaste); + CPPUNIT_TEST(testTransliterate); CPPUNIT_TEST_SUITE_END(); private: @@ -1741,6 +1744,18 @@ void Test::testLargeParaCopyPaste() CPPUNIT_ASSERT_EQUAL( aTenthPara, rDoc.GetParaAsString(sal_Int32(11)) ); } +void Test::testTransliterate() +{ + // Create EditEngine's instance + EditEngine aEditEngine( mpItemPool ); + + OUString sText("one (two) three"); + aEditEngine.SetText(sText); + aEditEngine.TransliterateText(ESelection(0, 0, 0, sText.getLength()), TransliterationFlags::TITLE_CASE); + OUString aExpected("One (Two) Three"); + CPPUNIT_ASSERT_EQUAL(aExpected, aEditEngine.GetText()); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index f315141e9719..1114fee47b9a 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2791,8 +2791,8 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, (void) aSelTxt; #endif - aCurWordBndry = _xBI->nextWord(aNodeStr, nCurrentEnd, - GetLocale( EditPaM( pNode, nCurrentEnd + 1 ) ), + aCurWordBndry = _xBI->nextWord(aNodeStr, nCurrentStart, + GetLocale( EditPaM( pNode, nCurrentStart + 1 ) ), nWordType); } DBG_ASSERT( nCurrentEnd >= aEndBndry.endPos, "failed to reach end of transliteration" ); diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 9b68dc156d08..e91b8fd8ac20 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1492,6 +1492,12 @@ void SwDocTest::testTransliterate() CPPUNIT_ASSERT_EQUAL(OUString("Foobar"), translitTest(*m_pDoc, aPaM, TransliterationFlags::HIRAGANA_KATAKANA)); + + m_pDoc->getIDocumentContentOperations().AppendTextNode(*aPaM.GetPoint()); + m_pDoc->getIDocumentContentOperations().InsertString(aPaM, "one (two) three"); + CPPUNIT_ASSERT_EQUAL(OUString("One (Two) Three"), + translitTest(*m_pDoc, aPaM, + TransliterationFlags::TITLE_CASE)); } namespace diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 424564b72450..c9b7abe9734e 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1757,8 +1757,8 @@ void SwTextNode::TransliterateText( } aCurWordBndry = g_pBreakIt->GetBreakIter()->nextWord( - GetText(), nEnd, - g_pBreakIt->GetLocale( GetLang( nEnd ) ), + GetText(), nStt, + g_pBreakIt->GetLocale(GetLang(nStt, 1)), nWordType); } } |