diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-03-04 18:46:25 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-03-05 01:40:58 +0000 |
commit | 89d19cf6e721652eaa19eee2e4700eb4e4fdb540 (patch) | |
tree | 8da96fc451f8272f9e61435a9ce174007a7c74f5 /svx/qa | |
parent | e74c6e8550ae2644e30752e1fa91005c2a412ec7 (diff) |
svx: add test for RotatePoint
Change-Id: I62182fa02843d428d1b745c55ab695450ec4940a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148235
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/qa')
-rw-r--r-- | svx/qa/unit/svdraw.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx index fc1a884c4b74..0001a7f4d66a 100644 --- a/svx/qa/unit/svdraw.cxx +++ b/svx/qa/unit/svdraw.cxx @@ -636,6 +636,39 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testRectangleObjectRotate) pPage->RemoveObject(0); } } + +CPPUNIT_TEST_FIXTURE(SvdrawTest, testRotatePoint) +{ + { + auto angle = 18000_deg100; + double angleRadians = toRadians(angle); + Point aPoint(2000, 1000); + Point aReference(1000, 1000); + RotatePoint(aPoint, aReference, std::sin(angleRadians), std::cos(angleRadians)); + + CPPUNIT_ASSERT_EQUAL(Point(0, 1000), aPoint); + } + + { + auto angle = 9000_deg100; + double angleRadians = toRadians(angle); + Point aPoint(2000, 1000); + Point aReference(1000, 1000); + RotatePoint(aPoint, aReference, std::sin(angleRadians), std::cos(angleRadians)); + + CPPUNIT_ASSERT_EQUAL(Point(1000, 0), aPoint); + } + + { + auto angle = 18000_deg100; + double angleRadians = toRadians(angle); + Point aPoint(100, 100); + Point aReference(200, 200); + RotatePoint(aPoint, aReference, std::sin(angleRadians), std::cos(angleRadians)); + + CPPUNIT_ASSERT_EQUAL(Point(300, 300), aPoint); + } +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |