summaryrefslogtreecommitdiffstats
path: root/kopete/libkopete/tests/kopetecontactlist_test.cpp
blob: 933a67bb0f60b98a81bd9da6a6648456cea8a52d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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 <tqfile.h>
#include <tqdir.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", TQFile::encodeName( TQDir::homeDirPath() + "/.kopete-unittest" ), true );

	TQString filename = locateLocal( "appdata", TQString::tqfromLatin1( "contactlist.xml" ) );
	if( ! filename.isEmpty() )
	{
		// previous test run, delete the previous contact list
		bool removed = TQFile::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);
}