diff options
author | Eike Rathke <erack@redhat.com> | 2017-08-23 17:44:16 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-08-24 00:30:37 +0200 |
commit | 06d14411a447cd798d1f0678a3c5e06f5278a1cb (patch) | |
tree | 37fd5ccedaff3491bb8d17a1072d60371d3801a0 /editeng/qa/unit/core-test.cxx | |
parent | 5a9b20c8bd0c2d7065cde37ebef330aaee0056e2 (diff) |
Related: tdf#108795 a shared SvxAutoCorrect instance can not be stateful
An SvxAutoCorrect instance is shared via SvxAutoCorrCfg::Get().GetAutoCorrect().
Since commit 284eb106767d094fc5c547efd6c11cc390e3538a and following the
SvxAutoCorrect::bRunNext/HasRunNext() introduced a state whether a previously
inserted NO-BREAK SPACE should be removed again, depending on the next
character input. That does not work, for example, if
SvxAutoCorrect::DoAutoCorrect() is called from two different EditEngine
instances, like it is the case in the Calc input line and cell which are
synchronized; or any other two or more instances for that matter. The caller
has to pass and remember a flag that is maintained by SvxAutoCorrect.
Change-Id: I79a26d2ba44cc40771979a78b686c89f0c80b412
Reviewed-on: https://gerrit.libreoffice.org/41475
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'editeng/qa/unit/core-test.cxx')
-rw-r--r-- | editeng/qa/unit/core-test.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index f806a056ff26..6345473d4257 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -353,9 +353,10 @@ void Test::testAutocorrect() OUString sInput("TEst-TEst"); sal_Unicode const cNextChar(' '); OUString const sExpected("Test-Test "); + bool bNbspRunNext = false; TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US); - aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true); + aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext); CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult()); } @@ -364,9 +365,10 @@ void Test::testAutocorrect() OUString sInput("TEst/TEst"); sal_Unicode const cNextChar(' '); OUString const sExpected("Test/Test "); + bool bNbspRunNext = false; TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US); - aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true); + aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext); CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult()); } @@ -376,9 +378,10 @@ void Test::testAutocorrect() OUString sInput("*foo"); sal_Unicode const cNextChar('*'); OUString const sExpected("foo"); + bool bNbspRunNext = false; TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US); - aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true); + aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext); CPPUNIT_ASSERT_EQUAL(sExpected, aFoo.getResult()); } @@ -387,9 +390,10 @@ void Test::testAutocorrect() OUString sInput("Test. test"); sal_Unicode const cNextChar(' '); OUString const sExpected("Test. Test "); + bool bNbspRunNext = false; TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US); - aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true); + aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext); CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult()); } @@ -399,9 +403,10 @@ void Test::testAutocorrect() OUString sInput("Test. \x01 test"); sal_Unicode const cNextChar(' '); OUString const sExpected("Test. \x01 test "); + bool bNbspRunNext = false; TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US); - aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true); + aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext); CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult()); } @@ -412,10 +417,11 @@ void Test::testAutocorrect() sal_Unicode const cNextChar('"'); const sal_Unicode EXPECTED[] = { 'T', 0x01, 0x0201d }; OUString sExpected(EXPECTED, SAL_N_ELEMENTS(EXPECTED)); + bool bNbspRunNext = false; TestAutoCorrDoc aFoo(sInput, LANGUAGE_ENGLISH_US); aAutoCorrect.SetAutoCorrFlag(ChgQuotes, true); - aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true); + aAutoCorrect.DoAutoCorrect(aFoo, sInput, sInput.getLength(), cNextChar, true, bNbspRunNext); fprintf(stderr, "text is %x\n", aFoo.getResult()[aFoo.getResult().getLength() - 1]); CPPUNIT_ASSERT_EQUAL_MESSAGE("autocorrect", sExpected, aFoo.getResult()); |