summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/tests/kopetecontactlist_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kopete/libkopete/tests/kopetecontactlist_test.cpp')
-rw-r--r--kopete/libkopete/tests/kopetecontactlist_test.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/kopete/libkopete/tests/kopetecontactlist_test.cpp b/kopete/libkopete/tests/kopetecontactlist_test.cpp
new file mode 100644
index 00000000..001f3f0d
--- /dev/null
+++ b/kopete/libkopete/tests/kopetecontactlist_test.cpp
@@ -0,0 +1,55 @@
+/*
+ Tests for Kopete::ContactList class.
+
+ Copyright (c) 2005 by Duncan Mac-Vicar <duncan@kde.org>
+
+ Kopete (c) 2002-2005 by the Kopete developers <kopete-devel@kde.org>
+
+ *************************************************************************
+ * *
+ * 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 <qfile.h>
+#include <qdir.h>
+#include <kstandarddirs.h>
+#include <kunittest/module.h>
+#include "kopetecontactlist_test.h"
+
+using namespace KUnitTest;
+
+KUNITTEST_MODULE( kunittest_kopetecontactlist_test, "KopeteSuite");
+KUNITTEST_MODULE_REGISTER_TESTER( KopeteContactList_Test );
+
+void KopeteContactList_Test::allTests()
+{
+ testSomething();
+}
+
+void KopeteContactList_Test::testSomething()
+{
+ // change user data dir to avoid messing with user's .kde dir
+ setenv( "KDEHOME", QFile::encodeName( QDir::homeDirPath() + "/.kopete-unittest" ), true );
+
+ QString filename = locateLocal( "appdata", QString::fromLatin1( "contactlist.xml" ) );
+ if( ! filename.isEmpty() )
+ {
+ // previous test run, delete the previous contact list
+ bool removed = QFile::remove(filename);
+ // if we cant remove the file, abort test
+ if (!removed)
+ return;
+ }
+
+ int result = 1;
+ int expected = 1;
+ // result should be the expected one
+ CHECK(result, expected);
+}
+
+