diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /lib/kofficecore/tests/korecttest.cpp | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
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
Diffstat (limited to 'lib/kofficecore/tests/korecttest.cpp')
-rw-r--r-- | lib/kofficecore/tests/korecttest.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/lib/kofficecore/tests/korecttest.cpp b/lib/kofficecore/tests/korecttest.cpp new file mode 100644 index 00000000..9c2cb8b0 --- /dev/null +++ b/lib/kofficecore/tests/korecttest.cpp @@ -0,0 +1,53 @@ +#include <KoRect.h> +#include <stdio.h> +#include <kapplication.h> +#include <stdlib.h> +#include <kdebug.h> +#include <kglobal.h> + +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"); +} + |