summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-01-20 11:15:04 +0530
committerJan Holesovsky <kendy@collabora.com>2021-01-21 09:39:03 +0100
commitf37ce0a08bc73d4d1e3cdee6553e637bd965ec1e (patch)
tree21120f961b7f1de6d82f7e01e856a5b98e0612cb
parentf50e11c55e05506bba2c1a895f13d1a90ac54505 (diff)
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@gmail.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering.cxx93
1 files changed, 54 insertions, 39 deletions
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);