diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-03-26 23:29:21 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-03-26 23:58:43 +0100 |
commit | b0d99224c777fa8f532fa8014207240c60220008 (patch) | |
tree | ed78d19b932d2d54911eefd31dab7cafb11d0d38 /chart2 | |
parent | a1f85043237b6b02549b69aad90d687c0d4e08fc (diff) |
add test for improved overlap chart export
Change-Id: Id1466f7a95470a7c90a7752971e126d3f4b45766
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/qa/extras/chart2export.cxx | 59 | ||||
-rw-r--r-- | chart2/qa/extras/data/xlsx/gapWidth.xlsx | bin | 0 -> 18668 bytes |
2 files changed, 59 insertions, 0 deletions
diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx index c0d20f17db36..a817c59f0338 100644 --- a/chart2/qa/extras/chart2export.cxx +++ b/chart2/qa/extras/chart2export.cxx @@ -53,6 +53,7 @@ public: void testChartCrash(); void testPieChartRotation(); void testEmbeddingsOleObjectGrabBag(); + void testGapWidthXLSX(); CPPUNIT_TEST_SUITE(Chart2ExportTest); CPPUNIT_TEST(test); @@ -78,6 +79,7 @@ public: CPPUNIT_TEST(testChartCrash); CPPUNIT_TEST(testPieChartRotation); CPPUNIT_TEST(testEmbeddingsOleObjectGrabBag); + CPPUNIT_TEST(testGapWidthXLSX); CPPUNIT_TEST_SUITE_END(); protected: @@ -712,6 +714,63 @@ void Chart2ExportTest::testEmbeddingsOleObjectGrabBag() CPPUNIT_ASSERT(bEmbeddings); // Grab Bag has all the expected elements } +namespace { + +void checkGapWidth(Reference<beans::XPropertySet> xPropSet, sal_Int32 nValue) +{ + uno::Any aAny = xPropSet->getPropertyValue("GapwidthSequence"); + CPPUNIT_ASSERT(aAny.hasValue()); + uno::Sequence< sal_Int32 > aSequence; + aAny >>= aSequence; + CPPUNIT_ASSERT(aSequence.getLength()); + CPPUNIT_ASSERT_EQUAL(nValue, aSequence[0]); +} + +void checkOverlap(Reference<beans::XPropertySet> xPropSet, sal_Int32 nValue) +{ + uno::Any aAny = xPropSet->getPropertyValue("OverlapSequence"); + CPPUNIT_ASSERT(aAny.hasValue()); + uno::Sequence< sal_Int32 > aSequence; + aAny >>= aSequence; + CPPUNIT_ASSERT(aSequence.getLength()); + CPPUNIT_ASSERT_EQUAL(nValue, aSequence[0]); +} + +void checkSheetForGapWidthAndOverlap(uno::Reference< chart2::XChartDocument > xChartDoc, + sal_Int32 nExpectedGapWidth, sal_Int32 nExpectedOverlap) +{ + CPPUNIT_ASSERT(xChartDoc.is()); + + Reference< chart2::XChartType > xChartType = getChartTypeFromDoc( xChartDoc, 0, 0 ); + CPPUNIT_ASSERT(xChartType.is()); + + Reference< beans::XPropertySet > xPropSet( xChartType, uno::UNO_QUERY_THROW ); + checkGapWidth(xPropSet, nExpectedGapWidth); + checkOverlap(xPropSet, nExpectedOverlap); + +} + +} + +void Chart2ExportTest::testGapWidthXLSX() +{ + load("/chart2/qa/extras/data/xlsx/", "gapWidth.xlsx"); + + uno::Reference< chart2::XChartDocument > xChartDoc = getChartDocFromSheet( 0, mxComponent ); + checkSheetForGapWidthAndOverlap(xChartDoc, 120, -60); + + xChartDoc = getChartDocFromSheet( 1, mxComponent ); + checkSheetForGapWidthAndOverlap(xChartDoc, 50, 30); + + reload("Calc Office Open XML"); + + xChartDoc = getChartDocFromSheet( 0, mxComponent ); + checkSheetForGapWidthAndOverlap(xChartDoc, 120, -60); + + xChartDoc = getChartDocFromSheet( 1, mxComponent ); + checkSheetForGapWidthAndOverlap(xChartDoc, 50, 30); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Chart2ExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/chart2/qa/extras/data/xlsx/gapWidth.xlsx b/chart2/qa/extras/data/xlsx/gapWidth.xlsx Binary files differnew file mode 100644 index 000000000000..0e9c0eec08ae --- /dev/null +++ b/chart2/qa/extras/data/xlsx/gapWidth.xlsx |