45
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Test class for CalenDayContentWidget
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include <QGraphicsItem>
|
|
18 |
#include <QtTest/QtTest>
|
|
19 |
|
|
20 |
#include "calendayhourelement.h"
|
|
21 |
|
|
22 |
class TestCalenDayHourElement : public QObject
|
|
23 |
{
|
|
24 |
Q_OBJECT
|
|
25 |
|
|
26 |
public:
|
|
27 |
TestCalenDayHourElement();
|
|
28 |
virtual ~TestCalenDayHourElement();
|
|
29 |
|
|
30 |
private slots:
|
|
31 |
void initTestCase();
|
|
32 |
void cleanupTestCase();
|
|
33 |
void init();
|
|
34 |
void cleanup();
|
|
35 |
|
|
36 |
void testConstructors();
|
|
37 |
|
|
38 |
private:
|
|
39 |
CalenDayHourElement *mHourElement;
|
|
40 |
QTime mTime;
|
|
41 |
};
|
|
42 |
|
|
43 |
/*!
|
|
44 |
Constructor
|
|
45 |
*/
|
|
46 |
TestCalenDayHourElement::TestCalenDayHourElement() :
|
|
47 |
mHourElement(NULL)
|
|
48 |
{
|
|
49 |
|
|
50 |
}
|
|
51 |
|
|
52 |
/*!
|
|
53 |
Destructor
|
|
54 |
*/
|
|
55 |
TestCalenDayHourElement::~TestCalenDayHourElement()
|
|
56 |
{
|
|
57 |
|
|
58 |
}
|
|
59 |
|
|
60 |
/*!
|
|
61 |
Called before testcase
|
|
62 |
*/
|
|
63 |
void TestCalenDayHourElement::initTestCase()
|
|
64 |
{
|
|
65 |
}
|
|
66 |
|
|
67 |
/*!
|
|
68 |
Called after testcase
|
|
69 |
*/
|
|
70 |
void TestCalenDayHourElement::cleanupTestCase()
|
|
71 |
{
|
|
72 |
|
|
73 |
}
|
|
74 |
|
|
75 |
/*!
|
|
76 |
Called before every function
|
|
77 |
*/
|
|
78 |
void TestCalenDayHourElement::init()
|
|
79 |
{
|
|
80 |
mHourElement = new CalenDayHourElement(mTime);
|
|
81 |
}
|
|
82 |
|
|
83 |
/*!
|
|
84 |
Called after everyfunction
|
|
85 |
*/
|
|
86 |
void TestCalenDayHourElement::cleanup()
|
|
87 |
{
|
|
88 |
if (mHourElement) {
|
|
89 |
delete mHourElement;
|
|
90 |
mHourElement = NULL;
|
|
91 |
}
|
|
92 |
}
|
|
93 |
|
|
94 |
/*!
|
|
95 |
Test function for constructors
|
|
96 |
1. Test if content widget is not initialized
|
|
97 |
2. Test if content widget is correcty created
|
|
98 |
*/
|
|
99 |
void TestCalenDayHourElement::testConstructors()
|
|
100 |
{
|
|
101 |
//1)
|
|
102 |
CalenDayHourElement *testHourElement = 0;
|
|
103 |
QVERIFY(!testHourElement);
|
|
104 |
|
|
105 |
testHourElement = new CalenDayHourElement(mTime);
|
|
106 |
|
|
107 |
QVERIFY(testHourElement);
|
|
108 |
|
|
109 |
delete testHourElement;
|
|
110 |
}
|
|
111 |
|
|
112 |
QTEST_MAIN(TestCalenDayHourElement);
|
|
113 |
#include "unittest_calendayhourelement.moc"
|