sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 92 +++++++++++++++++ 2 files changed, 92 insertions(+)
New commits: commit 128cafa187149cbcb9b7a22a6e93025c9ac8da29 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Sat Sep 21 15:46:38 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Sep 28 03:31:37 2019 +0200 sc lok: Test invalidation triggered by getRowColumnHeaders() method Reviewed-on: https://gerrit.libreoffice.org/79493 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 9c975823b82e6b64c3dff0b4347162e8d426b852) Change-Id: Ie9961688333b3ddd10562d62606dfe01b173534d Reviewed-on: https://gerrit.libreoffice.org/79619 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/79762 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 98f4557b562b..e7937792abd9 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -102,6 +102,7 @@ public: void testPageDownInvalidation(); void testSheetChangeInvalidation(); void testInsertDeletePageInvalidation(); + void testGetRowColumnHeadersInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -138,6 +139,7 @@ public: CPPUNIT_TEST(testPageDownInvalidation); CPPUNIT_TEST(testSheetChangeInvalidation); CPPUNIT_TEST(testInsertDeletePageInvalidation); + CPPUNIT_TEST(testGetRowColumnHeadersInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1778,6 +1780,50 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation() CPPUNIT_ASSERT_EQUAL(1, pModelObj->getParts()); } +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]); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); commit 4ccea416805191810a98869dac21ab66eb176ec7 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Tue Sep 17 17:58:26 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Sat Sep 28 03:31:22 2019 +0200 sc lok: Test invalidation after adding\removing sheet Reviewed-on: https://gerrit.libreoffice.org/79492 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit 953cbe2fe9b5c03978f43d5517dac56cf7aa28e0) Change-Id: Id69f19a1170c04faae800b5ae7678ffe243263d6 Reviewed-on: https://gerrit.libreoffice.org/79618 Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> Tested-by: Tamás Zolnai <tamas.zol...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/79761 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> 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 Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index e196bb788ec0..98f4557b562b 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -101,6 +101,7 @@ public: void testVbaRangeCopyPaste(); void testPageDownInvalidation(); void testSheetChangeInvalidation(); + void testInsertDeletePageInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -136,6 +137,7 @@ public: CPPUNIT_TEST(testVbaRangeCopyPaste); CPPUNIT_TEST(testPageDownInvalidation); CPPUNIT_TEST(testSheetChangeInvalidation); + CPPUNIT_TEST(testInsertDeletePageInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1732,6 +1734,50 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]); } +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()); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits