summaryrefslogtreecommitdiffstats
path: root/basegfx/test
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-08-04 10:37:17 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-08-04 20:51:27 +0200
commit8c48d69f06ddb3cb6c807a1e7db62dddb9778ded (patch)
tree8b6bf137be41ebe93746c4958ab9106bbf5cc339 /basegfx/test
parentoss-fuzz out of space (diff)
downloadcore-8c48d69f06ddb3cb6c807a1e7db62dddb9778ded.tar.gz
core-8c48d69f06ddb3cb6c807a1e7db62dddb9778ded.zip
Use more basegfx deg<->rad functions, instead of direct formulas
Also make the functions constexpr. Due to slight changes in floating-point arithmetics (90.0 instead of 180.0, M_PI2 instead of M_PI resp.), results might differ in last digits (usually 17th decimal digit). This has lead to need to tweak char2dump's PieChartTest unit test. Change-Id: I20323dd7dab27e4deb408ea4181e390cc05e7cd3 Reviewed-on: https://gerrit.libreoffice.org/58583 Tested-by: Jenkins Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'basegfx/test')
-rw-r--r--basegfx/test/basegfx2d.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx
index 82131b417b23..acc28f91014b 100644
--- a/basegfx/test/basegfx2d.cxx
+++ b/basegfx/test/basegfx2d.cxx
@@ -234,7 +234,7 @@ public:
void rotate()
{
B2DHomMatrix mat;
- mat.rotate(90*F_PI180);
+ mat.rotate(F_PI2);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate pi/2 yields exact matrix", 0.0, mat.get(0,0), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
@@ -247,7 +247,7 @@ public:
"rotate pi/2 yields exact matrix", 0.0, mat.get(1,1), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate pi/2 yields exact matrix", 0.0, mat.get(1,2), 1E-12);
- mat.rotate(90*F_PI180);
+ mat.rotate(F_PI2);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate pi yields exact matrix", -1.0, mat.get(0,0), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
@@ -260,7 +260,7 @@ public:
"rotate pi yields exact matrix", -1.0, mat.get(1,1), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate pi yields exact matrix", 0.0, mat.get(1,2), 1E-12);
- mat.rotate(90*F_PI180);
+ mat.rotate(F_PI2);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate 3/2 pi yields exact matrix", 0.0, mat.get(0,0), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
@@ -273,7 +273,7 @@ public:
"rotate 3/2 pi yields exact matrix", 0.0, mat.get(1,1), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate 3/2 pi yields exact matrix", 0.0, mat.get(1,2), 1E-12);
- mat.rotate(90*F_PI180);
+ mat.rotate(F_PI2);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
"rotate 2 pi yields exact matrix", 1.0, mat.get(0,0), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(
@@ -407,8 +407,8 @@ public:
// are just the two rightmost values and uncritical
static double fSX(10.0);
static double fSY(12.0);
- static double fR(45.0 * F_PI180);
- static double fS(15.0 * F_PI180);
+ static double fR(F_PI4);
+ static double fS(deg2rad(15.0));
// check all possible scaling combinations
CPPUNIT_ASSERT_MESSAGE("decompose: error test A1", impDecomposeComposeTest(fSX, fSY, 0.0, 0.0));
@@ -468,7 +468,7 @@ public:
B2DHomMatrix aTest=utils::createScaleShearXRotateTranslateB2DHomMatrix(
6425,3938,
0,
- 180*F_PI180,
+ F_PI,
10482,4921);
// decompose that matrix
B2DTuple aDScale;
@@ -479,7 +479,7 @@ public:
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", 6425.0, aDScale.getX(), 1E-12);
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", 3938.0, aDScale.getY(), 1E-12);
CPPUNIT_ASSERT_MESSAGE("decompose: error test J1", aDTrans.getX() == 10482 && aDTrans.getY() == 4921);
- CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", 180*F_PI180, fDRot, 1E-12 );
+ CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("decompose: error test J1", F_PI, fDRot, 1E-12 );
}
// Change the following lines only, if you add, remove or rename