summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/qa/unit/data/tolerance.xml7
-rw-r--r--sc/qa/extras/regression-test.cxx7
-rw-r--r--test/inc/test/xmldiff.hxx2
-rw-r--r--test/source/diff/diff.cxx10
4 files changed, 20 insertions, 6 deletions
diff --git a/chart2/qa/unit/data/tolerance.xml b/chart2/qa/unit/data/tolerance.xml
new file mode 100644
index 000000000000..d2c00fb5c902
--- /dev/null
+++ b/chart2/qa/unit/data/tolerance.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<tolerances>
+ <tolerance elementName="XShape" attribName="positionX" value="2" relative="false"/>
+ <tolerance elementName="XShape" attribName="positionY" value="2" relative="false"/>
+ <tolerance elementName="XShape" attribName="sizeX" value="2" relative="false"/>
+ <tolerance elementName="XShape" attribName="sizeY" value="2" relative="false"/>
+</tolerances>
diff --git a/sc/qa/extras/regression-test.cxx b/sc/qa/extras/regression-test.cxx
index 77a7557baa53..2c281058b864 100644
--- a/sc/qa/extras/regression-test.cxx
+++ b/sc/qa/extras/regression-test.cxx
@@ -65,14 +65,15 @@ using namespace ::com::sun::star::uno;
namespace {
-bool checkDumpAgainstFile( const rtl::OUString& rDump, const rtl::OUString aFilePath )
+bool checkDumpAgainstFile( const rtl::OUString& rDump, const rtl::OUString aFilePath, const rtl::OUString& rToleranceFile)
{
rtl::OString aOFile = rtl::OUStringToOString(aFilePath, RTL_TEXTENCODING_UTF8);
+ rtl::OString aToleranceFile = rtl::OUStringToOString(rToleranceFile, RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_MESSAGE("dump is empty", !rDump.isEmpty());
rtl::OString aDump = rtl::OUStringToOString(rDump, RTL_TEXTENCODING_UTF8);
- XMLDiff aDiff(aOFile.getStr(), aDump.getStr(),static_cast<int>(rDump.getLength()));
+ XMLDiff aDiff(aOFile.getStr(), aDump.getStr(),static_cast<int>(rDump.getLength()), aToleranceFile.getStr());
return aDiff.compare();
}
@@ -148,7 +149,7 @@ void ScChartRegressionTest::test()
rtl::OUString aDump = xDumper->dump();
std::cout << aDump;
- bool bCompare = checkDumpAgainstFile( aDump, getPathFromSrc("/chart2/qa/unit/data/reference/testChart.xml") );
+ bool bCompare = checkDumpAgainstFile( aDump, getPathFromSrc("/chart2/qa/unit/data/reference/testChart.xml"), getPathFromSrc("/chart2/qa/unit/data/tolerance.xml") );
CPPUNIT_ASSERT(bCompare);
}
diff --git a/test/inc/test/xmldiff.hxx b/test/inc/test/xmldiff.hxx
index a787132347d4..c0926371b8e0 100644
--- a/test/inc/test/xmldiff.hxx
+++ b/test/inc/test/xmldiff.hxx
@@ -78,7 +78,7 @@ class OOO_DLLPUBLIC_TEST XMLDiff
public:
XMLDiff(const std::string& file1, const std::string& file2, const std::string& toleranceFile);
XMLDiff(const std::string& file1, const std::string& file2);
- XMLDiff(const char* pFileName, const char* pContent, int size);
+ XMLDiff(const char* pFileName, const char* pContent, int size, const char* pToleranceFileName);
~XMLDiff();
bool compare();
diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx
index 8587fd799eb0..574805dc9c68 100644
--- a/test/source/diff/diff.cxx
+++ b/test/source/diff/diff.cxx
@@ -56,10 +56,14 @@ XMLDiff::XMLDiff(const std::string& file1, const std::string& file2)
xmlFile2 = xmlParseFile(file2.c_str());
}
-XMLDiff::XMLDiff( const char* pFileName, const char* pContent, int size)
+XMLDiff::XMLDiff( const char* pFileName, const char* pContent, int size, const char* pToleranceFile)
{
xmlFile1 = xmlParseFile(pFileName);
xmlFile2 = xmlParseMemory(pContent, size);
+
+ xmlDocPtr xmlToleranceFile = xmlParseFile(pToleranceFile);
+ loadToleranceFile(xmlToleranceFile);
+ xmlFreeDoc(xmlToleranceFile);
}
XMLDiff::~XMLDiff()
@@ -84,7 +88,9 @@ void readAttributesForTolerance(xmlNodePtr node, tolerance& tol)
tol.value = val;
xmlChar* relative = xmlGetProp(node, BAD_CAST("relative"));
- bool rel = xmlXPathCastStringToBoolean(relative);
+ bool rel = false;
+ if(xmlStrEqual(relative, BAD_CAST("true")))
+ rel = true;
xmlFree(relative);
tol.relative = rel;
}