[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/qa

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 26 17:45:37 UTC 2019


 sc/qa/unit/tiledrendering/data/insert_delete_sheet.ods |binary
 sc/qa/unit/tiledrendering/tiledrendering.cxx           |   46 +++++++++++++++++
 2 files changed, 46 insertions(+)

New commits:
commit a5ed868177cf7c859fcadd4a49010075689642c1
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Sep 17 17:58:26 2019 +0200
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Sep 26 19:44:33 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.zolnai at collabora.com>
    (cherry picked from commit 953cbe2fe9b5c03978f43d5517dac56cf7aa28e0)
    
    Change-Id: Id69f19a1170c04faae800b5ae7678ffe243263d6
    Reviewed-on: https://gerrit.libreoffice.org/79618
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.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 df43e49b8192..9335b51b305e 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -104,6 +104,7 @@ public:
     void testVbaRangeCopyPaste();
     void testPageDownInvalidation();
     void testSheetChangeInvalidation();
+    void testInsertDeletePageInvalidation();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnSelections);
@@ -139,6 +140,7 @@ public:
     CPPUNIT_TEST(testVbaRangeCopyPaste);
     CPPUNIT_TEST(testPageDownInvalidation);
     CPPUNIT_TEST(testSheetChangeInvalidation);
+    CPPUNIT_TEST(testInsertDeletePageInvalidation);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -1743,6 +1745,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);


More information about the Libreoffice-commits mailing list