diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2015-10-10 21:51:48 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-11-28 23:38:40 +0000 |
commit | 4daba1f0e526c8c1ba829fe6e95c957bef6e46bb (patch) | |
tree | d6b68e8a92f15ce744a504e5f400ef2161862984 /chart2/qa | |
parent | 1b26e2ef0a97ded5cc812664ef8455251468e847 (diff) |
tdf#88154 - added unit test for rotated layout
Change-Id: Ie0243bda8ec253d68f3bc5e469623d1f4edddcf5
Reviewed-on: https://gerrit.libreoffice.org/19297
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'chart2/qa')
-rw-r--r-- | chart2/qa/extras/xshape/chart2xshape.cxx | 68 | ||||
-rw-r--r-- | chart2/qa/extras/xshape/data/pptx/tdf88154_LabelRotatedLayout.pptx | bin | 0 -> 34771 bytes |
2 files changed, 68 insertions, 0 deletions
diff --git a/chart2/qa/extras/xshape/chart2xshape.cxx b/chart2/qa/extras/xshape/chart2xshape.cxx index dd74e183e1a9..c49662fbb8f1 100644 --- a/chart2/qa/extras/xshape/chart2xshape.cxx +++ b/chart2/qa/extras/xshape/chart2xshape.cxx @@ -35,6 +35,7 @@ public: void testPieChartLabels3(); void testPieChartLabels4(); void testTdf76649TrendLineBug(); + void testTdf88154LabelRotatedLayout(); CPPUNIT_TEST_SUITE(Chart2XShapeTest); CPPUNIT_TEST(testFdo75075); @@ -44,6 +45,7 @@ public: CPPUNIT_TEST(testPieChartLabels3); CPPUNIT_TEST(testPieChartLabels4); CPPUNIT_TEST(testTdf76649TrendLineBug); + CPPUNIT_TEST(testTdf88154LabelRotatedLayout); CPPUNIT_TEST_SUITE_END(); @@ -155,6 +157,72 @@ void Chart2XShapeTest::testTdf76649TrendLineBug() assertXPath(pXmlDoc, "//XShape[@name='CID/D=0:CS=0:CT=0:Series=0:Curve=0']", 1); } +void Chart2XShapeTest::testTdf88154LabelRotatedLayout() +{ + load("chart2/qa/extras/xshape/data/pptx/", "tdf88154_LabelRotatedLayout.pptx"); + uno::Reference< chart::XChartDocument > xChartDoc = getChartDocFromDrawImpress(0,6); + uno::Reference< qa::XDumper > xDumper( xChartDoc, UNO_QUERY_THROW ); + OUString rDump = xDumper->dump(); + OString aXmlDump = OUStringToOString(rDump, RTL_TEXTENCODING_UTF8); + xmlDocPtr pXmlDoc = xmlParseDoc(reinterpret_cast<const xmlChar*>(aXmlDump.getStr())); + + { + OString aPath( "//XShape[@text='Oct-12']/Transformation" ); + assertXPath(pXmlDoc, aPath, 1); + double fT11 = getXPath(pXmlDoc, aPath + "/Line1", "column1").toDouble(); + double fT12 = getXPath(pXmlDoc, aPath + "/Line1", "column2").toDouble(); + double fT21 = getXPath(pXmlDoc, aPath + "/Line2", "column1").toDouble(); + double fT22 = getXPath(pXmlDoc, aPath + "/Line2", "column2").toDouble(); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT11, -fT21, 1e-8); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT12, fT22, 1e-8); + } + { + OString aPath( "//XShape[@text='Nov-12']/Transformation" ); + assertXPath(pXmlDoc, aPath, 1); + double fT11 = getXPath(pXmlDoc, aPath + "/Line1", "column1").toDouble(); + double fT12 = getXPath(pXmlDoc, aPath + "/Line1", "column2").toDouble(); + double fT21 = getXPath(pXmlDoc, aPath + "/Line2", "column1").toDouble(); + double fT22 = getXPath(pXmlDoc, aPath + "/Line2", "column2").toDouble(); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT11, -fT21, 1e-8); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT12, fT22, 1e-8); + } + { + OString aPath( "//XShape[@text='Dec-12']/Transformation" ); + assertXPath(pXmlDoc, aPath, 1); + double fT11 = getXPath(pXmlDoc, aPath + "/Line1", "column1").toDouble(); + double fT12 = getXPath(pXmlDoc, aPath + "/Line1", "column2").toDouble(); + double fT21 = getXPath(pXmlDoc, aPath + "/Line2", "column1").toDouble(); + double fT22 = getXPath(pXmlDoc, aPath + "/Line2", "column2").toDouble(); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT11, -fT21, 1e-8); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT12, fT22, 1e-8); + } + { + OString aPath( "//XShape[@text='May-13']/Transformation" ); + assertXPath(pXmlDoc, aPath, 1); + double fT11 = getXPath(pXmlDoc, aPath + "/Line1", "column1").toDouble(); + double fT12 = getXPath(pXmlDoc, aPath + "/Line1", "column2").toDouble(); + double fT21 = getXPath(pXmlDoc, aPath + "/Line2", "column1").toDouble(); + double fT22 = getXPath(pXmlDoc, aPath + "/Line2", "column2").toDouble(); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT11, -fT21, 1e-8); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT12, fT22, 1e-8); + } + { + OString aPath( "//XShape[@text='Jan-14']/Transformation" ); + assertXPath(pXmlDoc, aPath, 1); + double fT11 = getXPath(pXmlDoc, aPath + "/Line1", "column1").toDouble(); + double fT12 = getXPath(pXmlDoc, aPath + "/Line1", "column2").toDouble(); + double fT21 = getXPath(pXmlDoc, aPath + "/Line2", "column1").toDouble(); + double fT22 = getXPath(pXmlDoc, aPath + "/Line2", "column2").toDouble(); + + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT11, -fT21, 1e-8); + CPPUNIT_ASSERT_DOUBLES_EQUAL(fT12, fT22, 1e-8); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2XShapeTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/xshape/data/pptx/tdf88154_LabelRotatedLayout.pptx b/chart2/qa/extras/xshape/data/pptx/tdf88154_LabelRotatedLayout.pptx Binary files differnew file mode 100644 index 000000000000..f3af67765677 --- /dev/null +++ b/chart2/qa/extras/xshape/data/pptx/tdf88154_LabelRotatedLayout.pptx |