From 87c67a4ad344cf1b7c7c9f89f2362cc82901aec3 Mon Sep 17 00:00:00 2001 From: Marco Cecchetti Date: Thu, 17 Nov 2016 22:03:34 +0100 Subject: LOK - Calc: unit test for invalidation on copy/paste to the doc bottom Change-Id: I92b6a3f1c3b3c6c260b25b046bd19b249be0db0b Reviewed-on: https://gerrit.libreoffice.org/30977 Reviewed-by: Marco Cecchetti Tested-by: Marco Cecchetti --- sc/qa/unit/tiledrendering/tiledrendering.cxx | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'sc/qa') diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 9aa51155200a..0ea043165ac0 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -68,6 +68,7 @@ public: void testGraphicInvalidate(); void testAutoSum(); void testHideColRow(); + void testInvalidateOnCopyPasteCells(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -87,6 +88,7 @@ public: CPPUNIT_TEST(testGraphicInvalidate); CPPUNIT_TEST(testAutoSum); CPPUNIT_TEST(testHideColRow); + CPPUNIT_TEST(testInvalidateOnCopyPasteCells); CPPUNIT_TEST_SUITE_END(); private: @@ -937,6 +939,48 @@ void ScTiledRenderingTest::testHideColRow() mxComponent.clear(); comphelper::LibreOfficeKit::setActive(false); } +void ScTiledRenderingTest::testInvalidateOnCopyPasteCells() +{ + // Load a document + comphelper::LibreOfficeKit::setActive(); + ScModelObj* pModelObj = createDoc("small.ods"); + CPPUNIT_ASSERT(pModelObj); + + // view + ViewCallback aView; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView); + + aView.m_bInvalidateTiles = false; + uno::Sequence aArgs; + // select and copy cells + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_HOME | KEY_MOD1); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_HOME | KEY_MOD1); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN | KEY_SHIFT); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN | KEY_SHIFT); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT | KEY_SHIFT); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_RIGHT | KEY_SHIFT); + Scheduler::ProcessEventsToIdle(); + comphelper::dispatchCommand(".uno:Copy", aArgs); + + // move to destination cell + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_DOWN | KEY_MOD1); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_DOWN | KEY_MOD1); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_UP); + pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_UP); + Scheduler::ProcessEventsToIdle(); + + // paste cells + aView.m_bInvalidateTiles = false; + comphelper::dispatchCommand(".uno:Paste", aArgs); + Scheduler::ProcessEventsToIdle(); + CPPUNIT_ASSERT(aView.m_bInvalidateTiles); + + mxComponent->dispose(); + mxComponent.clear(); + comphelper::LibreOfficeKit::setActive(false); +} } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); -- cgit