[Libreoffice-commits] core.git: editeng/qa editeng/source sw/qa sw/source
Caolán McNamara
caolanm at redhat.com
Mon Nov 27 20:58:38 UTC 2017
editeng/qa/unit/core-test.cxx | 15 +++++++++++++++
editeng/source/editeng/impedit4.cxx | 4 ++--
sw/qa/core/uwriter.cxx | 6 ++++++
sw/source/core/txtnode/txtedt.cxx | 4 ++--
4 files changed, 25 insertions(+), 4 deletions(-)
New commits:
commit 03567d1156d4e61910912c89124b6da94a577c22
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 27 13:18:47 2017 +0000
rhbz#1517407 Capitalize every word doesn't work after brackets
Change-Id: Iab2da3f74f6116bb1b9855044df2a2ece977bb95
Reviewed-on: https://gerrit.libreoffice.org/45335
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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);
}
}
More information about the Libreoffice-commits
mailing list