diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-11-23 11:57:31 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-11-23 15:11:45 +0100 |
commit | b2bfe6c18aeb2530a8d1e1c4336707b1fcd5715a (patch) | |
tree | 147aebc3fd193012fd11deaa7ff326334f8d553d | |
parent | e81845679ea6b30d651f76cc8bddc052a52bd227 (diff) |
tdf#131455: sc_uicalc: Add unittest
Change-Id: I3a4960dc8a39c6ab9061aad08e6d3cb1c5c74bce
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106403
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/unit/uicalc/data/tdf131455.ods | bin | 0 -> 33222 bytes | |||
-rw-r--r-- | sc/qa/unit/uicalc/uicalc.cxx | 61 |
2 files changed, 61 insertions, 0 deletions
diff --git a/sc/qa/unit/uicalc/data/tdf131455.ods b/sc/qa/unit/uicalc/data/tdf131455.ods Binary files differnew file mode 100644 index 000000000000..f4d8bca66375 --- /dev/null +++ b/sc/qa/unit/uicalc/data/tdf131455.ods diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index b7581fdb0c37..725e1c7c48dc 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -151,6 +151,67 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf133326) CPPUNIT_ASSERT_EQUAL(static_cast<SCTAB>(2), pDoc->GetTableCount()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455) +{ + ScModelObj* pModelObj = createDoc("tdf131455.ods"); + ScDocument* pDoc = pModelObj->GetDocument(); + CPPUNIT_ASSERT(pDoc); + + checkCurrentCell(0, 4); + dispatchCommand(mxComponent, ".uno:GoRight", {}); + checkCurrentCell(1, 4); + dispatchCommand(mxComponent, ".uno:GoRight", {}); + checkCurrentCell(4, 4); + dispatchCommand(mxComponent, ".uno:GoRight", {}); + checkCurrentCell(5, 4); + dispatchCommand(mxComponent, ".uno:GoRight", {}); + checkCurrentCell(8, 4); + dispatchCommand(mxComponent, ".uno:GoRight", {}); + checkCurrentCell(9, 4); + dispatchCommand(mxComponent, ".uno:GoRight", {}); + checkCurrentCell(12, 4); + + //Cursor can't move forward to the right + for (size_t i = 0; i < 5; ++i) + { + dispatchCommand(mxComponent, ".uno:GoRight", {}); + checkCurrentCell(13, 4); + } + + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), ScDocShell::GetViewData()->GetTabNo()); + + dispatchCommand(mxComponent, ".uno:JumpToNextTable", {}); + + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), ScDocShell::GetViewData()->GetTabNo()); + checkCurrentCell(0, 3); + + // Go to row 9 + for (size_t i = 0; i < 6; ++i) + { + dispatchCommand(mxComponent, ".uno:GoDown", {}); + } + + checkCurrentCell(0, 9); + + dispatchCommand(mxComponent, ".uno:SelectRow", {}); + dispatchCommand(mxComponent, ".uno:DeleteRows", {}); + + dispatchCommand(mxComponent, ".uno:JumpToPrevTable", {}); + + CPPUNIT_ASSERT_EQUAL(sal_Int16(0), ScDocShell::GetViewData()->GetTabNo()); + checkCurrentCell(13, 4); + + // Cursor can't move forward to the right + // Without the fix in place, this test would have failed with + // - Expected: 13 + // - Actual : 64 + for (size_t i = 0; i < 5; ++i) + { + dispatchCommand(mxComponent, ".uno:GoRight", {}); + checkCurrentCell(13, 4); + } +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126904) { ScModelObj* pModelObj = createDoc("tdf126904.ods"); |