[Libreoffice-commits] core.git: sc/qa
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Sat Feb 6 07:46:14 UTC 2021
sc/qa/unit/uicalc/uicalc.cxx | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
New commits:
commit 7d308dbfedaadc874ff4eebddca36760ba50de86
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Fri Feb 5 11:23:12 2021 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Sat Feb 6 08:45:01 2021 +0100
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 at libreoffice.org>
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");
More information about the Libreoffice-commits
mailing list