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

Tamás Zolnai tamas.zolnai at collabora.com
Sun Feb 12 19:42:19 UTC 2017


 chart2/qa/extras/chart2dump/chart2dump.cxx |   51 ++++++++++++++---------------
 1 file changed, 26 insertions(+), 25 deletions(-)

New commits:
commit 934e2d83e2628131a3b6ca9fdbc99848ccda655f
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Sun Feb 12 20:06:33 2017 +0100

    ChartDumpTest: Make position and size check a bit more robust
    
    Some of tinderboxes shows these values can be variable
    among machines.
    
    Change-Id: I867cc5d124e537d5de16e2b8275f8eb6fdfde447
    Reviewed-on: https://gerrit.libreoffice.org/34178
    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 0c69aeb..3fa487a 100755
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -24,7 +24,8 @@
 
 #include <fstream>
 
-#define EPS 1E-12
+#define EPS         1E-12
+#define INT_EPS     1.1
 
 #define DECLARE_DUMP_TEST(TestName, BaseClass, DumpMode) \
     class TestName : public BaseClass { \
@@ -369,11 +370,11 @@ DECLARE_DUMP_TEST(LegendTest, Chart2DumpTest, false)
 
         // Check legend position and size
         awt::Point aLegendPosition = xLegend->getPosition();
-        CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLegendPosition.X);
-        CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLegendPosition.Y);
+        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_NUMBERS_EQUAL(aLegendSize.Width);
-        CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLegendSize.Height);
+        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);
@@ -390,11 +391,11 @@ DECLARE_DUMP_TEST(LegendTest, Chart2DumpTest, false)
 
             // Check position and size
             awt::Point aLegendEntryPosition = xLegendEntry->getPosition();
-            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLegendEntryPosition.X);
-            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLegendEntryPosition.Y);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendEntryPosition.X, INT_EPS);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendEntryPosition.Y, INT_EPS);
             awt::Size aLegendEntrySize = xLegendEntry->getSize();
-            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLegendEntrySize.Height);
-            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLegendEntrySize.Width);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendEntrySize.Height, INT_EPS);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aLegendEntrySize.Width, INT_EPS);
 
             // Check transformation
             Reference< beans::XPropertySet > xLegendEntryPropSet(xLegendEntry, UNO_QUERY_THROW);
@@ -476,11 +477,11 @@ DECLARE_DUMP_TEST(GridTest, Chart2DumpTest, false)
                 CPPUNIT_DUMP_ASSERT_NOTE(sGridShapeName);
                 // Check position and size
                 awt::Point aGridPosition = xGrid->getPosition();
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aGridPosition.X);
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aGridPosition.Y);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aGridPosition.X, INT_EPS);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aGridPosition.Y, INT_EPS);
                 awt::Size aGridSize = xGrid->getSize();
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aGridSize.Height);
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aGridSize.Width);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aGridSize.Height, INT_EPS);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aGridSize.Width, INT_EPS);
 
                 // Check transformation
                 Reference< beans::XPropertySet > xPropSet(xGrid, UNO_QUERY_THROW);
@@ -549,11 +550,11 @@ DECLARE_DUMP_TEST(AxisGeometryTest, Chart2DumpTest, false)
             CPPUNIT_DUMP_ASSERT_NOTE(sAxisShapeName);
             // Check position and size
             awt::Point aAxisPosition = xXAxis->getPosition();
-            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aAxisPosition.X);
-            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aAxisPosition.Y);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisPosition.X, INT_EPS);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisPosition.Y, INT_EPS);
             awt::Size aAxisSize = xXAxis->getSize();
-            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aAxisSize.Height);
-            CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aAxisSize.Width);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisSize.Height, INT_EPS);
+            CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aAxisSize.Width, INT_EPS);
 
             // Check transformation
             Reference< beans::XPropertySet > xPropSet(xXAxis, UNO_QUERY_THROW);
@@ -644,11 +645,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_NUMBERS_EQUAL(aLabelPosition.X);
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLabelPosition.Y);
+                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_NUMBERS_EQUAL(aLabelSize.Height);
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aLabelSize.Width);
+                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);
@@ -725,11 +726,11 @@ DECLARE_DUMP_TEST(ColumnChartTest, Chart2DumpTest, false)
 
                 // Check size and position
                 awt::Point aColumnPosition = xColumn->getPosition();
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aColumnPosition.X);
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aColumnPosition.Y);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aColumnPosition.X, INT_EPS);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aColumnPosition.Y, INT_EPS);
                 awt::Size aColumnSize = xColumn->getSize();
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aColumnSize.Height);
-                CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aColumnSize.Width);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aColumnSize.Height, INT_EPS);
+                CPPUNIT_DUMP_ASSERT_DOUBLES_EQUAL(aColumnSize.Width, INT_EPS);
 
                 // Check transformation
                 Reference< beans::XPropertySet > xPropSet(xColumn, UNO_QUERY_THROW);


More information about the Libreoffice-commits mailing list