sw/qa/extras/snaptogrid/snaptogrid.cxx | 57 +++++++++++++++++---------------- 1 file changed, 30 insertions(+), 27 deletions(-)
New commits: commit 86035d36c12bcd81bfde2d8e562d0a001b3b279b Author: Tamás Zolnai <[email protected]> AuthorDate: Thu Oct 9 11:25:09 2025 +0200 Commit: Tamás Zolnai <[email protected]> CommitDate: Thu Oct 9 11:26:09 2025 +0200 Make unit visible. Change-Id: If5e1385ab3668fc3e2c3871b98fd37c9e5c2e5e0 diff --git a/sw/qa/extras/snaptogrid/snaptogrid.cxx b/sw/qa/extras/snaptogrid/snaptogrid.cxx index ff7cd1b6ce48..a4ff5411dd71 100644 --- a/sw/qa/extras/snaptogrid/snaptogrid.cxx +++ b/sw/qa/extras/snaptogrid/snaptogrid.cxx @@ -43,28 +43,31 @@ protected: BottomRight }; - void applyGridOptions(const bool bSnapToGrid, const sal_Int32 nResolutionX, - const sal_Int32 nResolutionY, const sal_Int32 nSubdivisionX, + void applyGridOptions(const bool bSnapToGrid, const sal_Int32 nResolutionXMm100, + const sal_Int32 nResolutionYMm100, const sal_Int32 nSubdivisionX, const sal_Int32 nSubdivisionY); SdrObject* getShapeObject(const size_t nObjectIndex); - void moveShape(const SdrObject* pObject, const tools::Long nMoveX, const tools::Long nMoveY); - void resizeShape(const SdrObject* pObject, const DragPoint eDragPoint, const tools::Long nMoveX, - const tools::Long nMoveY); - - void checkShapeSize(SdrObject* pObject, const sal_Int32 nWidth, const sal_Int32 nHeight); - void checkShapePosition(SdrObject* pObject, const sal_Int32 nX, const sal_Int32 nY); + void moveShape(const SdrObject* pObject, const tools::Long nMoveXMm100, + const tools::Long nMoveYMm100); + void resizeShape(const SdrObject* pObject, const DragPoint eDragPoint, + const tools::Long nMoveXMm100, const tools::Long nMoveYMm100); + + void checkShapeSize(SdrObject* pObject, const sal_Int32 nWidthMm100, + const sal_Int32 nHeightMm100); + void checkShapePosition(SdrObject* pObject, const sal_Int32 nXMm100, const sal_Int32 nYMm100); }; -void SwSnapToGridTest::applyGridOptions(const bool bSnapToGrid, const sal_Int32 nResolutionX, - const sal_Int32 nResolutionY, const sal_Int32 nSubdivisionX, +void SwSnapToGridTest::applyGridOptions(const bool bSnapToGrid, const sal_Int32 nResolutionXMm100, + const sal_Int32 nResolutionYMm100, + const sal_Int32 nSubdivisionX, const sal_Int32 nSubdivisionY) { std::shared_ptr<comphelper::ConfigurationChanges> pBatch( comphelper::ConfigurationChanges::create()); officecfg::Office::Writer::Grid::Option::SnapToGrid::set(bSnapToGrid, pBatch); - officecfg::Office::Writer::Grid::Resolution::XAxis::set(nResolutionX, pBatch); - officecfg::Office::Writer::Grid::Resolution::YAxis::set(nResolutionY, pBatch); + officecfg::Office::Writer::Grid::Resolution::XAxis::set(nResolutionXMm100, pBatch); + officecfg::Office::Writer::Grid::Resolution::YAxis::set(nResolutionYMm100, pBatch); officecfg::Office::Writer::Grid::Subdivision::XAxis::set(nSubdivisionX, pBatch); officecfg::Office::Writer::Grid::Subdivision::YAxis::set(nSubdivisionY, pBatch); pBatch->commit(); @@ -87,13 +90,13 @@ SdrObject* SwSnapToGridTest::getShapeObject(const size_t nObjectIndex) return pObject; } -void SwSnapToGridTest::moveShape(const SdrObject* pObject, const tools::Long nMoveX, - const tools::Long nMoveY) +void SwSnapToGridTest::moveShape(const SdrObject* pObject, const tools::Long nMoveXMm100, + const tools::Long nMoveYMm100) { CPPUNIT_ASSERT(pObject); - const tools::Long nMoveXTwips = o3tl::toTwips(nMoveX, o3tl::Length::mm100); - const tools::Long nMoveYTwips = o3tl::toTwips(nMoveY, o3tl::Length::mm100); + const tools::Long nMoveXTwips = o3tl::toTwips(nMoveXMm100, o3tl::Length::mm100); + const tools::Long nMoveYTwips = o3tl::toTwips(nMoveYMm100, o3tl::Length::mm100); const tools::Rectangle& rBoundRect = pObject->GetCurrentBoundRect(); Point aFromTwips(rBoundRect.Center()); @@ -114,7 +117,7 @@ void SwSnapToGridTest::moveShape(const SdrObject* pObject, const tools::Long nMo } void SwSnapToGridTest::resizeShape(const SdrObject* pObject, const DragPoint eDragPoint, - const tools::Long nMoveX, const tools::Long nMoveY) + const tools::Long nMoveXMm100, const tools::Long nMoveYMm100) { CPPUNIT_ASSERT(pObject); @@ -147,8 +150,8 @@ void SwSnapToGridTest::resizeShape(const SdrObject* pObject, const DragPoint eDr break; } - const tools::Long nMoveXTwips = o3tl::toTwips(nMoveX, o3tl::Length::mm100); - const tools::Long nMoveYTwips = o3tl::toTwips(nMoveY, o3tl::Length::mm100); + const tools::Long nMoveXTwips = o3tl::toTwips(nMoveXMm100, o3tl::Length::mm100); + const tools::Long nMoveYTwips = o3tl::toTwips(nMoveYMm100, o3tl::Length::mm100); Point aFromTwips(aDragPoint); Point aToTwips(aDragPoint.X() + nMoveXTwips, aDragPoint.Y() + nMoveYTwips); @@ -167,8 +170,8 @@ void SwSnapToGridTest::resizeShape(const SdrObject* pObject, const DragPoint eDr Scheduler::ProcessEventsToIdle(); } -void SwSnapToGridTest::checkShapeSize(SdrObject* pObject, const sal_Int32 nWidth, - const sal_Int32 nHeight) +void SwSnapToGridTest::checkShapeSize(SdrObject* pObject, const sal_Int32 nWidthMm100, + const sal_Int32 nHeightMm100) { CPPUNIT_ASSERT(pObject); @@ -176,12 +179,12 @@ void SwSnapToGridTest::checkShapeSize(SdrObject* pObject, const sal_Int32 nWidth CPPUNIT_ASSERT(xShape.is()); awt::Size aSize = xShape->getSize(); - CPPUNIT_ASSERT_EQUAL(nWidth, aSize.Width); - CPPUNIT_ASSERT_EQUAL(nHeight, aSize.Height); + CPPUNIT_ASSERT_EQUAL(nWidthMm100, aSize.Width); + CPPUNIT_ASSERT_EQUAL(nHeightMm100, aSize.Height); } -void SwSnapToGridTest::checkShapePosition(SdrObject* pObject, const sal_Int32 nX, - const sal_Int32 nY) +void SwSnapToGridTest::checkShapePosition(SdrObject* pObject, const sal_Int32 nXMm100, + const sal_Int32 nYMm100) { CPPUNIT_ASSERT(pObject); @@ -189,8 +192,8 @@ void SwSnapToGridTest::checkShapePosition(SdrObject* pObject, const sal_Int32 nX CPPUNIT_ASSERT(xShape.is()); awt::Point aPosition = xShape->getPosition(); - CPPUNIT_ASSERT_EQUAL(nX, aPosition.X); - CPPUNIT_ASSERT_EQUAL(nY, aPosition.Y); + CPPUNIT_ASSERT_EQUAL(nXMm100, aPosition.X); + CPPUNIT_ASSERT_EQUAL(nYMm100, aPosition.Y); } CPPUNIT_TEST_FIXTURE(SwSnapToGridTest, testMoveShapeOnGrid)
