summaryrefslogtreecommitdiff
path: root/sc/qa/unit/uicalc
diff options
context:
space:
mode:
authorscito <info@scito.ch>2021-04-21 07:36:43 +0200
committerJan Holesovsky <kendy@collabora.com>2021-04-22 15:11:17 +0200
commit6491c205acb3c166d93ef6a41199d344e21d98ac (patch)
tree7f272b39ad7afdc1fc18d86613eb935a1495850b /sc/qa/unit/uicalc
parent75213d163b53e7002404c26fcd9cd63776a53eae (diff)
tdf#107348 tdf#45958 tdf#141215 tdf#141683 fix filtered/transpose paste
Row filtering, Special Paste transposing and multi range selections had various issues. Since the same methods are used in different code paths, I made a unified fix for these issues. Moreover, Special Paste dialog allows the combination of options. There are about 50 test cases for these various combinations of filtering, selection, transposing and pasting options. The following cases are supported and checked in test combinations: * Transposing * Filtering * Multi range column and row selection * All cell types: number, string, formula, rich text, empty * Notes * Formatting patterns (e.g. cell backgrounds and borders) * Empty cell skipping * Special Paste as link * Merged cells * Formula references: * Relative and absolute references * References to rows before and after filtered row * References to filtered row * Double references (e.g. A1:A3) Notably the following cases are fixed and tested: * Transposing of filtered data (tdf#107348) * Copy/Paste of filtered multi range selections (tdf#45958) * Transposing of filtered multi range selections (tdf#107348, tdf#45958) * Notes at different position (tdf#141215 ^) * Transposed multi range selection pasted as link (tdf#141683 ^) ^ = discovered during tests Due to the unit tests, I refactored some code. Mainly, I extracted methods to improve the readability and to avoid code duplication. Change-Id: Iccccd17d3b4deee29ac5fc7c11e17244da0d4054 Change-Id: I43cf630890e0081e55fd04cf2f8e5afdb6d9bebe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114450 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'sc/qa/unit/uicalc')
-rwxr-xr-x[-rw-r--r--]sc/qa/unit/uicalc/uicalc.cxx45
1 files changed, 45 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index e42465402749..9ada6b120354 100644..100755
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -464,6 +464,51 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706)
CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 2, 0)));
}
+// Inspired from testTdf117706, test columns instad of rows
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMultiRangeCol)
+{
+ mxComponent = loadFromDesktop("private:factory/scalc");
+ ScModelObj* pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ ScDocument* pDoc = pModelObj->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ insertStringToCell(*pModelObj, "A1", "A1");
+ insertStringToCell(*pModelObj, "C1", "C1");
+
+ // Use Adding Selection
+ dispatchCommand(mxComponent, ".uno:StatusSelectionModeExp", {});
+ Scheduler::ProcessEventsToIdle();
+
+ goToCell("A1");
+ dispatchCommand(mxComponent, ".uno:SelectColumn", {});
+ Scheduler::ProcessEventsToIdle();
+
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+ dispatchCommand(mxComponent, ".uno:GoRight", {});
+ lcl_AssertCurrentCursorPosition(2, 0);
+
+ dispatchCommand(mxComponent, ".uno:SelectColumn", {});
+ Scheduler::ProcessEventsToIdle();
+
+ dispatchCommand(mxComponent, ".uno:Copy", {});
+
+ mxComponent->dispose();
+
+ // Open a new document
+ mxComponent = loadFromDesktop("private:factory/scalc");
+ pModelObj = dynamic_cast<ScModelObj*>(mxComponent.get());
+ CPPUNIT_ASSERT(pModelObj);
+ pDoc = pModelObj->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+
+ dispatchCommand(mxComponent, ".uno:Paste", {});
+
+ CPPUNIT_ASSERT_EQUAL(OUString("A1"), pDoc->GetString(ScAddress(0, 0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("C1"), pDoc->GetString(ScAddress(1, 0, 0)));
+ CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(2, 0, 0)));
+}
+
CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131442)
{
mxComponent = loadFromDesktop("private:factory/scalc");