summaryrefslogtreecommitdiff
path: root/editeng/qa
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-08-23 17:44:16 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-09-05 16:24:11 +0200
commitc5fcab1ec72be1cf2868215ee71d3cb2668498c1 (patch)
tree8f3d3875bd402ec9f397ae9803db9a75dbb54301 /editeng/qa
parent02b95a0e8191fc560637b2fa3a62bca0bd51b9c4 (diff)
Resolves: tdf#108795 merge table EditEngine language attributes to input line
... and change SvxAutoCorrect to be stateless again to make that work. This is a combination of 3 commits. 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. Reviewed-on: https://gerrit.libreoffice.org/41475 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 06d14411a447cd798d1f0678a3c5e06f5278a1cb) Backported. Related: tdf#108795 never use an unresolved LANGUAGE_SYSTEM in SvxAutoCorrect Substitute with the current work locale, using MsLangId::getSystemLanguage() instead was also wrong. Reviewed-on: https://gerrit.libreoffice.org/41476 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 311be7d70146e4963e4dfd1f39d6c71d45d241ca) Resolves: tdf#108795 merge table EditEngine language attributes to input line ... when editing there, so the SvxAutoCorrect behaviour is synchronized. Depends on commit 06d14411a447cd798d1f0678a3c5e06f5278a1cb that disentangles the stateful SvxAutoCorrect instance. Reviewed-on: https://gerrit.libreoffice.org/41521 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com> (cherry picked from commit d31a8263d564ebd7886f6debdf36cedd031915ea) 55db3bc1f76329320afc1f366d7426a8c2f66fb2 c6aac1f2acc36b500144be50a20a4784a3ba62dc Change-Id: I79a26d2ba44cc40771979a78b686c89f0c80b412 Reviewed-on: https://gerrit.libreoffice.org/41525 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'editeng/qa')
-rw-r--r--editeng/qa/unit/core-test.cxx15
1 files changed, 10 insertions, 5 deletions
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index f620a72d8843..d2b8affea7a1 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -334,9 +334,10 @@ void Test::testAutocorrect()
OUString sInput("TEst-TEst");
sal_Unicode cNextChar(' ');
OUString 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());
}
@@ -345,9 +346,10 @@ void Test::testAutocorrect()
OUString sInput("TEst/TEst");
sal_Unicode cNextChar(' ');
OUString 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());
}
@@ -357,9 +359,10 @@ void Test::testAutocorrect()
OUString sInput("*foo");
sal_Unicode cNextChar('*');
OUString 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());
}
@@ -368,9 +371,10 @@ void Test::testAutocorrect()
OUString sInput("Test. test");
sal_Unicode cNextChar(' ');
OUString 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());
}
@@ -379,9 +383,10 @@ void Test::testAutocorrect()
OUString sInput("Test. \x01 test");
sal_Unicode cNextChar(' ');
OUString 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());
}