tdf#136113: sc_uicalc: Add unittest
Change-Id: Iddc82cf41269e15b5d8afcb203b9ff6ae006a87a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112492
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
diff --git a/sc/qa/unit/uicalc/data/tdf136113.xlsx b/sc/qa/unit/uicalc/data/tdf136113.xlsx
new file mode 100644
index 0000000..a811e91
--- /dev/null
+++ b/sc/qa/unit/uicalc/data/tdf136113.xlsx
Binary files differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index d0d3c03..c6e4215 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1070,6 +1070,34 @@
CPPUNIT_ASSERT_MESSAGE("There should be a note on B1", pDoc->HasNote(ScAddress(1, 0, 0)));
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf136113)
{
ScModelObj* pModelObj = createDoc("tdf136113.xlsx");
ScDocument* pDoc = pModelObj->GetDocument();
CPPUNIT_ASSERT(pDoc);
ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
SdrPage* pPage = pDrawLayer->GetPage(0);
SdrObject* pObj = pPage->GetObj(0);
CPPUNIT_ASSERT_EQUAL(tools::Long(18159), pObj->GetSnapRect().Left());
CPPUNIT_ASSERT_EQUAL(tools::Long(1709), pObj->GetSnapRect().Top());
lcl_SelectObjectByName(u"Arrow");
// Move the shape up
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::UP);
pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::UP);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(tools::Long(18159), pObj->GetSnapRect().Left());
CPPUNIT_ASSERT_EQUAL(tools::Long(1609), pObj->GetSnapRect().Top());
// Without the fix in place, this test would have failed here
ScDocShell* pDocSh = ScDocShell::GetViewData()->GetDocShell();
CPPUNIT_ASSERT(pDocSh->IsModified());
}
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf130614)
{
ScModelObj* pModelObj = createDoc("tdf130614.ods");