sc/qa/unit/uicalc/data/tdf119793.ods |binary sc/qa/unit/uicalc/uicalc.cxx | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+)
New commits: commit 1b1a9c6c12ebe4cac19e34ff5e4818998bbb2537 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Wed Apr 21 22:09:27 2021 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Apr 22 09:50:48 2021 +0200 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 <xiscofa...@libreoffice.org> 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 Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf119793.ods 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"); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits