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

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Fri Aug 6 08:25:48 UTC 2021


 sc/qa/unit/tiledrendering/tiledrendering.cxx |   44 ++++++++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

New commits:
commit 06f993fa3175cc237d16d47fd8444411c9b4491f
Author:     Dennis Francis <dennisfrancis.in at gmail.com>
AuthorDate: Fri Jul 2 19:10:31 2021 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Fri Aug 6 10:25:04 2021 +0200

    lok: sc: unit test for non existent tab view data fix
    
    Conflicts:
            sc/qa/unit/tiledrendering/tiledrendering.cxx
    
    Change-Id: I7c0ea95118448a49288ff70c8e7bcddc379df5ca
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119602
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index fc3d675ba79a..b9f24ed20afd 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -121,7 +121,7 @@ public:
     void testMoveShapeHandle();
     void testEditCursorBounds();
     void testTextSelectionBounds();
-
+    void testSheetViewDataCrash();
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnHeaders);
@@ -175,6 +175,7 @@ public:
     CPPUNIT_TEST(testMoveShapeHandle);
     CPPUNIT_TEST(testEditCursorBounds);
     CPPUNIT_TEST(testTextSelectionBounds);
+    CPPUNIT_TEST(testSheetViewDataCrash);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -2818,6 +2819,47 @@ void ScTiledRenderingTest::testTextSelectionBounds()
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
+void ScTiledRenderingTest::testSheetViewDataCrash()
+{
+    comphelper::LibreOfficeKit::setActive();
+
+    ScModelObj* pModelObj = createDoc("empty.ods");
+
+    // view #1
+    int nView1 = SfxLokHelper::getView();
+    SfxLokHelper::setView(nView1);
+
+    // Imitate online while creating a new sheet on empty.ods.
+    uno::Sequence<beans::PropertyValue> aArgs(
+        comphelper::InitPropertySequence({
+            { "Name",  uno::Any(OUString("NewSheet")) },
+            { "Index", uno::Any(sal_Int32(2)) }
+        }));
+    comphelper::dispatchCommand(".uno:Insert", aArgs);
+    Scheduler::ProcessEventsToIdle();
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1);
+    Scheduler::ProcessEventsToIdle();
+    ScTabViewShell* pView1 = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+    CPPUNIT_ASSERT(pView1);
+
+    // view #2
+    SfxLokHelper::createView();
+    ScTabViewShell* pView2 = dynamic_cast<ScTabViewShell*>(SfxViewShell::Current());
+    CPPUNIT_ASSERT(pView2);
+    Scheduler::ProcessEventsToIdle();
+
+    SfxLokHelper::setView(nView1);
+    // Delete a range.
+    pView1->SetCursor(1, 1);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DOWN | KEY_SHIFT);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DOWN | KEY_SHIFT);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DELETE);
+    pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DELETE);
+    // It will crash at this point without the fix.
+    Scheduler::ProcessEventsToIdle();
+}
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);


More information about the Libreoffice-commits mailing list