From 8362bf63dea22bbf6736609b0f49c152f975eb63 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 20 Jan 2010 01:29:50 +0000 Subject: Added old abandoned KDE3 version of koffice git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- lib/store/tests/xmlwritertest.h | 46 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 lib/store/tests/xmlwritertest.h (limited to 'lib/store/tests/xmlwritertest.h') diff --git a/lib/store/tests/xmlwritertest.h b/lib/store/tests/xmlwritertest.h new file mode 100644 index 000000000..c5dc76e75 --- /dev/null +++ b/lib/store/tests/xmlwritertest.h @@ -0,0 +1,46 @@ +#ifndef XMLWRITERTEST_H +#define XMLWRITERTEST_H + +#define QT_NO_CAST_ASCII + +// Those macros are in a separate header file in order to share them +// with kofficecore/tests/kogenstylestest.cpp + +#include +#include + +#define TEST_BEGIN(publicId,systemId) \ + { \ + QCString cstr; \ + QBuffer buffer( cstr ); \ + buffer.open( IO_WriteOnly ); \ + { \ + KoXmlWriter writer( &buffer ); \ + writer.startDocument( "r", publicId, systemId ); \ + writer.startElement( "r" ) + +#define TEST_END(testname, expected) \ + writer.endElement(); \ + writer.endDocument(); \ + } \ + buffer.putch( '\0' ); /*null-terminate*/ \ + QCString expectedFull( "\n" ); \ + expectedFull += expected; \ + if ( cstr == expectedFull ) \ + qDebug( "%s OK", testname ); \ + else { \ + qDebug( "%s FAILED!", testname ); \ + QCString s1 = cstr; \ + QCString s2 = expectedFull; \ + if ( s1.length() != s2.length() ) \ + qDebug( "got length %d, expected %d", s1.length(), s2.length() ); \ + s1.replace( QRegExp( QString::fromLatin1( "[x]{1000}" ) ), "[x]*1000" ); \ + s2.replace( QRegExp( QString::fromLatin1( "[x]{1000}" ) ), "[x]*1000" ); \ + qDebug( "%s", s1.data() ); \ + qDebug( "Expected:\n%s", s2.data() ); \ + return 1; /*exit*/ \ + } \ + } + + +#endif -- cgit v1.2.3