summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-11-27 13:18:47 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-11-27 21:58:07 +0100
commit03567d1156d4e61910912c89124b6da94a577c22 (patch)
tree50cdb71c9e3915180a0c605c66cfc583c7ac15bc /editeng
parent6160ac241b1f54ddb2b2b444da14fe31878a5bc7 (diff)
rhbz#1517407 Capitalize every word doesn't work after brackets
Change-Id: Iab2da3f74f6116bb1b9855044df2a2ece977bb95 Reviewed-on: https://gerrit.libreoffice.org/45335 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/qa/unit/core-test.cxx15
-rw-r--r--editeng/source/editeng/impedit4.cxx4
2 files changed, 17 insertions, 2 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" );