summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-17 17:58:26 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-27 13:04:27 +0200
commit0ebb136be1726cf2cbed9409cd8925427dcb3680 (patch)
tree23483f4b45cbe3724491209b02f1b576b5ad5871
parent308a1f75c2cbb85c463bb8d2d3bf2747f99f5231 (diff)
sc lok: Test invalidation after adding\removing sheet
Reviewed-on: https://gerrit.libreoffice.org/79492 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 953cbe2fe9b5c03978f43d5517dac56cf7aa28e0) Change-Id: Id69f19a1170c04faae800b5ae7678ffe243263d6 Reviewed-on: https://gerrit.libreoffice.org/79618 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rw-r--r--sc/qa/unit/tiledrendering/data/insert_delete_sheet.odsbin0 -> 6977 bytes
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx50
2 files changed, 50 insertions, 0 deletions
diff --git a/sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods b/sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods
new file mode 100644
index 000000000000..b0ee4e005e48
--- /dev/null
+++ b/sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods
Binary files differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index ec3f5ee2d1cb..1d3dad68a0f1 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -99,6 +99,7 @@ public:
void testVbaRangeCopyPaste();
void testPageDownInvalidation();
void testSheetChangeInvalidation();
+ void testInsertDeletePageInvalidation();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
@@ -134,6 +135,7 @@ public:
CPPUNIT_TEST(testVbaRangeCopyPaste);
CPPUNIT_TEST(testPageDownInvalidation);
CPPUNIT_TEST(testSheetChangeInvalidation);
+ CPPUNIT_TEST(testInsertDeletePageInvalidation);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1749,6 +1751,54 @@ void ScTiledRenderingTest::testSheetChangeInvalidation()
comphelper::LibreOfficeKit::setActive(false);
}
+void ScTiledRenderingTest::testInsertDeletePageInvalidation()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ ScModelObj* pModelObj = createDoc("insert_delete_sheet.ods");
+ // the document has 1 sheet
+ CPPUNIT_ASSERT_EQUAL(1, pModelObj->getParts());
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ CPPUNIT_ASSERT(pViewData);
+
+ int nView1 = SfxLokHelper::getView();
+ ViewCallback aView1;
+ SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1);
+ CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData));
+
+ SfxLokHelper::setView(nView1);
+ aView1.m_bInvalidateTiles = false;
+ aView1.m_aInvalidations.clear();
+
+ uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({
+ { "Name", uno::Any(OUString("")) },
+ { "Index", uno::Any(sal_Int32(1)) }
+ }));
+ comphelper::dispatchCommand(".uno:Insert", aArgs);
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
+ CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(2, pModelObj->getParts());
+
+ // Delete sheet
+ aView1.m_bInvalidateTiles = false;
+ aView1.m_aInvalidations.clear();
+ uno::Sequence<beans::PropertyValue> aArgs2( comphelper::InitPropertySequence({
+ { "Index", uno::Any(sal_Int32(1)) }
+ }));
+ comphelper::dispatchCommand(".uno:Remove", aArgs2);
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
+ CPPUNIT_ASSERT_EQUAL(size_t(5), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(1, pModelObj->getParts());
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);