Commit 0f2fd571 authored by Lukas Appelhans's avatar Lukas Appelhans

Simple test for groups

parent c335097d
......@@ -26,4 +26,17 @@ if(CMAKE_BUILD_TYPE MATCHES debugfull)
target_link_libraries(akabei_hook_test ${QT_QTTEST_LIBRARY} akabeicore)
add_test(akabei akabei_hook_test)
#Group test
set(akabei_group_test_SRCS
akabeigrouptest.cpp
)
qt4_wrap_cpp(akabei_group_test_MOC_SRCS akabeigrouptest.h)
add_executable(akabei_group_test ${akabei_group_test_SRCS} ${akabei_group_test_MOC_SRCS})
target_link_libraries(akabei_group_test ${QT_QTTEST_LIBRARY} akabeicore)
add_test(akabei akabei_group_test)
endif(CMAKE_BUILD_TYPE MATCHES debugfull)
/* This file is part of the Chakra project
Copyright (C) 2011 Lukas Appelhans
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 "akabeigrouptest.h"
#include <akabeibackend.h>
#include <akabeigroup.h>
#include <QFile>
#include <QTest>
#include <QDebug>
AkabeiGroupTest::AkabeiGroupTest(QObject* parent): QObject(parent)
{
}
void AkabeiGroupTest::test()
{
QString name = "bla.group";
QString content = "Name=bla\nIconname=foo\nDescription=bar";
QFile *hFile = new QFile("/tmp/" + name);
hFile->open(QFile::WriteOnly);
hFile->write(content.toAscii());
hFile->close();
QVERIFY(hFile->exists());
Akabei::Group * g = Akabei::Backend::instance()->loadGroupFromFile(hFile->fileName());
QVERIFY(g);
QVERIFY(g->name() == "bla");
QVERIFY(g->description() == "bar");
QVERIFY(g->iconName() == "foo");
}
QTEST_MAIN(AkabeiGroupTest)
/* This file is part of the Chakra project
Copyright (C) 2011 Lukas Appelhans
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 AKABEIGROUPTEST_H
#define AKABEIGROUPTEST_H
#include <QtCore/QObject>
class AkabeiGroupTest : public QObject
{
Q_OBJECT
public:
explicit AkabeiGroupTest(QObject* parent = 0);
private slots:
void test();
};
#endif // AKABEIGROUPTEST_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment