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

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 21 08:39:43 UTC 2021


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

New commits:
commit f37ce0a08bc73d4d1e3cdee6553e637bd965ec1e
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Wed Jan 20 11:15:04 2021 +0530
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Thu Jan 21 09:39:03 2021 +0100

    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>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 6eac84624142..158754d51ffc 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -71,7 +71,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);
@@ -163,6 +163,7 @@ public:
     CPPUNIT_TEST(testSpellOnlineParameter);
     CPPUNIT_TEST(testSpellOnlineRenderParameter);
     CPPUNIT_TEST(testPasteIntoWrapTextCell);
+    CPPUNIT_TEST(testSortAscendingDescending);
     CPPUNIT_TEST_SUITE_END();
 
 private:
@@ -359,43 +360,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();
@@ -2419,6 +2383,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