diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 18:42:24 +0000 |
commit | f508189682b6fba62e08feeb1596f682bad5fff9 (patch) | |
tree | 28aeb0e6c19386c385c1ce5edf8a92c1bca15281 /src/piklab-test/misc | |
download | piklab-f508189682b6fba62e08feeb1596f682bad5fff9.tar.gz piklab-f508189682b6fba62e08feeb1596f682bad5fff9.zip |
Added KDE3 version of PikLab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/piklab@1095639 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/piklab-test/misc')
-rw-r--r-- | src/piklab-test/misc/Makefile.am | 10 | ||||
-rw-r--r-- | src/piklab-test/misc/misc_check.cpp | 99 | ||||
-rw-r--r-- | src/piklab-test/misc/misc_check.h | 20 |
3 files changed, 129 insertions, 0 deletions
diff --git a/src/piklab-test/misc/Makefile.am b/src/piklab-test/misc/Makefile.am new file mode 100644 index 0000000..e21c3d1 --- /dev/null +++ b/src/piklab-test/misc/Makefile.am @@ -0,0 +1,10 @@ +INCLUDES = -I$(top_srcdir)/src $(all_includes) +METASOURCES = AUTO + +noinst_PROGRAMS = misc_check +OBJ = $(top_builddir)/src/piklab-test/base/libtest.la $(top_builddir)/src/common/cli/libcli.la \ + $(top_builddir)/src/common/global/libglobal.la $(top_builddir)/src/common/common/libcommon.la +misc_check_DEPENDENCIES = $(OBJ) +misc_check_LDADD = $(OBJ) $(LIB_KIO) +misc_check_LDFLAGS = $(all_libraries) $(KDE_RPATH) +misc_check_SOURCES = misc_check.cpp diff --git a/src/piklab-test/misc/misc_check.cpp b/src/piklab-test/misc/misc_check.cpp new file mode 100644 index 0000000..3f14287 --- /dev/null +++ b/src/piklab-test/misc/misc_check.cpp @@ -0,0 +1,99 @@ +/*************************************************************************** + * Copyright (C) 2007 Nicolas Hadacek <[email protected]> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#include "misc_check.h" + +#include "common/global/purl.h" + +//---------------------------------------------------------------------------- +bool MiscCheck::execute() +{ + { + PURL::Url url = PURL::Url::fromPathOrUrl(QString::null); + if ( !url.isEmpty() ) TEST_FAILED("isEmpty"); + TEST_PASSED; + } + { + PURL::Url url = PURL::Url::fromPathOrUrl(""); + if ( !url.isEmpty() ) TEST_FAILED("isEmpty"); + TEST_PASSED; + } + { + PURL::Url url = PURL::Url::fromPathOrUrl("/"); + if ( url.isEmpty() ) TEST_FAILED("isEmpty"); + if ( url.isRelative() ) TEST_FAILED("isRelative"); + if ( !url.isLocal() ) TEST_FAILED("isLocal"); + if ( url.path()!="/" ) TEST_FAILED(""); + if ( url.filepath()!="/" ) TEST_FAILED(url.filepath()); + if ( url.unterminatedPath()!="/" ) TEST_FAILED(""); + if ( !url.filename().isEmpty() ) TEST_FAILED(url.filename()); + TEST_PASSED; + } + { + PURL::Url url = PURL::Url::fromPathOrUrl("test"); + if ( url.isEmpty() ) TEST_FAILED("isEmpty"); + if ( !url.isRelative() ) TEST_FAILED("isRelative"); + if ( !url.isLocal() ) TEST_FAILED("isLocal"); + if ( url.filename()!="test" ) TEST_FAILED(url.filename()); + TEST_PASSED; + } + { + PURL::Url url = PURL::Url::fromPathOrUrl("/test"); + if ( url.isEmpty() ) TEST_FAILED("isEmpty"); + if ( url.isRelative() ) TEST_FAILED("isRelative"); + if ( !url.isLocal() ) TEST_FAILED("isLocal"); + if ( url.path()!="/" ) TEST_FAILED(""); + if ( url.unterminatedPath()!="/" ) TEST_FAILED(""); + if ( url.filepath()!="/test" ) TEST_FAILED(url.filepath()); + if ( url.filename()!="test" ) TEST_FAILED(url.filename()); + TEST_PASSED; + } + { + PURL::Url url = PURL::Url::fromPathOrUrl("/test/"); + if ( url.isEmpty() ) TEST_FAILED("isEmpty"); + if ( url.isRelative() ) TEST_FAILED("isRelative"); + if ( !url.isLocal() ) TEST_FAILED("isLocal"); + if ( url.path()!="/test/" ) TEST_FAILED(""); + if ( url.unterminatedPath()!="/test" ) TEST_FAILED(""); + if ( url.filepath()!="/test/" ) TEST_FAILED(url.filepath()); + if ( !url.filename().isEmpty() ) TEST_FAILED(url.filename()); + TEST_PASSED; + } + { + PURL::Url url = PURL::Url::fromPathOrUrl("c:/test"); + if ( url.isEmpty() ) TEST_FAILED("isEmpty"); + if ( url.isRelative() ) TEST_FAILED("isRelative"); + if ( !url.isLocal() ) TEST_FAILED("isLocal"); + PURL::Url url2 = PURL::Url::fromPathOrUrl("c:/"); + if ( url.path()!=url2.path() ) TEST_FAILED(url.path()); + if ( url==url2 ) TEST_FAILED(url.path()); + if ( url.filename()!="test" ) TEST_FAILED(url.filename()); + TEST_PASSED; + } + { + PURL::Url url = PURL::Url::fromPathOrUrl("d:/test/"); + if ( url.isEmpty() ) TEST_FAILED("isEmpty"); + if ( url.isRelative() ) TEST_FAILED("isRelative"); + if ( !url.isLocal() ) TEST_FAILED("isLocal"); + if ( !url.filename().isEmpty() ) TEST_FAILED(url.filename()); + TEST_PASSED; + } + { + PURL::Url url(KURL::fromPathOrURL("http://test.net/test")); + if ( url.isEmpty() ) TEST_FAILED("isEmpty"); + if ( url.isRelative() ) TEST_FAILED("isRelative"); + if ( url.isLocal() ) TEST_FAILED("isLocal"); + if ( url.filename()!="test" ) TEST_FAILED(url.filename()); + TEST_PASSED; + } + + return true; +} + +//---------------------------------------------------------------------------- +TEST_MAIN(MiscCheck) diff --git a/src/piklab-test/misc/misc_check.h b/src/piklab-test/misc/misc_check.h new file mode 100644 index 0000000..a36b3cf --- /dev/null +++ b/src/piklab-test/misc/misc_check.h @@ -0,0 +1,20 @@ +/*************************************************************************** + * Copyright (C) 2007 Nicolas Hadacek <[email protected]> * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ +#ifndef MISC_CHECK_H +#define MISC_CHECK_H + +#include "piklab-test/base/main_test.h" + +class MiscCheck : public Test +{ +protected: + virtual bool execute(); +}; + +#endif |