diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-02-05 11:23:12 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-02-06 08:45:01 +0100 |
commit | 7d308dbfedaadc874ff4eebddca36760ba50de86 (patch) | |
tree | f51b87fac7f1b3f1b35f08e89f3de30d431362ac /sc | |
parent | 4b055a51c501cec3f71600c1b87aa1fad85dd5af (diff) |
tdf#124778: sc_uicalc: Add unittest
Change-Id: I44448a8c7bcc2573ac32491f2b81e18e6360d1e2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110470
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index bb038104a60f..f1d861518271 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -25,6 +25,7 @@ #include <docsh.hxx> #include <drwlayer.hxx> #include <inputopt.hxx> +#include <postit.hxx> #include <rangeutl.hxx> #include <scmod.hxx> #include <tabvwsh.hxx> @@ -883,6 +884,34 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf118207) pMod->SetInputOptions(aInputOption); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124778) +{ + mxComponent = loadFromDesktop("private:factory/scalc"); + ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get()); + CPPUNIT_ASSERT(pModelObj); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + // Add a new comment + uno::Sequence<beans::PropertyValue> aArgs + = comphelper::InitPropertySequence({ { "Text", uno::makeAny(OUString("Comment")) } }); + dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs); + Scheduler::ProcessEventsToIdle(); + + CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", pDoc->HasNote(ScAddress(0, 0, 0))); + + // Without the fix in place, this test would have crashed + dispatchCommand(mxComponent, ".uno:ShowAnnotations", {}); + + ScPostIt* pNote = pDoc->GetNote(ScAddress(0, 0, 0)); + CPPUNIT_ASSERT(pNote); + CPPUNIT_ASSERT_EQUAL(true, pNote->IsCaptionShown()); + + dispatchCommand(mxComponent, ".uno:ShowAnnotations", {}); + + CPPUNIT_ASSERT_EQUAL(false, pNote->IsCaptionShown()); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf138428) { mxComponent = loadFromDesktop("private:factory/scalc"); |