summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-04-21 22:09:27 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-04-22 09:50:48 +0200
commit1b1a9c6c12ebe4cac19e34ff5e4818998bbb2537 (patch)
tree6dc84152be57b2911334d02ffd394f2267a138e6 /sc
parentcdbf09681b7c66c3d3c1d5c8086bd57e23f7939c (diff)
tdf#119793: sc_uicalc: Add unittest
Change-Id: Ie676a88546bd7ee1a077aba4c3322307b14319a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114457 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/uicalc/data/tdf119793.odsbin0 -> 8039 bytes
-rw-r--r--sc/qa/unit/uicalc/uicalc.cxx41
2 files changed, 41 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/data/tdf119793.ods b/sc/qa/unit/uicalc/data/tdf119793.ods
new file mode 100644
index 000000000000..e303bed01891
--- /dev/null
+++ b/sc/qa/unit/uicalc/data/tdf119793.ods
Binary files differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 90a412d4588e..e42465402749 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -658,6 +658,47 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133326)
CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(2), pDoc->GetTableCount());
}
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119793)
+{
+ ScModelObj* pModelObj = createDoc("tdf119793.ods");
+
+ uno::Reference<drawing::XDrawPage> xPage(pModelObj->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW);
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4984), xShape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1381), xShape->getPosition().Y);
+
+ // Move the shape to the right
+ lcl_SelectObjectByName(u"Shape 1");
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT);
+ Scheduler::ProcessEventsToIdle();
+
+ //position has changed
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5084), xShape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1381), xShape->getPosition().Y);
+
+ // Type into the shape
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 'x', 0);
+ pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 'x', 0);
+ Scheduler::ProcessEventsToIdle();
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(5084), xShape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1381), xShape->getPosition().Y);
+
+ dispatchCommand(mxComponent, ".uno:Undo", {});
+ Scheduler::ProcessEventsToIdle();
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 4984
+ // - Actual : 5084
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4984), xShape->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1381), xShape->getPosition().Y);
+}
+
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455)
{
ScModelObj* pModelObj = createDoc("tdf131455.ods");