summaryrefslogtreecommitdiff
path: root/sc/qa/unit/tiledrendering
diff options
context:
space:
mode:
authorMarco Cecchetti <marco.cecchetti@collabora.com>2016-11-17 22:03:34 +0100
committerMarco Cecchetti <mrcekets@gmail.com>2016-11-19 14:25:54 +0000
commit87c67a4ad344cf1b7c7c9f89f2362cc82901aec3 (patch)
tree142a56e23d068d3afcfea2df40b89af001e1e06c /sc/qa/unit/tiledrendering
parent580c2072923f7d29ce27595543f2d2749af83cf9 (diff)
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>
Diffstat (limited to 'sc/qa/unit/tiledrendering')
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx44
1 files changed, 44 insertions, 0 deletions
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<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);