[Libreoffice-commits] .: basegfx/test
Thorsten Behrens
thorsten at kemper.freedesktop.org
Mon Mar 14 17:12:24 PDT 2011
basegfx/test/basegfx2d.cxx | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
New commits:
commit f89d911853dacba568bb28dd8411ae3132695f72
Author: Thorsten Behrens <tbehrens at novell.com>
Date: Tue Mar 15 01:10:15 2011 +0100
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.
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index 5a58ed8..8ac7acf 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);
More information about the Libreoffice-commits
mailing list