Skip to content

Commit

Permalink
Changes: Modified the unit test template to make it easier to impleme…
Browse files Browse the repository at this point in the history
…nt tests

RevBy: TrustMe
  • Loading branch information
Vesa Halttunen committed Nov 4, 2010
1 parent e07e68c commit 894a27c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 10 deletions.
21 changes: 18 additions & 3 deletions tests/ut_template/ut_template.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation ([email protected])
**
** This file is part of systemui.
** This file is part of mhome.
**
** If you have questions regarding the use of this file, please contact
** Nokia at [email protected].
Expand All @@ -16,16 +16,31 @@
** of this file.
**
****************************************************************************/

#include <QtTest/QtTest>
#include <MApplication>
#include "ut_template.h"

void Ut_Template::init()
void Ut_Template::initTestCase()
{
static int argc = 1;
static char *app_name[1] = { (char *) "./ut_template" };
app = new MApplication(argc, app_name);
}

void Ut_Template::cleanupTestCase()
{
delete app;
}

void Ut_Template::cleanup()
void Ut_Template::init()
{
// m_subject = new Template();
}

void Ut_Template::cleanup()
{
// delete m_subject;
}

QTEST_APPLESS_MAIN(Ut_Template)
28 changes: 21 additions & 7 deletions tests/ut_template/ut_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,35 @@
** of this file.
**
****************************************************************************/
#ifndef _UT_TEST_
#define _UT_TEST_

#include <QtTest/QtTest>
#ifndef UT_TEMPLATE_H
#define UT_TEMPLATE_H

#include <QObject>

class MApplication;
//class Template;

class Ut_Template : public QObject
{
Q_OBJECT

private slots:
// Executed once before every test case
// Called before the first testfunction is executed
void initTestCase();
// Called after the last testfunction was executed
void cleanupTestCase();
// Called before each testfunction is executed
void init();

// Executed once after every test case
// Called after every testfunction
void cleanup();

// Test cases
private:
// MApplication
MApplication *app;
// The object being tested
// Template *m_subject;
};
#endif //_UT_TEST_

#endif

0 comments on commit 894a27c

Please sign in to comment.