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 <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
This commit is contained in:
Marco Cecchetti
2016-11-17 22:03:34 +01:00
committed by Marco Cecchetti
parent 580c207292
commit 87c67a4ad3

View File

@@ -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<beans::PropertyValue> 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);