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/kofficecore/tests/korecttest.cpp | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 lib/kofficecore/tests/korecttest.cpp (limited to 'lib/kofficecore/tests/korecttest.cpp') diff --git a/lib/kofficecore/tests/korecttest.cpp b/lib/kofficecore/tests/korecttest.cpp new file mode 100644 index 000000000..9c2cb8b08 --- /dev/null +++ b/lib/kofficecore/tests/korecttest.cpp @@ -0,0 +1,53 @@ +#include +#include +#include +#include +#include +#include + +bool check(QString txt, bool res, bool expected) +{ + if (res == expected) { + kdDebug() << txt << " : checking '" << res << "' against expected value '" << expected << "'... " << "ok" << endl; + } + else { + kdDebug() << txt << " : checking '" << res << "' against expected value '" << expected << "'... " << "KO !" << endl; + exit(1); + } + return true; +} + +bool check(QString txt, QString a, QString b) +{ + if (a.isEmpty()) + a = QString::null; + if (b.isEmpty()) + b = QString::null; + if (a == b) { + kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl; + } + else { + kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "KO !" << endl; + exit(1); + } + return true; +} + +int main(int argc, char *argv[]) +{ + KApplication app(argc,argv,"korecttest",false,false); + + KoRect emptyRect; + check( "KoRect() is null", emptyRect.isNull(), true ); + check( "KoRect() is empty", emptyRect.isEmpty(), true ); + KoRect rect( 1, 15, 250, 156.14 ); + check( "KoRect(...) is not null", rect.isNull(), false ); + check( "KoRect(...) is not empty", rect.isEmpty(), false ); + KoRect unionRect = rect | emptyRect; + check( "Union is not null", unionRect.isNull(), false ); + check( "Union is not empty", unionRect.isEmpty(), false ); + kdDebug() << unionRect << endl; + + printf("\nTest OK !\n"); +} + -- cgit v1.2.3