diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-04-19 01:18:01 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2012-04-19 15:51:01 +0200 |
commit | 42899582314181641d59dcc5f78358d0631b3677 (patch) | |
tree | e3b6cb2aa4879794ab9fb6b747d5c74f3ca08dfc | |
parent | 55b823c6f9638194ec81e23faf9e131138636d32 (diff) |
enable the chart2 dumper test
-rw-r--r-- | chart2/qa/unit/data/reference/testChart.xml | 126 | ||||
-rw-r--r-- | sc/Module_sc.mk | 1 | ||||
-rw-r--r-- | sc/qa/extras/regression-test.cxx | 43 |
3 files changed, 169 insertions, 1 deletions
diff --git a/chart2/qa/unit/data/reference/testChart.xml b/chart2/qa/unit/data/reference/testChart.xml new file mode 100644 index 000000000000..b2e4aea62e3c --- /dev/null +++ b/chart2/qa/unit/data/reference/testChart.xml @@ -0,0 +1,126 @@ +<?xml version="1.0"?> +<XShapes> + <XShape position="0,0" size="16000x9000" type="com.sun.star.drawing.RectangleShape" name="CID/Page="/> + <XShape position="770,854" size="13068x7546" type="com.sun.star.drawing.GroupShape" name="CID/D=0"> + <XShapes> + <XShape position="1206,1054" size="12632x6699" type="com.sun.star.drawing.RectangleShape" name="MarkHandles"/> + <XShape position="770,855" size="13068x7545" type="com.sun.star.drawing.RectangleShape" name="PlotAreaIncludingAxes"/> + <XShape position="770,854" size="13068x7546" type="com.sun.star.drawing.GroupShape"> + <XShapes> + <XShape position="1056,1052" size="12782x6850" type="com.sun.star.drawing.GroupShape"> + <XShapes> + <XShape position="1206,1054" size="12632x6699" type="com.sun.star.drawing.GroupShape" name="PlotAreaExcludingAxes"> + <XShapes> + <XShape position="1206,1054" size="12632x6699" type="com.sun.star.drawing.RectangleShape" name="CID/DiagramWall="/> + </XShapes> + </XShape> + <XShape position="1056,1052" size="12782x6850" type="com.sun.star.drawing.GroupShape" name="testonly;CooContainer=XXX_CID"> + <XShapes> + <XShape position="1206,1052" size="12632x6700" type="com.sun.star.drawing.GroupShape"> + <XShapes> + <XShape position="1206,1052" size="12632x6700" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:Axis=1,0:Grid=0"> + <XShapes> + <XShape position="1206,1052" size="12632x6700" type="com.sun.star.drawing.PolyLineShape"/> + <XShape position="1206,1052" size="0x6700" type="com.sun.star.drawing.PolyLineShape" name="HandlesOnly"/> + </XShapes> + </XShape> + </XShapes> + </XShape> + <XShape position="1056,1052" size="12782x6850" type="com.sun.star.drawing.GroupShape"> + <XShapes> + <XShape position="1206,7752" size="12632x150" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:Axis=0,0"> + <XShapes> + <XShape position="1206,7752" size="12632x150" type="com.sun.star.drawing.PolyLineShape"/> + <XShape position="1206,7752" size="12632x0" type="com.sun.star.drawing.LineShape" name="MarkHandles"/> + </XShapes> + </XShape> + <XShape position="1056,1052" size="150x6700" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:Axis=1,0"> + <XShapes> + <XShape position="1056,1052" size="150x6700" type="com.sun.star.drawing.PolyLineShape"/> + <XShape position="1206,1052" size="0x6700" type="com.sun.star.drawing.LineShape" name="MarkHandles"/> + </XShapes> + </XShape> + </XShapes> + </XShape> + <XShape position="1627,2169" size="11789x5583" type="com.sun.star.drawing.GroupShape"> + <XShapes> + <XShape position="1627,2169" size="10947x5583" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:CT=0:Series=0"> + <XShapes> + <XShape position="11732,2169" size="842x5583" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=4"/> + <XShape position="9206,3285" size="842x4467" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=3"/> + <XShape position="6679,4402" size="843x3350" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=2"/> + <XShape position="4153,5519" size="842x2233" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=1"/> + <XShape position="1627,6635" size="842x1117" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=0:Point=0"/> + </XShapes> + </XShape> + <XShape position="2469,3285" size="10947x4467" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:CT=0:Series=1"> + <XShapes> + <XShape position="12574,5519" size="842x2233" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=1:Point=4"/> + <XShape position="10048,3285" size="842x4467" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=1:Point=3"/> + <XShape position="7522,4402" size="842x3350" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=1:Point=2"/> + <XShape position="4995,6635" size="842x1117" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=1:Point=1"/> + <XShape position="2469,5519" size="842x2233" type="com.sun.star.drawing.PolyPolygonShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=1:Point=0"/> + </XShapes> + </XShape> + </XShapes> + </XShape> + </XShapes> + </XShape> + </XShapes> + </XShape> + <XShape position="770,854" size="11898x7546" type="com.sun.star.drawing.GroupShape"> + <XShapes> + <XShape position="2376,8002" size="10292x398" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:Axis=0,0"> + <XShapes> + <XShape position="2376,8002" size="187x398" type="com.sun.star.drawing.TextShape" text="1"/> + <XShape position="4902,8002" size="187x398" type="com.sun.star.drawing.TextShape" text="2"/> + <XShape position="7429,8002" size="187x398" type="com.sun.star.drawing.TextShape" text="3"/> + <XShape position="9955,8002" size="187x398" type="com.sun.star.drawing.TextShape" text="4"/> + <XShape position="12481,8002" size="187x398" type="com.sun.star.drawing.TextShape" text="5"/> + </XShapes> + </XShape> + <XShape position="770,854" size="187x7098" type="com.sun.star.drawing.GroupShape" name="CID/D=0:CS=0:Axis=1,0"> + <XShapes> + <XShape position="770,7554" size="187x398" type="com.sun.star.drawing.TextShape" text="0"/> + <XShape position="770,6437" size="187x398" type="com.sun.star.drawing.TextShape" text="1"/> + <XShape position="770,5321" size="187x398" type="com.sun.star.drawing.TextShape" text="2"/> + <XShape position="770,4204" size="187x398" type="com.sun.star.drawing.TextShape" text="3"/> + <XShape position="770,3087" size="187x398" type="com.sun.star.drawing.TextShape" text="4"/> + <XShape position="770,1971" size="187x398" type="com.sun.star.drawing.TextShape" text="5"/> + <XShape position="770,854" size="187x398" type="com.sun.star.drawing.TextShape" text="6"/> + </XShapes> + </XShape> + </XShapes> + </XShape> + </XShapes> + </XShape> + </XShapes> + </XShape> + <XShape position="14478,3952" size="1312x1096" type="com.sun.star.drawing.GroupShape" name="CID/D=0:Legend="> + <XShapes> + <XShape position="14478,3952" size="1312x1096" type="com.sun.star.drawing.RectangleShape" name="MarkHandles"/> + <XShape position="14594,4145" size="211x211" type="com.sun.star.drawing.GroupShape"> + <XShapes> + <XShape position="14594,4145" size="211x211" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=0:LegendEntry=0"> + <XShapes> + <XShape position="14594,4145" size="211x211" type="com.sun.star.drawing.RectangleShape"/> + <XShape position="14594,4145" size="211x211" type="com.sun.star.drawing.RectangleShape"/> + </XShapes> + </XShape> + </XShapes> + </XShape> + <XShape position="14594,4643" size="211x211" type="com.sun.star.drawing.GroupShape"> + <XShapes> + <XShape position="14594,4643" size="211x211" type="com.sun.star.drawing.GroupShape" name="CID/MultiClick/D=0:CS=0:CT=0:Series=1:LegendEntry=0"> + <XShapes> + <XShape position="14594,4643" size="211x211" type="com.sun.star.drawing.RectangleShape"/> + <XShape position="14594,4643" size="211x211" type="com.sun.star.drawing.RectangleShape"/> + </XShapes> + </XShape> + </XShapes> + </XShape> + <XShape position="14905,4052" size="769x398" type="com.sun.star.drawing.TextShape" text="test1"/> + <XShape position="14905,4550" size="769x398" type="com.sun.star.drawing.TextShape" text="test2"/> + </XShapes> + </XShape> +</XShapes> diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index b6a42e178a57..a40b0d888ff8 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -54,6 +54,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ JunitTest_sc_complex \ JunitTest_sc_unoapi \ CppunitTest_sc_cellrangeobj \ + CppunitTest_sc_chart_regression_test \ $(if $(filter-out $(OS),IOS), \ CppunitTest_sc_databaserangeobj) \ CppunitTest_sc_datapilottableobj \ diff --git a/sc/qa/extras/regression-test.cxx b/sc/qa/extras/regression-test.cxx index 4041fd45876c..812e218be648 100644 --- a/sc/qa/extras/regression-test.cxx +++ b/sc/qa/extras/regression-test.cxx @@ -61,6 +61,46 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace { + +bool checkDumpAgainstFile( const rtl::OUString& rDump, const rtl::OUString aFilePath ) +{ + rtl::OString aOFile = rtl::OUStringToOString(aFilePath, RTL_TEXTENCODING_UTF8); + std::ifstream aFile(aOFile.getStr()); + + CPPUNIT_ASSERT_MESSAGE("file not open", aFile.is_open()); + CPPUNIT_ASSERT_MESSAGE("dump is empty", !rDump.isEmpty()); + + sal_Int32 nLine = 1; + sal_Int32 nIndex = 0; + while(!aFile.eof()) + { + std::string aLineFile; + + std::getline(aFile, aLineFile); + sal_Int32 nNewIndex = rDump.indexOf('\n', nIndex); + //CPPUNIT_ASSERT( nNewIndex != -1 ); + if (nNewIndex == -1) + nNewIndex = rDump.getLength(); + rtl::OUString aLineDump = rDump.copy(nIndex, nNewIndex-nIndex); + nIndex = nNewIndex+1; + rtl::OString aOLineDump = rtl::OUStringToOString(aLineDump, RTL_TEXTENCODING_UTF8); + + if( aLineFile.compare(aOLineDump.getStr()) ) + { + rtl::OStringBuffer aErrorMessage("Mismatch between reference file and dump in line "); + std::cout << rtl::OUStringToOString(rDump, RTL_TEXTENCODING_UTF8).getStr(); + aErrorMessage.append(nLine).append(".\nExpected: "); + aErrorMessage.append(aLineFile.c_str()).append("\nFound : ").append(aOLineDump); + CPPUNIT_ASSERT_MESSAGE(aErrorMessage.getStr(), false); + } + nLine++; + } + return true; +} + +} + class ScChartRegressionTest : public test::BootstrapFixture, public unotest::MacrosTest { public: @@ -129,7 +169,8 @@ void ScChartRegressionTest::test() CPPUNIT_ASSERT(xDumper.is()); rtl::OUString aDump = xDumper->dump(); - std::cout << aDump << std::endl; + bool bCompare = checkDumpAgainstFile( aDump, getPathFromSrc("/chart2/qa/unit/data/reference/testChart.xml") ); + CPPUNIT_ASSERT(bCompare); } ScChartRegressionTest::ScChartRegressionTest() |