summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2019-09-21 15:46:38 +0200
committerTamás Zolnai <tamas.zolnai@collabora.com>2019-09-27 13:06:33 +0200
commit81846e20a18ceec3e7582241577e276fa4d0f5ac (patch)
tree6f0357f14328d4092f564971917194f40e840bc8 /sc
parent0ebb136be1726cf2cbed9409cd8925427dcb3680 (diff)
sc lok: Test invalidation triggered by getRowColumnHeaders() method
Reviewed-on: https://gerrit.libreoffice.org/79493 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> (cherry picked from commit 9c975823b82e6b64c3dff0b4347162e8d426b852) Change-Id: Ie9961688333b3ddd10562d62606dfe01b173534d Reviewed-on: https://gerrit.libreoffice.org/79619 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 1d3dad68a0f1..8c3e77f8f826 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -100,6 +100,7 @@ public:
void testPageDownInvalidation();
void testSheetChangeInvalidation();
void testInsertDeletePageInvalidation();
+ void testGetRowColumnHeadersInvalidation();
CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
CPPUNIT_TEST(testRowColumnSelections);
@@ -136,6 +137,7 @@ public:
CPPUNIT_TEST(testPageDownInvalidation);
CPPUNIT_TEST(testSheetChangeInvalidation);
CPPUNIT_TEST(testInsertDeletePageInvalidation);
+ CPPUNIT_TEST(testGetRowColumnHeadersInvalidation);
CPPUNIT_TEST_SUITE_END();
private:
@@ -1799,6 +1801,54 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation()
comphelper::LibreOfficeKit::setActive(false);
}
+void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation()
+{
+ comphelper::LibreOfficeKit::setActive();
+
+ ScModelObj* pModelObj = createDoc("empty.ods");
+ 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();
+ pModelObj->getRowColumnHeaders(tools::Rectangle(0, 15, 19650, 5400));
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[1]);
+
+ // Extend area top-to-bottom
+ aView1.m_bInvalidateTiles = false;
+ aView1.m_aInvalidations.clear();
+ pModelObj->getRowColumnHeaders(tools::Rectangle(0, 5400, 19650, 9800));
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[1]);
+
+ // Extend area left-to-right
+ aView1.m_bInvalidateTiles = false;
+ aView1.m_aInvalidations.clear();
+ pModelObj->getRowColumnHeaders(tools::Rectangle(5400, 5400, 25050, 9800));
+ Scheduler::ProcessEventsToIdle();
+ CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
+ CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size());
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1000000000, 1000000000), aView1.m_aInvalidations[0]);
+ CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[1]);
+
+ mxComponent->dispose();
+ mxComponent.clear();
+ comphelper::LibreOfficeKit::setActive(false);
+}
+
}
CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);