summaryrefslogtreecommitdiff
path: root/basegfx/test
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@novell.com>2011-03-15 01:10:15 +0100
committerThorsten Behrens <tbehrens@novell.com>2011-03-15 01:12:05 +0100
commit7e369e66463750564a9b45700db82ca44c10a561 (patch)
tree1c57265cfe4c64ea3bc47e9e6003d694cf71163a /basegfx/test
parente6a9195da918c1db9fad99cc6137785fe703ae3e (diff)
Lock rotation matrix orthogonality via unit test
There were cases reported when multiples of pi/2 did not yield a properly-orthogonal rotation matrix. locked via unit test.
Diffstat (limited to 'basegfx/test')
-rw-r--r--basegfx/test/basegfx2d.cxx38
1 files changed, 38 insertions, 0 deletions
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index 9a6c2dac4a38..6cccd67a9c21 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -709,6 +709,43 @@ public:
CPPUNIT_ASSERT_MESSAGE("scale", maScale == mat);
}
+ void rotate()
+ {
+ B2DHomMatrix mat;
+ mat.rotate(90*F_PI180);
+ CPPUNIT_ASSERT_MESSAGE("rotate pi/2 yields exact matrix",
+ mat.get(0,0) == 0.0 &&
+ mat.get(0,1) == -1.0 &&
+ mat.get(0,2) == 0.0 &&
+ mat.get(1,0) == 1.0 &&
+ mat.get(1,1) == 0.0 &&
+ mat.get(1,2) == 0.0);
+ mat.rotate(90*F_PI180);
+ CPPUNIT_ASSERT_MESSAGE("rotate pi yields exact matrix",
+ mat.get(0,0) == -1.0 &&
+ mat.get(0,1) == 0.0 &&
+ mat.get(0,2) == 0.0 &&
+ mat.get(1,0) == 0.0 &&
+ mat.get(1,1) == -1.0 &&
+ mat.get(1,2) == 0.0);
+ mat.rotate(90*F_PI180);
+ CPPUNIT_ASSERT_MESSAGE("rotate 3/2 pi yields exact matrix",
+ mat.get(0,0) == 0.0 &&
+ mat.get(0,1) == 1.0 &&
+ mat.get(0,2) == 0.0 &&
+ mat.get(1,0) == -1.0 &&
+ mat.get(1,1) == 0.0 &&
+ mat.get(1,2) == 0.0);
+ mat.rotate(90*F_PI180);
+ CPPUNIT_ASSERT_MESSAGE("rotate 2 pi yields exact matrix",
+ mat.get(0,0) == 1.0 &&
+ mat.get(0,1) == 0.0 &&
+ mat.get(0,2) == 0.0 &&
+ mat.get(1,0) == 0.0 &&
+ mat.get(1,1) == 1.0 &&
+ mat.get(1,2) == 0.0);
+ }
+
void translate()
{
B2DHomMatrix mat;
@@ -895,6 +932,7 @@ public:
CPPUNIT_TEST(identity);
CPPUNIT_TEST(scale);
CPPUNIT_TEST(translate);
+ CPPUNIT_TEST(rotate);
CPPUNIT_TEST(shear);
CPPUNIT_TEST(multiply);
CPPUNIT_TEST(decompose);