sc/qa/unit/tiledrendering/tiledrendering.cxx | 93 +++++++++++++++------------ 1 file changed, 54 insertions(+), 39 deletions(-)
New commits: commit fbafc005e8beafa62a44ced467b342233caf746e Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Wed Jan 20 11:15:04 2021 +0530 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Fri Jan 22 11:15:13 2021 +0100 unit test: check for row height invalidations on sort Change-Id: I5b4e690c48583dcb609eb139ef2bf8e62d146d30 (cherry picked from commit 89ce9c72e332b141882d92e809fbc10121aee9a5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109693 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index bc91dd9608fa..1d883f0e4a95 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -69,7 +69,6 @@ public: void testRowColumnHeaders(); void testRowColumnSelections(); - void testSortAscendingDescending(); void testPartHash(); void testDocumentSize(); void testEmptyColumnSelection(); @@ -112,11 +111,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); @@ -159,6 +159,7 @@ public: CPPUNIT_TEST(testSpellOnlineParameter); CPPUNIT_TEST(testSpellOnlineRenderParameter); CPPUNIT_TEST(testPasteIntoWrapTextCell); + CPPUNIT_TEST(testSortAscendingDescending); CPPUNIT_TEST_SUITE_END(); private: @@ -355,43 +356,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(); @@ -2378,6 +2342,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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits