Kaydet (Commit) 9b27d390 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

finish sd's regression test

Implemented a simple character based comparison of the exported file and
the reference file
üst 1234d599
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
$(eval $(call gb_CppunitTest_CppunitTest,sd_regression_test)) $(eval $(call gb_CppunitTest_CppunitTest,sd_regression_test))
$(eval $(call gb_CppunitTest_add_exception_objects,sd_regression_test, \ $(eval $(call gb_CppunitTest_add_exception_objects,sd_regression_test, \
sd/qa/unit/regression-test2 \ sd/qa/unit/regression-test \
)) ))
$(eval $(call gb_CppunitTest_add_linked_libs,sd_regression_test, \ $(eval $(call gb_CppunitTest_add_linked_libs,sd_regression_test, \
...@@ -113,7 +113,6 @@ $(eval $(call gb_CppunitTest_add_components,sd_regression_test,\ ...@@ -113,7 +113,6 @@ $(eval $(call gb_CppunitTest_add_components,sd_regression_test,\
ucb/source/core/ucb1 \ ucb/source/core/ucb1 \
ucb/source/ucp/expand/ucpexpand1 \ ucb/source/ucp/expand/ucpexpand1 \
ucb/source/ucp/file/ucpfile1 \ ucb/source/ucp/file/ucpfile1 \
ucb/source/ucp/gio/ucpgio \
ucb/source/ucp/package/ucppkg1 \ ucb/source/ucp/package/ucppkg1 \
ucb/source/ucp/tdoc/ucptdoc1 \ ucb/source/ucp/tdoc/ucptdoc1 \
unotools/util/utl \ unotools/util/utl \
......
This diff was suppressed by a .gitattributes entry.
...@@ -52,6 +52,44 @@ ...@@ -52,6 +52,44 @@
#include <osl/process.h> #include <osl/process.h>
#include <osl/thread.h> #include <osl/thread.h>
#include <string>
#include <iostream>
#include <rtl/oustringostreaminserter.hxx>
namespace {
bool compareFiles( const rtl::OUString& aFileNameOne, const rtl::OUString& aFileNameTwo)
{
rtl::OString aOFileNameOne = rtl::OUStringToOString(aFileNameOne, RTL_TEXTENCODING_UTF8);
std::ifstream aFileOne(aOFileNameOne.getStr());
rtl::OString aOFileNameTwo = rtl::OUStringToOString(aFileNameTwo, RTL_TEXTENCODING_UTF8);
std::ifstream aFileTwo(aOFileNameTwo.getStr());
CPPUNIT_ASSERT_MESSAGE("files not open", aFileOne.is_open() && aFileTwo.is_open());
sal_Int32 nLine = 1;
while(!aFileOne.eof() && !aFileTwo.eof())
{
std::string aLineFileOne;
std::string aLineFileTwo;
std::getline(aFileOne, aLineFileOne);
std::getline(aFileTwo, aLineFileTwo);
if( aLineFileOne != aLineFileTwo)
{
rtl::OStringBuffer aErrorMessage("Mismatch between reference file and exported file in line ");
aErrorMessage.append(nLine).append(".\nExpected: ");
aErrorMessage.append(aLineFileOne.c_str()).append("\nFound : ").append(aLineFileTwo.c_str());
CPPUNIT_ASSERT_MESSAGE(aErrorMessage.getStr(), false);
}
nLine++;
}
return true;
}
}
/* Implementation of Filters test */ /* Implementation of Filters test */
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -155,6 +193,8 @@ void SdFiltersTest::test() ...@@ -155,6 +193,8 @@ void SdFiltersTest::test()
xStorable->storeToURL( aNewSvgURL, aArgs ); xStorable->storeToURL( aNewSvgURL, aArgs );
compareFiles( getPathFromSrc("/sd/qa/unit/data/svg/test.svg"), getPathFromSolver("/unittest/sd/test2.svg") );
xDocShRef->DoClose(); xDocShRef->DoClose();
} }
......
...@@ -78,6 +78,12 @@ public: ...@@ -78,6 +78,12 @@ public:
// return a URL to a given c-str path from the source directory // return a URL to a given c-str path from the source directory
::rtl::OUString getURLFromSrc( const char *pPath ); ::rtl::OUString getURLFromSrc( const char *pPath );
// return a Path to a given c-str path from the source directory
::rtl::OUString getPathFromSrc( const char *pPath );
// return a Path to a given c-str path from the solver directory
::rtl::OUString getPathFromSolver( const char *pPath );
virtual void setUp(); virtual void setUp();
virtual void tearDown(); virtual void tearDown();
......
...@@ -77,6 +77,16 @@ test::BootstrapFixtureBase::~BootstrapFixtureBase() ...@@ -77,6 +77,16 @@ test::BootstrapFixtureBase::~BootstrapFixtureBase()
return m_aSrcRootURL + rtl::OUString::createFromAscii( pPath ); return m_aSrcRootURL + rtl::OUString::createFromAscii( pPath );
} }
::rtl::OUString test::BootstrapFixtureBase::getPathFromSrc( const char *pPath )
{
return m_aSrcRootPath + rtl::OUString::createFromAscii( pPath );
}
::rtl::OUString test::BootstrapFixtureBase::getPathFromSolver( const char *pPath )
{
return m_aSolverRootPath + rtl::OUString::createFromAscii( pPath );
}
void test::BootstrapFixtureBase::setUp() void test::BootstrapFixtureBase::setUp()
{ {
// set UserInstallation to user profile dir in test/user-template // set UserInstallation to user profile dir in test/user-template
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment