sc/qa/unit/helper/qahelper.cxx | 31 +++++++++++++++++- sc/qa/unit/helper/qahelper.hxx | 2 + sc/qa/unit/scshapetest.cxx | 13 ------- sc/qa/unit/uicalc/uicalc.cxx | 57 ++++++++++++--------------------- sc/qa/unit/uicalc/uicalc2.cxx | 70 ++++++++++++----------------------------- 5 files changed, 76 insertions(+), 97 deletions(-)
New commits: commit 5b98e71f4d3948a9e66efb1eecace46fa8843a96 Author: Xisco Fauli <[email protected]> AuthorDate: Wed Nov 26 12:25:11 2025 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Wed Nov 26 15:33:46 2025 +0100 sc/qa: factor out common code Change-Id: I7dad3aa4c8cac149ec04d68fac7a813788c44973 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194623 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> Code-Style: Xisco Fauli <[email protected]> diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index 96ce54695703..10ede9876731 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -27,15 +27,17 @@ #include <editeng/justifyitem.hxx> #include <clipcontext.hxx> #include <clipparam.hxx> +#include <rangeutl.hxx> #include <refundo.hxx> #include <sal/log.hxx> #include <svl/gridprinter.hxx> #include <sfx2/docfile.hxx> -#include <undoblk.hxx> #include <scdll.hxx> #include <scitems.hxx> #include <stringutil.hxx> +#include <tabvwsh.hxx> #include <tokenarray.hxx> +#include <undoblk.hxx> #include <vcl/keycodes.hxx> #include <vcl/scheduler.hxx> #include <o3tl/safeint.hxx> @@ -354,6 +356,33 @@ void ScModelTestBase::executeAutoSum() Scheduler::ProcessEventsToIdle(); } +void ScModelTestBase::selectObjectByName(std::u16string_view rObjName) +{ + ScTabViewShell* pViewShell = getViewShell(); + bool bFound = pViewShell->SelectObject(rObjName); + CPPUNIT_ASSERT_MESSAGE( + OString(OUStringToOString(rObjName, RTL_TEXTENCODING_UTF8) + " not found.").getStr(), + bFound); + + CPPUNIT_ASSERT(pViewShell->GetViewData().GetScDrawView()->GetMarkedObjectList().GetMarkCount() + != 0); +} + +void ScModelTestBase::checkCurrentCursorPosition(ScDocShell& rDocSh, std::u16string_view rStr) +{ + ScAddress aAddr; + sal_Int32 nOffset = 0; + ScRangeStringConverter::GetAddressFromString(aAddr, rStr, rDocSh.GetDocument(), + formula::FormulaGrammar::CONV_OOO, nOffset); + ScTabViewShell* pViewShell = rDocSh.GetBestViewShell(false); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + OUString(OUString::Concat("Incorrect Column in position ") + rStr).toUtf8().getStr(), + aAddr.Col(), pViewShell->GetViewData().GetCurX()); + CPPUNIT_ASSERT_EQUAL_MESSAGE( + OUString(OUString::Concat("Incorrect Row in position ") + rStr).toUtf8().getStr(), + aAddr.Row(), pViewShell->GetViewData().GetCurY()); +} + const SdrOle2Obj* ScModelTestBase::getSingleOleObject(ScDocument& rDoc, sal_uInt16 nPage) { // Retrieve the chart object instance from the 2nd page (for the 2nd sheet). diff --git a/sc/qa/unit/helper/qahelper.hxx b/sc/qa/unit/helper/qahelper.hxx index dfb9d0625cac..b45decb32d2c 100644 --- a/sc/qa/unit/helper/qahelper.hxx +++ b/sc/qa/unit/helper/qahelper.hxx @@ -190,6 +190,8 @@ public: void insertArrayToCell(const OUString& rCell, std::u16string_view rStr); void insertNewSheet(ScDocument& rDoc); void executeAutoSum(); + void selectObjectByName(std::u16string_view rObjName); + void checkCurrentCursorPosition(ScDocShell& rDocSh, std::u16string_view rStr); private: // Why is this here and not in osl, and using the already existing file diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx index ad4ac04a0996..2d2b8c9fc78a 100644 --- a/sc/qa/unit/scshapetest.cxx +++ b/sc/qa/unit/scshapetest.cxx @@ -79,17 +79,6 @@ static SdrObject* lcl_getSdrObjectbyName(ScDocument& rDoc, std::u16string_view r return pObj; } -static void lcl_SelectObjectByName(ScTabViewShell& rViewShell, std::u16string_view rObjName) -{ - bool bFound = rViewShell.SelectObject(rObjName); - CPPUNIT_ASSERT_MESSAGE( - OString(OUStringToOString(rObjName, RTL_TEXTENCODING_UTF8) + " not found.").getStr(), - bFound); - - CPPUNIT_ASSERT(rViewShell.GetViewData().GetScDrawView()->GetMarkedObjectList().GetMarkCount() - != 0); -} - CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf144242_OpenBezier_noSwapWH) { // Shapes, which have rotation incorporated in their points, got erroneously width-height @@ -1399,7 +1388,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf140866) CPPUNIT_ASSERT_EQUAL(u"Test 1"_ustr, pNote->GetText()); goToCell(u"$Sheet2.$B$11"_ustr); - lcl_SelectObjectByName(*getViewShell(), u"Shape 1"); + selectObjectByName(u"Shape 1"); // Copy and paste dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 697d6b6df0a5..7a346726dfa0 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -45,21 +45,6 @@ ScUiCalcTest::ScUiCalcTest() { } -static void lcl_AssertCurrentCursorPosition(ScDocShell& rDocSh, std::u16string_view rStr) -{ - ScAddress aAddr; - sal_Int32 nOffset = 0; - ScRangeStringConverter::GetAddressFromString(aAddr, rStr, rDocSh.GetDocument(), - formula::FormulaGrammar::CONV_OOO, nOffset); - ScTabViewShell* pViewShell = rDocSh.GetBestViewShell(false); - CPPUNIT_ASSERT_EQUAL_MESSAGE( - OUString(OUString::Concat("Incorrect Column in position ") + rStr).toUtf8().getStr(), - aAddr.Col(), pViewShell->GetViewData().GetCurX()); - CPPUNIT_ASSERT_EQUAL_MESSAGE( - OUString(OUString::Concat("Incorrect Row in position ") + rStr).toUtf8().getStr(), - aAddr.Row(), pViewShell->GetViewData().GetCurY()); -} - CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf142854_GridVisibilityImportXlsxInHeadlessMode) { // Tests are running in Headless mode @@ -1305,7 +1290,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf140151) Scheduler::ProcessEventsToIdle(); // Without the fix in place, the current cursor position wouldn't have changed - lcl_AssertCurrentCursorPosition(*pDocSh, u"B111"); + checkCurrentCursorPosition(*pDocSh, u"B111"); } #endif @@ -1321,13 +1306,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf68290) ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent); for (const auto& rAddress : aExpectedAddresses) { - lcl_AssertCurrentCursorPosition(*pDocSh, rAddress); + checkCurrentCursorPosition(*pDocSh, rAddress); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); } - lcl_AssertCurrentCursorPosition(*pDocSh, u"M3"); + checkCurrentCursorPosition(*pDocSh, u"M3"); } CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf156462) @@ -1335,14 +1320,14 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf156462) createScDoc("tdf156462.ods"); ScDocShell* pDocSh = getScDocShell(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"G2"); + checkCurrentCursorPosition(*pDocSh, u"G2"); ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | KEY_LEFT); Scheduler::ProcessEventsToIdle(); // Without the fix in place, the cursor would have jumped to cell C2 - lcl_AssertCurrentCursorPosition(*pDocSh, u"D2"); + checkCurrentCursorPosition(*pDocSh, u"D2"); } CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132057) @@ -1350,14 +1335,14 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132057) createScDoc("tdf132057.ods"); ScDocShell* pDocSh = getScDocShell(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"AU43"); + checkCurrentCursorPosition(*pDocSh, u"AU43"); ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RETURN); Scheduler::ProcessEventsToIdle(); // Without the fix in place, the cursor would have jumped to cell BM1 - lcl_AssertCurrentCursorPosition(*pDocSh, u"G39"); + checkCurrentCursorPosition(*pDocSh, u"G39"); } CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf122232) @@ -1366,18 +1351,18 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf122232) ScDocShell* pDocSh = getScDocShell(); //Start with from C6. Press tabulator to reach G6. - lcl_AssertCurrentCursorPosition(*pDocSh, u"C6"); + checkCurrentCursorPosition(*pDocSh, u"C6"); ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_TAB); Scheduler::ProcessEventsToIdle(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"G6"); + checkCurrentCursorPosition(*pDocSh, u"G6"); //without the fix, cursor would jump to C29 instead of C7. pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"C7"); + checkCurrentCursorPosition(*pDocSh, u"C7"); } CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf123052) @@ -1395,7 +1380,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf123052) pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); Scheduler::ProcessEventsToIdle(); - lcl_AssertCurrentCursorPosition(*pDocSh, rAddress); + checkCurrentCursorPosition(*pDocSh, rAddress); } aExpectedAddresses.pop_back(); @@ -1408,7 +1393,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf123052) Scheduler::ProcessEventsToIdle(); // Without the fix in place, this test would have failed here - lcl_AssertCurrentCursorPosition(*pDocSh, *it); + checkCurrentCursorPosition(*pDocSh, *it); } } @@ -1471,7 +1456,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146994) ScDocShell* pDocSh = getScDocShell(); goToCell(u"B3"_ustr); - lcl_AssertCurrentCursorPosition(*pDocSh, u"B3"); + checkCurrentCursorPosition(*pDocSh, u"B3"); dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); @@ -1480,7 +1465,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146994) pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT); Scheduler::ProcessEventsToIdle(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"D3"); + checkCurrentCursorPosition(*pDocSh, u"D3"); dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); @@ -1686,7 +1671,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117706) dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A3"); + checkCurrentCursorPosition(*pDocSh, u"A3"); dispatchCommand(mxComponent, u".uno:SelectRow"_ustr, {}); @@ -1830,7 +1815,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMultiRangeCol) dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"C1"); + checkCurrentCursorPosition(*pDocSh, u"C1"); dispatchCommand(mxComponent, u".uno:SelectColumn"_ustr, {}); @@ -2013,7 +1998,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458) ScInputOptions aInputOption = pMod->GetInputOptions(); sal_uInt16 bOldStatus = aInputOption.GetMoveDir(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A1"); + checkCurrentCursorPosition(*pDocSh, u"A1"); aInputOption.SetMoveDir(DIR_BOTTOM); pMod->SetInputOptions(aInputOption); @@ -2022,7 +2007,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458) pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A2"); + checkCurrentCursorPosition(*pDocSh, u"A2"); aInputOption.SetMoveDir(DIR_TOP); pMod->SetInputOptions(aInputOption); @@ -2030,7 +2015,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458) pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A1"); + checkCurrentCursorPosition(*pDocSh, u"A1"); aInputOption.SetMoveDir(DIR_RIGHT); pMod->SetInputOptions(aInputOption); @@ -2038,7 +2023,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458) pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"B1"); + checkCurrentCursorPosition(*pDocSh, u"B1"); aInputOption.SetMoveDir(DIR_LEFT); pMod->SetInputOptions(aInputOption); @@ -2046,7 +2031,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf117458) pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN); Scheduler::ProcessEventsToIdle(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A1"); + checkCurrentCursorPosition(*pDocSh, u"A1"); // Restore previous status aInputOption.SetMoveDir(bOldStatus); diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx index 982825dfdddf..047abf75c1a0 100644 --- a/sc/qa/unit/uicalc/uicalc2.cxx +++ b/sc/qa/unit/uicalc/uicalc2.cxx @@ -48,32 +48,6 @@ ScUiCalcTest2::ScUiCalcTest2() { } -static void lcl_AssertCurrentCursorPosition(ScDocShell& rDocSh, std::u16string_view rStr) -{ - ScAddress aAddr; - sal_Int32 nOffset = 0; - ScRangeStringConverter::GetAddressFromString(aAddr, rStr, rDocSh.GetDocument(), - formula::FormulaGrammar::CONV_OOO, nOffset); - ScTabViewShell* pViewShell = rDocSh.GetBestViewShell(false); - CPPUNIT_ASSERT_EQUAL_MESSAGE( - OUString(OUString::Concat("Incorrect Column in position ") + rStr).toUtf8().getStr(), - aAddr.Col(), pViewShell->GetViewData().GetCurX()); - CPPUNIT_ASSERT_EQUAL_MESSAGE( - OUString(OUString::Concat("Incorrect Row in position ") + rStr).toUtf8().getStr(), - aAddr.Row(), pViewShell->GetViewData().GetCurY()); -} - -static void lcl_SelectObjectByName(ScTabViewShell& rViewShell, std::u16string_view rObjName) -{ - bool bFound = rViewShell.SelectObject(rObjName); - CPPUNIT_ASSERT_MESSAGE( - OString(OUStringToOString(rObjName, RTL_TEXTENCODING_UTF8) + " not found.").getStr(), - bFound); - - CPPUNIT_ASSERT(rViewShell.GetViewData().GetScDrawView()->GetMarkedObjectList().GetMarkCount() - != 0); -} - CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf150499) { createScDoc("tdf150499.xls"); @@ -212,7 +186,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf119793) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1381), xShape->getPosition().Y); // Move the shape to the right - lcl_SelectObjectByName(*getViewShell(), u"Shape 1"); + selectObjectByName(u"Shape 1"); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_RIGHT); Scheduler::ProcessEventsToIdle(); @@ -254,25 +228,25 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf131455) createScDoc("tdf131455-fixed.ods"); ScDocShell* pDocSh = getScDocShell(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A5"); + checkCurrentCursorPosition(*pDocSh, u"A5"); dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"B5"); + checkCurrentCursorPosition(*pDocSh, u"B5"); dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"E5"); + checkCurrentCursorPosition(*pDocSh, u"E5"); dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"F5"); + checkCurrentCursorPosition(*pDocSh, u"F5"); dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"I5"); + checkCurrentCursorPosition(*pDocSh, u"I5"); dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"J5"); + checkCurrentCursorPosition(*pDocSh, u"J5"); dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"M5"); + checkCurrentCursorPosition(*pDocSh, u"M5"); //Cursor can't move forward to the right for (size_t i = 0; i < 5; ++i) { dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"N5"); + checkCurrentCursorPosition(*pDocSh, u"N5"); } CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getViewShell()->GetViewData().CurrentTabForData()); @@ -280,7 +254,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf131455) dispatchCommand(mxComponent, u".uno:JumpToNextTable"_ustr, {}); CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getViewShell()->GetViewData().CurrentTabForData()); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A4"); + checkCurrentCursorPosition(*pDocSh, u"A4"); // Go to row 9 for (size_t i = 0; i < 6; ++i) @@ -288,7 +262,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf131455) dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); } - lcl_AssertCurrentCursorPosition(*pDocSh, u"A10"); + checkCurrentCursorPosition(*pDocSh, u"A10"); dispatchCommand(mxComponent, u".uno:SelectRow"_ustr, {}); dispatchCommand(mxComponent, u".uno:DeleteRows"_ustr, {}); @@ -296,13 +270,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf131455) dispatchCommand(mxComponent, u".uno:JumpToPrevTable"_ustr, {}); CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getViewShell()->GetViewData().CurrentTabForData()); - lcl_AssertCurrentCursorPosition(*pDocSh, u"N5"); + checkCurrentCursorPosition(*pDocSh, u"N5"); //Cursor can't move forward to the right for (size_t i = 0; i < 5; ++i) { dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"N5"); + checkCurrentCursorPosition(*pDocSh, u"N5"); } } @@ -342,7 +316,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf124816) // OFFSET() was changed as of tdf#85551 and here result of that test // document is now Err:502 instead of 0. static constexpr OUString aExpectedResult(u"Err:502"_ustr); - lcl_AssertCurrentCursorPosition(*pDocSh, u"D10"); + checkCurrentCursorPosition(*pDocSh, u"D10"); CPPUNIT_ASSERT_EQUAL(aExpectedResult, pDoc->GetString(ScAddress(3, 9, 0))); //Without the fix, it would crash @@ -492,7 +466,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf159938) dispatchCommand(mxComponent, u".uno:GoDown"_ustr, {}); ScDocShell* pDocSh = getScDocShell(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A4"); + checkCurrentCursorPosition(*pDocSh, u"A4"); CPPUNIT_ASSERT_EQUAL(nCol1Width, pDoc->GetColWidth(0, 0)); CPPUNIT_ASSERT_EQUAL(nCol2Width, pDoc->GetColWidth(1, 0)); CPPUNIT_ASSERT_EQUAL(nRow1Height, pDoc->GetRowHeight(0, 0)); @@ -513,7 +487,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf83901) ScDocument* pDoc = getScDoc(); CPPUNIT_ASSERT_EQUAL(3.0, pDoc->GetValue(ScAddress(0, 1, 0))); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A3"); + checkCurrentCursorPosition(*pDocSh, u"A3"); dispatchCommand(mxComponent, u".uno:SelectRow"_ustr, {}); dispatchCommand(mxComponent, u".uno:InsertRowsBefore"_ustr, {}); @@ -685,7 +659,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf138428) dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); dispatchCommand(mxComponent, u".uno:GoRight"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"B1"); + checkCurrentCursorPosition(*pDocSh, u"B1"); dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); @@ -726,7 +700,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf136113) CPPUNIT_ASSERT_EQUAL(tools::Long(18142), pObj->GetSnapRect().Left()); CPPUNIT_ASSERT_EQUAL(tools::Long(1709), pObj->GetSnapRect().Top()); - lcl_SelectObjectByName(*getViewShell(), u"Arrow"); + selectObjectByName(u"Arrow"); // Move the shape up ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>(mxComponent); @@ -747,7 +721,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf130614) createScDoc("tdf130614.ods"); ScDocument* pDoc = getScDoc(); - lcl_SelectObjectByName(*getViewShell(), u"Object 1"); + selectObjectByName(u"Object 1"); dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); @@ -1117,13 +1091,13 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf107952) // - Expected: 1 // - Actual : 3 // - Incorrect Column in position B1 - lcl_AssertCurrentCursorPosition(*pDocSh, u"B1"); + checkCurrentCursorPosition(*pDocSh, u"B1"); goToCell(u"D10"_ustr); dispatchCommand(mxComponent, u".uno:Redo"_ustr, {}); - lcl_AssertCurrentCursorPosition(*pDocSh, u"B1"); + checkCurrentCursorPosition(*pDocSh, u"B1"); } CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf150766) @@ -1663,7 +1637,7 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf140027) goToCell(u"A1"_ustr); ScDocShell* pDocSh = getScDocShell(); - lcl_AssertCurrentCursorPosition(*pDocSh, u"A1"); + checkCurrentCursorPosition(*pDocSh, u"A1"); dispatchCommand(mxComponent, u".uno:SelectRow"_ustr, {}); dispatchCommand(mxComponent, u".uno:InsertRowsBefore"_ustr, {});
