dev/null |binary sc/qa/unit/uicalc/data/tdf131455-fixed.ods |binary sc/qa/unit/uicalc/uicalc.cxx | 35 ++--------------------------- sc/source/ui/view/tabview2.cxx | 2 - 4 files changed, 4 insertions(+), 33 deletions(-)
New commits: commit 1e7be382b1f400801d350067e4dfd40d4cfd2db3 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Mon Mar 7 18:52:33 2022 +0100 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Tue Mar 8 11:27:21 2022 +0100 revert/fix the incorrect fix for tdf#126904 The default cell style has protection turned off. That means that any cells that do not have a style that turns the protection on are actually not protected. So the original code was correct, it went beyond the cells explicitly saved in the file and the first "default" cell was not protected, so it was ok to jump there. Re-saving this document to xlsx and opening it in Excel has the same result. So revert the change. Keep the test, but edit the test file to actually protect cells in the default cell style too, as that way it's actually useful as a test of protected cells. And since the test for tdf#126904 is a subset of basically the same test for the same "bug" tdf#131455, keep only the larger test. Change-Id: I36f21c33aaf5a31e95aa29d616c6abdec17fcf42 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131126 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/sc/qa/unit/uicalc/data/tdf126904.ods b/sc/qa/unit/uicalc/data/tdf126904.ods deleted file mode 100644 index 0f2cf05132c4..000000000000 Binary files a/sc/qa/unit/uicalc/data/tdf126904.ods and /dev/null differ diff --git a/sc/qa/unit/uicalc/data/tdf131455-fixed.ods b/sc/qa/unit/uicalc/data/tdf131455-fixed.ods new file mode 100644 index 000000000000..08e02804bf1b Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf131455-fixed.ods differ diff --git a/sc/qa/unit/uicalc/data/tdf131455.ods b/sc/qa/unit/uicalc/data/tdf131455.ods deleted file mode 100644 index f4d8bca66375..000000000000 Binary files a/sc/qa/unit/uicalc/data/tdf131455.ods and /dev/null differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 00f966e2685d..682a2d13ab81 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -1391,7 +1391,9 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119793) CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455) { - ScModelObj* pModelObj = createDoc("tdf131455.ods"); + // Note that tdf#131455 and tdf#126904 were actually incorrect, + // but keep the test with a fixed version of the document. + ScModelObj* pModelObj = createDoc("tdf131455-fixed.ods"); ScDocument* pDoc = pModelObj->GetDocument(); CPPUNIT_ASSERT(pDoc); @@ -1439,37 +1441,6 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf131455) CPPUNIT_ASSERT_EQUAL(sal_Int16(0), ScDocShell::GetViewData()->GetTabNo()); lcl_AssertCurrentCursorPosition(*pDoc, "N5"); - // 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", {}); - lcl_AssertCurrentCursorPosition(*pDoc, "N5"); - } -} - -CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf126904) -{ - ScModelObj* pModelObj = createDoc("tdf126904.ods"); - ScDocument* pDoc = pModelObj->GetDocument(); - CPPUNIT_ASSERT(pDoc); - - lcl_AssertCurrentCursorPosition(*pDoc, "A5"); - dispatchCommand(mxComponent, ".uno:GoRight", {}); - lcl_AssertCurrentCursorPosition(*pDoc, "B5"); - dispatchCommand(mxComponent, ".uno:GoRight", {}); - lcl_AssertCurrentCursorPosition(*pDoc, "E5"); - dispatchCommand(mxComponent, ".uno:GoRight", {}); - lcl_AssertCurrentCursorPosition(*pDoc, "F5"); - dispatchCommand(mxComponent, ".uno:GoRight", {}); - lcl_AssertCurrentCursorPosition(*pDoc, "I5"); - dispatchCommand(mxComponent, ".uno:GoRight", {}); - lcl_AssertCurrentCursorPosition(*pDoc, "J5"); - dispatchCommand(mxComponent, ".uno:GoRight", {}); - lcl_AssertCurrentCursorPosition(*pDoc, "M5"); - //Cursor can't move forward to the right for (size_t i = 0; i < 5; ++i) { diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 859dc530f797..a2c8c5e71e47 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -739,7 +739,7 @@ void ScTabView::SkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL nOldX, SC bool bSkipCell = false; bool bHFlip = false; - auto nMaxCol = rDoc.ClampToAllocatedColumns(nTab, rDoc.MaxCol()); + auto nMaxCol = rDoc.MaxCol(); do { bSkipCell = rDoc.ColHidden(rCurX, nTab) || rDoc.IsHorOverlapped(rCurX, rCurY, nTab);