diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-10-17 11:13:07 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-10-17 21:30:57 +0200 |
commit | 4be9bd0595cec36b6a22ca12b48661e080a5a1d8 (patch) | |
tree | 33e9a1d1c1fc60081ded79dc2a612882f452f535 /sw/qa/extras/uiwriter/uiwriter6.cxx | |
parent | 6347dcbd3ab2e0a7cb2f7de3bcb5d007e8befc09 (diff) |
tdf#157442: sw_uiwriter6: Add unittest
gerrit_mac fails with
[_RUN_____] testTdf157442::TestBody
Error: a unit test failed, please do one of:
make CppunitTest_sw_uiwriter6 CPPUNITTRACE="lldb --" # for interactive debugging on macOS
make CppunitTest_sw_uiwriter6 VALGRIND=memcheck # for memory checking
You can limit the execution to just one particular test by:
make CppunitTest_sw_uiwriter6 CPPUNIT_TEST_NAME="testXYZ" ...above mentioned params...
so disable it for now on mac
Change-Id: Iaf51987010a976a3a38f264d6b45c8cc6eb7f283
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158079
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/extras/uiwriter/uiwriter6.cxx')
-rw-r--r-- | sw/qa/extras/uiwriter/uiwriter6.cxx | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index ac5155f429a9..3d4b6e3d8d8a 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -46,6 +46,7 @@ #include <comphelper/sequence.hxx> #include <comphelper/scopeguard.hxx> #include <editeng/swafopt.hxx> +#include <editeng/unolingu.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <vcl/scheduler.hxx> #include <config_fonts.h> @@ -1687,9 +1688,47 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603) } } -CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535) +#if !defined(MACOSX) +CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157442) { + createSwDoc(); + SwDoc* pDoc = getSwDoc(); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + const SwViewOption* pOpt = pWrtShell->GetViewOptions(); + uno::Sequence<beans::PropertyValue> params + = comphelper::InitPropertySequence({ { "Enable", uno::Any(true) } }); + dispatchCommand(mxComponent, ".uno:SpellOnline", params); + + // Automatic Spell Checking is enabled + CPPUNIT_ASSERT(pOpt->IsOnlineSpell()); + + // check available en_US dictionary and test spelling with it + uno::Reference<XLinguServiceManager2> xLngSvcMgr(GetLngSvcMgr_Impl()); + uno::Reference<XSpellChecker1> xSpell; + xSpell.set(xLngSvcMgr->getSpellChecker(), UNO_QUERY); + LanguageType eLang = LanguageTag::convertToLanguageType(lang::Locale("en", "US", OUString())); + if (xSpell.is() && xSpell->hasLanguage(static_cast<sal_uInt16>(eLang))) + { + uno::Reference<linguistic2::XLinguProperties> xLinguProperties( + LinguMgr::GetLinguPropertySet()); + + // Spell with digits is disabled by default + CPPUNIT_ASSERT_EQUAL(sal_False, xLinguProperties->getIsSpellWithDigits()); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + emulateTyping(*pTextDoc, u"ErrorError Treee2 "); + SwCursorShell* pShell(pDoc->GetEditShell()); + SwTextNode* pNode = pShell->GetCursor()->GetPointNode().GetTextNode(); + + // Without the fix in place, this test would have crashed because GetWrong() returns nullptr + CPPUNIT_ASSERT_EQUAL(sal_uInt16(1), pNode->GetWrong()->Count()); + } +} +#endif + #if !defined(MACOSX) +CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535) +{ createSwDoc("tdf65535.fodt"); SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); SwWrtShell* pWrtShell = pTextDoc->GetDocShell()->GetWrtShell(); @@ -1755,8 +1794,8 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535) } // This was false (lost comment with spelling replacement) CPPUNIT_ASSERT_EQUAL(OString("with comment"), sCommentText); -#endif } +#endif CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testRedlineAutoCorrect) { |