[Libreoffice-commits] core.git: chart2/qa

Tamás Zolnai tamas.zolnai at collabora.com
Wed Feb 15 17:13:10 UTC 2017


 chart2/qa/extras/chart2dump/chart2dump.cxx |   47 ++++++++++++++++-------------
 1 file changed, 27 insertions(+), 20 deletions(-)

New commits:
commit f3134948fb42b92db53f519f579d4fedf5554c5e
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Wed Feb 15 16:48:32 2017 +0100

    ChartDumpTest: Add different deltas for different systems for now
    
    Change-Id: Id505edb3ca1b03817d3a98e6102d79df901a3dc2
    Reviewed-on: https://gerrit.libreoffice.org/34308
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    Tested-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index db82546..049a7cf 100755
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -25,7 +25,14 @@
 #include <fstream>
 
 #define EPS         1E-12
+
+#if defined(MACOSX)
+#define INT_EPS     200.1
+#elif defined(UNX)
 #define INT_EPS     2.1
+#else
+#define INT_EPS     0.1
+#endif
 
 #define DECLARE_DUMP_TEST(TestName, BaseClass, DumpMode) \
     class TestName : public BaseClass { \
@@ -210,12 +217,12 @@ protected:
         aExpectedTransform.Line3.Column3 = rExpectedTranform.getToken(8, ';').toDouble();
 
         // Check the equality of the two transformation
-        return (std::abs(aExpectedTransform.Line1.Column1 - rTransform.Line1.Column1) < 184.1 &&
-            std::abs(aExpectedTransform.Line1.Column2 - rTransform.Line1.Column2) < 18 &&
-            std::abs(aExpectedTransform.Line1.Column3 - rTransform.Line1.Column3) < 90.1 &&
-            std::abs(aExpectedTransform.Line2.Column1 - rTransform.Line2.Column1) < 45.1 &&
-            std::abs(aExpectedTransform.Line2.Column2 - rTransform.Line2.Column2) < 74.1 &&
-            std::abs(aExpectedTransform.Line2.Column3 - rTransform.Line2.Column3) < 44.1 &&
+        return (std::abs(aExpectedTransform.Line1.Column1 - rTransform.Line1.Column1) < INT_EPS &&
+            std::abs(aExpectedTransform.Line1.Column2 - rTransform.Line1.Column2) < INT_EPS &&
+            std::abs(aExpectedTransform.Line1.Column3 - rTransform.Line1.Column3) < INT_EPS &&
+            std::abs(aExpectedTransform.Line2.Column1 - rTransform.Line2.Column1) < INT_EPS &&
+            std::abs(aExpectedTransform.Line2.Column2 - rTransform.Line2.Column2) < INT_EPS &&
+            std::abs(aExpectedTransform.Line2.Column3 - rTransform.Line2.Column3) < INT_EPS &&
             std::abs(aExpectedTransform.Line3.Column1 - rTransform.Line3.Column1) < INT_EPS &&
             std::abs(aExpectedTransform.Line3.Column2 - rTransform.Line3.Column2) < INT_EPS &&
             std::abs(aExpectedTransform.Line3.Column3 - rTransform.Line3.Column3) < INT_EPS);
@@ -416,11 +423,11 @@ DECLARE_DUMP_TEST(LegendTest, Chart2DumpTest, false)
 
         // Check legend position and size
         awt::Point aLegendPosition = xLegend->getPosition();
-        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendPosition.X, 48.1);
-        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendPosition.Y, 50.1);
+        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendPosition.X, INT_EPS);
+        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendPosition.Y, INT_EPS);
         awt::Size aLegendSize = xLegend->getSize();
-        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendSize.Width, 97.1);
-        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendSize.Height, 100.1);
+        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendSize.Width, INT_EPS);
+        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendSize.Height, INT_EPS);
 
         // Check legend entries
         uno::Reference< chart2::XChartDocument > xChartDoc2(xChartDoc, UNO_QUERY_THROW);
@@ -595,9 +602,9 @@ DECLARE_DUMP_TEST(AxisGeometryTest, Chart2DumpTest, false)
             // Check position and size
             awt::Point aAxisPosition = xXAxis->getPosition();
             CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisPosition.X, INT_EPS);
-            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisPosition.Y, 25.1);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisPosition.Y, INT_EPS);
             awt::Size aAxisSize = xXAxis->getSize();
-            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisSize.Height, 25.1);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisSize.Height, INT_EPS);
             CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisSize.Width, INT_EPS);
 
             // Check transformation
@@ -689,11 +696,11 @@ DECLARE_DUMP_TEST(AxisLabelTest, Chart2DumpTest, false)
                 // Check size and position
                 uno::Reference<drawing::XShape> xLabelShape(xLabel, uno::UNO_QUERY);
                 awt::Point aLabelPosition = xLabelShape->getPosition();
-                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLabelPosition.X, 90.1);
-                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLabelPosition.Y, 35.1);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLabelPosition.X, INT_EPS);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLabelPosition.Y, INT_EPS);
                 awt::Size aLabelSize = xLabelShape->getSize();
-                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLabelSize.Height, 25.1);
-                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLabelSize.Width, 90.1);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLabelSize.Height, INT_EPS);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLabelSize.Width, INT_EPS);
 
                 // Check transformation
                 Reference< beans::XPropertySet > xPropSet(xLabelShape, UNO_QUERY_THROW);
@@ -813,11 +820,11 @@ DECLARE_DUMP_TEST(ChartWallTest, Chart2DumpTest, false)
 
         // Check position and size
         awt::Point aChartWallPosition = xChartWall->getPosition();
-        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aChartWallPosition.X, 88.1);
-        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aChartWallPosition.Y, 44.1);
+        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aChartWallPosition.X, INT_EPS);
+        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aChartWallPosition.Y, INT_EPS);
         awt::Size aChartWallSize = xChartWall->getSize();
-        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aChartWallSize.Height, 74.1);
-        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aChartWallSize.Width, 184.1);
+        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aChartWallSize.Height, INT_EPS);
+        CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aChartWallSize.Width, INT_EPS);
 
         // Check transformation
         Reference< beans::XPropertySet > xPropSet(xChartWall, UNO_QUERY_THROW);


More information about the Libreoffice-commits mailing list