diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-13 16:44:15 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-08-16 15:53:02 +0200 |
commit | 581b2cf7960c48e6199bd35be839424113abe533 (patch) | |
tree | 5f5d0f4cf0be4d134804cea9738460e92a61e11c /sd/qa/unit/tiledrendering | |
parent | 76f89b0097c02fa68c36cfc9a31de3b2e9166abc (diff) |
Drop tools::Rectangle::getX/getY, which are just duplicates of Left/Top
The change allowed to simplify many places where previously this API was
used, to avoid inefficient calculations (e.g., moving rectangle keeping
its size, and then immediately changing the size).
Change-Id: Ica2dc594d91cae83e2c2740c1f4fb23f44998916
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120461
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/qa/unit/tiledrendering')
-rw-r--r-- | sd/qa/unit/tiledrendering/CallbackRecorder.hxx | 4 | ||||
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 48 |
2 files changed, 26 insertions, 26 deletions
diff --git a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx index 7e6c8a42d07d..b3cd21fb3643 100644 --- a/sd/qa/unit/tiledrendering/CallbackRecorder.hxx +++ b/sd/qa/unit/tiledrendering/CallbackRecorder.hxx @@ -37,8 +37,8 @@ void lcl_convertRectangle(const OUString& rString, tools::Rectangle& rRectangle) { uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(rString); CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); - rRectangle.setX(aSeq[0].toInt32()); - rRectangle.setY(aSeq[1].toInt32()); + rRectangle.SetLeft(aSeq[0].toInt32()); + rRectangle.SetTop(aSeq[1].toInt32()); rRectangle.setWidth(aSeq[2].toInt32()); rRectangle.setHeight(aSeq[3].toInt32()); } diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 156c52f7b066..1ed951437ba1 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -293,8 +293,8 @@ void lcl_convertRectangle(const OUString& rString, ::tools::Rectangle& rRectangl { uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(rString); CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); - rRectangle.setX(aSeq[0].toInt32()); - rRectangle.setY(aSeq[1].toInt32()); + rRectangle.SetLeft(aSeq[0].toInt32()); + rRectangle.SetTop(aSeq[1].toInt32()); rRectangle.setWidth(aSeq[2].toInt32()); rRectangle.setHeight(aSeq[3].toInt32()); } @@ -941,8 +941,8 @@ public: uno::Sequence<OUString> aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); CPPUNIT_ASSERT(aSeq.getLength() == 4 || aSeq.getLength() == 5); tools::Rectangle aInvalidationRect; - aInvalidationRect.setX(aSeq[0].toInt32()); - aInvalidationRect.setY(aSeq[1].toInt32()); + aInvalidationRect.SetLeft(aSeq[0].toInt32()); + aInvalidationRect.SetTop(aSeq[1].toInt32()); aInvalidationRect.setWidth(aSeq[2].toInt32()); aInvalidationRect.setHeight(aSeq[3].toInt32()); m_aInvalidations.push_back(aInvalidationRect); @@ -1131,8 +1131,8 @@ void SdTiledRenderingTest::testCursorVisibility_SingleClick() // Click once outside of the text (in the first quartile) => no editing. const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect(); - const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100); - const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100); + const auto cornerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 4), o3tl::Length::mm100); + const auto cornerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 4), o3tl::Length::mm100); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, cornerX, cornerY, 1, MOUSE_LEFT, 0); @@ -1146,8 +1146,8 @@ void SdTiledRenderingTest::testCursorVisibility_SingleClick() CPPUNIT_ASSERT(!aView1.m_bCursorVisible); // Click again, now on the text, in the center, to start editing. - const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100); - const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100); + const auto centerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 2), o3tl::Length::mm100); + const auto centerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 2), o3tl::Length::mm100); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, centerX, centerY, 1, MOUSE_LEFT, 0); @@ -1180,8 +1180,8 @@ void SdTiledRenderingTest::testCursorVisibility_DoubleClick() // Double-click outside the text to enter edit mode. const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect(); - const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100); - const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100); + const auto cornerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 4), o3tl::Length::mm100); + const auto cornerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 4), o3tl::Length::mm100); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, cornerX, cornerY, 2, MOUSE_LEFT, 0); @@ -1224,8 +1224,8 @@ void SdTiledRenderingTest::testCursorVisibility_MultiView() SfxLokHelper::setView(nView1); ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect(); - const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100); - const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100); + const auto centerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 2), o3tl::Length::mm100); + const auto centerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 2), o3tl::Length::mm100); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, centerX, centerY, 2, MOUSE_LEFT, 0); @@ -1260,8 +1260,8 @@ void SdTiledRenderingTest::testCursorVisibility_Escape() // Click once on the text to start editing. const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect(); - const auto centerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 2), o3tl::Length::mm100); - const auto centerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 2), o3tl::Length::mm100); + const auto centerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 2), o3tl::Length::mm100); + const auto centerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 2), o3tl::Length::mm100); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, centerX, centerY, 1, MOUSE_LEFT, 0); @@ -1441,10 +1441,10 @@ void SdTiledRenderingTest::testTdf102223() // select contents of cell ::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect(); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, - o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100), + o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), 1, MOUSE_LEFT, 0); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, - o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100), + o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), 1, MOUSE_LEFT, 0); Scheduler::ProcessEventsToIdle(); pView->SdrBeginTextEdit(pTableObject); @@ -1484,10 +1484,10 @@ void SdTiledRenderingTest::testTdf118354() // Without the fix, it would crash here ::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect(); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, - o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100), + o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), 1, MOUSE_LEFT, 0); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, - o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100), + o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), 1, MOUSE_LEFT, 0); Scheduler::ProcessEventsToIdle(); @@ -1554,10 +1554,10 @@ void SdTiledRenderingTest::testTdf103083() // select contents of bullet item ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect(); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, - o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100), + o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), 1, MOUSE_LEFT, 0); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, - o3tl::toTwips(aRect.getX() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.getY() + 2, o3tl::Length::mm100), + o3tl::toTwips(aRect.Left() + 2, o3tl::Length::mm100), o3tl::toTwips(aRect.Top() + 2, o3tl::Length::mm100), 1, MOUSE_LEFT, 0); Scheduler::ProcessEventsToIdle(); pView->SdrBeginTextEdit(pTextObject); @@ -1643,10 +1643,10 @@ void SdTiledRenderingTest::testTdf104405() rEditView2.SetSelection(ESelection(0, 0, 0, 3)); // start para, start char, end para, end char. ::tools::Rectangle aRect = pTableObject->GetCurrentBoundRect(); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, - o3tl::toTwips(aRect.getX(), o3tl::Length::mm100), o3tl::toTwips(aRect.getY(), o3tl::Length::mm100), + o3tl::toTwips(aRect.Left(), o3tl::Length::mm100), o3tl::toTwips(aRect.Top(), o3tl::Length::mm100), 1, MOUSE_LEFT, 0); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, - o3tl::toTwips(aRect.getX(), o3tl::Length::mm100), o3tl::toTwips(aRect.getY(), o3tl::Length::mm100), + o3tl::toTwips(aRect.Left(), o3tl::Length::mm100), o3tl::toTwips(aRect.Top(), o3tl::Length::mm100), 1, MOUSE_LEFT, 0); Scheduler::ProcessEventsToIdle(); @@ -2025,8 +2025,8 @@ void SdTiledRenderingTest::testMultiViewInsertDeletePage2() // Double-click outside the text to enter edit mode. const ::tools::Rectangle aRect = pTextObject->GetCurrentBoundRect(); - const auto cornerX = o3tl::toTwips(aRect.getX() + (aRect.getWidth() / 4), o3tl::Length::mm100); - const auto cornerY = o3tl::toTwips(aRect.getY() + (aRect.getHeight() / 4), o3tl::Length::mm100); + const auto cornerX = o3tl::toTwips(aRect.Left() + (aRect.getWidth() / 4), o3tl::Length::mm100); + const auto cornerY = o3tl::toTwips(aRect.Top() + (aRect.getHeight() / 4), o3tl::Length::mm100); pXImpressDocument->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, cornerX, cornerY, 2, MOUSE_LEFT, 0); |