summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-27 02:13:04 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2012-04-27 03:15:31 +0200
commitb1dc2c5818f9d31e58131f5b2b79a41a366fab35 (patch)
tree21dc6835e41c45f6f9a47c9d11d6b8d4634da312 /sc/qa
parent9f9e6a765450d85f2fd9339fb10fb2ee6d45cd05 (diff)
use the new xml diff in chart regression test
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/regression-test.cxx34
1 files changed, 6 insertions, 28 deletions
diff --git a/sc/qa/extras/regression-test.cxx b/sc/qa/extras/regression-test.cxx
index 812e218be648..98ef5412393b 100644
--- a/sc/qa/extras/regression-test.cxx
+++ b/sc/qa/extras/regression-test.cxx
@@ -51,6 +51,8 @@
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/qa/XDumper.hpp>
+#include <test/xmldiff.hxx>
+
#include <basic/sbxdef.hxx>
#include "docsh.hxx"
@@ -66,37 +68,13 @@ 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;
+ rtl::OString aDump = rtl::OUStringToOString(rDump, RTL_TEXTENCODING_UTF8);
+ XMLDiff aDiff(aOFile.getStr(), aDump.getStr(),static_cast<int>(rDump.getLength()));
+
+ return aDiff.compare();
}
}