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

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Mon Apr 12 15:34:28 UTC 2021


 sc/qa/unit/tiledrendering/tiledrendering.cxx |   93 +++++++++++++++------------
 1 file changed, 54 insertions(+), 39 deletions(-)

New commits:
commit 15f1ab13a79df0bf7e4c77b216bcdd53c15c5410
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Wed Jan 20 11:15:04 2021 +0530
Commit:     Dennis Francis <dennis.francis at collabora.com>
CommitDate: Mon Apr 12 17:33:54 2021 +0200

    unit test: check for row height invalidations on sort
    
    Change-Id: I5b4e690c48583dcb609eb139ef2bf8e62d146d30
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109662
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    (cherry picked from commit f37ce0a08bc73d4d1e3cdee6553e637bd965ec1e)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113974
    Tested-by: Dennis Francis <dennis.francis at collabora.com>
    Reviewed-by: Dennis Francis <dennis.francis at collabora.com>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index cf45a033cd3f..bac7ff5d2317 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -72,7 +72,6 @@ public:
 
     void testRowColumnHeaders();
     void testRowColumnSelections();
-    void testSortAscendingDescending();
     void testPartHash();
     void testDocumentSize();
     void testEmptyColumnSelection();
@@ -115,11 +114,12 @@ public:
     void testSpellOnlineParameter();
     void testSpellOnlineRenderParameter();
     void testPasteIntoWrapTextCell();
+    void testSortAscendingDescending();
+
 
     CPPUNIT_TEST_SUITE(ScTiledRenderingTest);
     CPPUNIT_TEST(testRowColumnHeaders);
     CPPUNIT_TEST(testRowColumnSelections);
-    CPPUNIT_TEST(testSortAscendingDescending);
     CPPUNIT_TEST(testPartHash);
     CPPUNIT_TEST(testDocumentSize);
     CPPUNIT_TEST(testEmptyColumnSelection);
@@ -162,6 +162,7 @@ public:
     CPPUNIT_TEST(testSpellOnlineParameter);
     CPPUNIT_TEST(testSpellOnlineRenderParameter);
     CPPUNIT_TEST(testPasteIntoWrapTextCell);
+    CPPUNIT_TEST(testSortAscendingDescending);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -358,43 +359,6 @@ void ScTiledRenderingTest::testRowColumnSelections()
     CPPUNIT_ASSERT_EQUAL(aExpected, aResult);
 }
 
-void ScTiledRenderingTest::testSortAscendingDescending()
-{
-    comphelper::LibreOfficeKit::setActive();
-    ScModelObj* pModelObj = createDoc("sort-range.ods");
-    ScDocument* pDoc = pModelObj->GetDocument();
-
-    // select the values in the first column
-    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, 551, 129, 1, MOUSE_LEFT, 0);
-    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, 820, 1336, 1, MOUSE_LEFT, 0);
-    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, 820, 1359, 1, MOUSE_LEFT, 0);
-    Scheduler::ProcessEventsToIdle();
-
-    // sort ascending
-    uno::Sequence<beans::PropertyValue> aArgs;
-    comphelper::dispatchCommand(".uno:SortAscending", aArgs);
-
-    // check it's sorted
-    for (SCROW r = 0; r < 6; ++r)
-    {
-        CPPUNIT_ASSERT_EQUAL(double(r + 1), pDoc->GetValue(ScAddress(0, r, 0)));
-    }
-
-    // sort descending
-    comphelper::dispatchCommand(".uno:SortDescending", aArgs);
-
-    // check it's sorted
-    for (SCROW r = 0; r < 6; ++r)
-    {
-        CPPUNIT_ASSERT_EQUAL(double(6 - r), pDoc->GetValue(ScAddress(0, r, 0)));
-    }
-
-    // nothing else was sorted
-    CPPUNIT_ASSERT_EQUAL(double(1), pDoc->GetValue(ScAddress(1, 0, 0)));
-    CPPUNIT_ASSERT_EQUAL(double(3), pDoc->GetValue(ScAddress(1, 1, 0)));
-    CPPUNIT_ASSERT_EQUAL(double(2), pDoc->GetValue(ScAddress(1, 2, 0)));
-}
-
 void ScTiledRenderingTest::testPartHash()
 {
     comphelper::LibreOfficeKit::setActive();
@@ -2381,6 +2345,57 @@ void ScTiledRenderingTest::testPasteIntoWrapTextCell()
     SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr);
 }
 
+void ScTiledRenderingTest::testSortAscendingDescending()
+{
+    comphelper::LibreOfficeKit::setActive();
+    comphelper::LibreOfficeKit::setCompatFlag(
+        comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs);
+    ScModelObj* pModelObj = createDoc("sort-range.ods");
+    ScDocument* pDoc = pModelObj->GetDocument();
+
+    ViewCallback aView;
+    SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView);
+
+    // select the values in the first column
+    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, 551, 129, 1, MOUSE_LEFT, 0);
+    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, 820, 1336, 1, MOUSE_LEFT, 0);
+    pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, 820, 1359, 1, MOUSE_LEFT, 0);
+    Scheduler::ProcessEventsToIdle();
+    aView.m_sInvalidateSheetGeometry = "";
+
+    // sort ascending
+    uno::Sequence<beans::PropertyValue> aArgs;
+    comphelper::dispatchCommand(".uno:SortAscending", aArgs);
+
+    // check it's sorted
+    for (SCROW r = 0; r < 6; ++r)
+    {
+        CPPUNIT_ASSERT_EQUAL(double(r + 1), pDoc->GetValue(ScAddress(0, r, 0)));
+    }
+
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT_EQUAL(OString("rows"), aView.m_sInvalidateSheetGeometry);
+
+    aView.m_sInvalidateSheetGeometry = "";
+    // sort descending
+    comphelper::dispatchCommand(".uno:SortDescending", aArgs);
+
+    // check it's sorted
+    for (SCROW r = 0; r < 6; ++r)
+    {
+        CPPUNIT_ASSERT_EQUAL(double(6 - r), pDoc->GetValue(ScAddress(0, r, 0)));
+    }
+
+    // nothing else was sorted
+    CPPUNIT_ASSERT_EQUAL(double(1), pDoc->GetValue(ScAddress(1, 0, 0)));
+    CPPUNIT_ASSERT_EQUAL(double(3), pDoc->GetValue(ScAddress(1, 1, 0)));
+    CPPUNIT_ASSERT_EQUAL(double(2), pDoc->GetValue(ScAddress(1, 2, 0)));
+
+    Scheduler::ProcessEventsToIdle();
+    CPPUNIT_ASSERT_EQUAL(OString("rows"), aView.m_sInvalidateSheetGeometry);
+}
+
+
 }
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest);


More information about the Libreoffice-commits mailing list