diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/uicalc/data/tdf119793.ods | bin | 0 -> 8039 bytes | |||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 41 |
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 Binary files differnew file mode 100644 index 000000000000..e303bed01891 --- /dev/null +++ b/sc/qa/unit/uicalc/data/tdf119793.ods 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"); |