summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamás Zolnai <tamas.zolnai@collabora.com>2017-02-12 20:50:12 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2017-02-12 21:12:54 +0000
commit125194ff4b983ccdfb2390449c0a4b4d4345b29b (patch)
tree1ed1c156ddefa762cdbec6b3902f29fba7155764
parent804287e4ab0ae0e9f5d61446b473c9cd985e9674 (diff)
ChartDumpTest: Test chart wall
Change-Id: I16b7da66c6a6bab160212c47a75ce22951f85f87 Reviewed-on: https://gerrit.libreoffice.org/34181 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
-rwxr-xr-xchart2/qa/extras/chart2dump/chart2dump.cxx66
-rwxr-xr-xchart2/qa/extras/chart2dump/data/chartwall_auto_adjust_with_titles.odsbin0 -> 24966 bytes
-rwxr-xr-xchart2/qa/extras/chart2dump/data/chartwall_auto_adjust_without_titles.odsbin0 -> 25289 bytes
-rwxr-xr-xchart2/qa/extras/chart2dump/data/chartwall_custom_positioning.odsbin0 -> 29571 bytes
-rwxr-xr-xchart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_auto_adjust_with_titles.txt20
-rwxr-xr-xchart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_auto_adjust_without_titles.txt20
-rwxr-xr-xchart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_custom_positioning.txt20
7 files changed, 126 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2dump/chart2dump.cxx b/chart2/qa/extras/chart2dump/chart2dump.cxx
index 3fa487ab5d9a..d0adeda4eb54 100755
--- a/chart2/qa/extras/chart2dump/chart2dump.cxx
+++ b/chart2/qa/extras/chart2dump/chart2dump.cxx
@@ -744,6 +744,72 @@ DECLARE_DUMP_TEST(ColumnChartTest, Chart2DumpTest, false)
}
}
+DECLARE_DUMP_TEST(ChartWallTest, Chart2DumpTest, false)
+{
+ const std::vector<OUString> aTestFiles =
+ {
+ "chartwall_auto_adjust_with_titles.ods",
+ "chartwall_auto_adjust_without_titles.ods",
+ "chartwall_custom_positioning.ods"
+ };
+
+ for (const OUString& sTestFile : aTestFiles)
+ {
+ setTestFileName(sTestFile);
+ load(getTestFileDirName(), getTestFileName());
+ uno::Reference< chart::XChartDocument > xChartDoc(getChartDocFromSheet(0, mxComponent), UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(xChartDoc, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage = xDrawPageSupplier->getDrawPage();
+ uno::Reference<drawing::XShapes> xShapes(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xShapes.is());
+
+ uno::Reference<drawing::XShape> xChartWall = getShapeByName(xShapes, "CID/DiagramWall=");
+ CPPUNIT_ASSERT(xChartWall.is());
+
+ // Check position and size
+ awt::Point aChartWallPosition = xChartWall->getPosition();
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aChartWallPosition.X);
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aChartWallPosition.Y);
+ awt::Size aChartWallSize = xChartWall->getSize();
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aChartWallSize.Height);
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(aChartWallSize.Width);
+
+ // Check transformation
+ Reference< beans::XPropertySet > xPropSet(xChartWall, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xPropSet.is());
+ drawing::HomogenMatrix3 aTransform;
+ xPropSet->getPropertyValue("Transformation") >>= aTransform;
+ OUString sChartWallTransformation = transformationToOneLineString(aTransform);
+ CPPUNIT_DUMP_ASSERT_STRINGS_EQUAL(sChartWallTransformation);
+
+ // Check fill properties
+ drawing::FillStyle aChartWallFillStyle;
+ xPropSet->getPropertyValue(UNO_NAME_FILLSTYLE) >>= aChartWallFillStyle;
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(static_cast<sal_Int32>(aChartWallFillStyle));
+ util::Color aChartWallFillColor = 0;
+ xPropSet->getPropertyValue(UNO_NAME_FILLCOLOR) >>= aChartWallFillColor;
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(static_cast<sal_Int32>(aChartWallFillColor));
+
+ // Check line properties
+ // Line type
+ drawing::LineDash aLineDash;
+ xPropSet->getPropertyValue("LineDash") >>= aLineDash;
+ OUString sChartWallLineDash =
+ OUString::number(static_cast<sal_Int32>(aLineDash.Style)) + ";" + OUString::number(aLineDash.Dots) + ";" + OUString::number(aLineDash.DotLen) +
+ OUString::number(aLineDash.Dashes) + ";" + OUString::number(aLineDash.DashLen) + ";" + OUString::number(aLineDash.Distance);
+ CPPUNIT_DUMP_ASSERT_STRINGS_EQUAL(sChartWallLineDash);
+ // Line color
+ util::Color aChartWallLineColor = 0;
+ xPropSet->getPropertyValue("LineColor") >>= aChartWallLineColor;
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(static_cast<sal_Int32>(aChartWallLineColor));
+ // Line width
+ sal_Int32 nChartWallLineWidth = 0;
+ xPropSet->getPropertyValue("LineWidth") >>= nChartWallLineWidth;
+ CPPUNIT_DUMP_ASSERT_NUMBERS_EQUAL(nChartWallLineWidth);
+
+ }
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/qa/extras/chart2dump/data/chartwall_auto_adjust_with_titles.ods b/chart2/qa/extras/chart2dump/data/chartwall_auto_adjust_with_titles.ods
new file mode 100755
index 000000000000..9bb855581b1c
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/data/chartwall_auto_adjust_with_titles.ods
Binary files differ
diff --git a/chart2/qa/extras/chart2dump/data/chartwall_auto_adjust_without_titles.ods b/chart2/qa/extras/chart2dump/data/chartwall_auto_adjust_without_titles.ods
new file mode 100755
index 000000000000..8c76b81c1ed8
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/data/chartwall_auto_adjust_without_titles.ods
Binary files differ
diff --git a/chart2/qa/extras/chart2dump/data/chartwall_custom_positioning.ods b/chart2/qa/extras/chart2dump/data/chartwall_custom_positioning.ods
new file mode 100755
index 000000000000..f0e2b89f23a8
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/data/chartwall_custom_positioning.ods
Binary files differ
diff --git a/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_auto_adjust_with_titles.txt b/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_auto_adjust_with_titles.txt
new file mode 100755
index 000000000000..9d3806d1dc50
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_auto_adjust_with_titles.txt
@@ -0,0 +1,20 @@
+// aChartWallPosition.X
+3712
+// aChartWallPosition.Y
+1421
+// aChartWallSize.Height
+5892
+// aChartWallSize.Width
+9284
+// sChartWallTransformation
+9285;0;37120;5893;14210;0;1
+// static_cast<sal_Int32>(aChartWallFillStyle)
+2
+// static_cast<sal_Int32>(aChartWallFillColor)
+15132390
+// sChartWallLineDash
+0;1;200710;0;152
+// static_cast<sal_Int32>(aChartWallLineColor)
+11010131
+// nChartWallLineWidth
+100
diff --git a/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_auto_adjust_without_titles.txt b/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_auto_adjust_without_titles.txt
new file mode 100755
index 000000000000..96a04e9f5f90
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_auto_adjust_without_titles.txt
@@ -0,0 +1,20 @@
+// aChartWallPosition.X
+2714
+// aChartWallPosition.Y
+354
+// aChartWallSize.Height
+7888
+// aChartWallSize.Width
+11853
+// sChartWallTransformation
+11854;0;27140;7889;3540;0;1
+// static_cast<sal_Int32>(aChartWallFillStyle)
+2
+// static_cast<sal_Int32>(aChartWallFillColor)
+15132390
+// sChartWallLineDash
+0;1;200710;0;152
+// static_cast<sal_Int32>(aChartWallLineColor)
+11010131
+// nChartWallLineWidth
+100
diff --git a/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_custom_positioning.txt b/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_custom_positioning.txt
new file mode 100755
index 000000000000..4370750b511f
--- /dev/null
+++ b/chart2/qa/extras/chart2dump/reference/chartwalltest/chartwall_custom_positioning.txt
@@ -0,0 +1,20 @@
+// aChartWallPosition.X
+6327
+// aChartWallPosition.Y
+1415
+// aChartWallSize.Height
+5949
+// aChartWallSize.Width
+6611
+// sChartWallTransformation
+6612;0;63270;5950;14150;0;1
+// static_cast<sal_Int32>(aChartWallFillStyle)
+1
+// static_cast<sal_Int32>(aChartWallFillColor)
+13773611
+// sChartWallLineDash
+0;2;01;203;203
+// static_cast<sal_Int32>(aChartWallLineColor)
+8388352
+// nChartWallLineWidth
+110