|
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 CalenDayContainerWidget |
|
15 * |
|
16 */ |
|
17 #include <QtTest/QtTest> |
|
18 |
|
19 #include "calendaycontainer.h" |
|
20 |
|
21 // Test variables |
|
22 QRectF gTestWindowRect = QRectF(0, 0, 10, 20); |
|
23 Qt::Orientation gTestOrientation = Qt::Horizontal; |
|
24 |
|
25 class TestCalenDayContainer : public QObject |
|
26 { |
|
27 Q_OBJECT |
|
28 |
|
29 public: |
|
30 TestCalenDayContainer(); |
|
31 virtual ~TestCalenDayContainer(); |
|
32 |
|
33 private slots: |
|
34 void initTestCase(); |
|
35 void cleanupTestCase(); |
|
36 void init(); |
|
37 void cleanup(); |
|
38 |
|
39 void testConstructors(); |
|
40 |
|
41 private: |
|
42 CalenDayContainer *mContainer; |
|
43 }; |
|
44 |
|
45 /*! |
|
46 Constructor |
|
47 */ |
|
48 TestCalenDayContainer::TestCalenDayContainer() : |
|
49 mContainer(NULL) |
|
50 { |
|
51 |
|
52 } |
|
53 |
|
54 /*! |
|
55 Destructor |
|
56 */ |
|
57 TestCalenDayContainer::~TestCalenDayContainer() |
|
58 { |
|
59 |
|
60 } |
|
61 |
|
62 /*! |
|
63 Called before testcase |
|
64 */ |
|
65 void TestCalenDayContainer::initTestCase() |
|
66 { |
|
67 } |
|
68 |
|
69 /*! |
|
70 Called after testcase |
|
71 */ |
|
72 void TestCalenDayContainer::cleanupTestCase() |
|
73 { |
|
74 |
|
75 } |
|
76 |
|
77 /*! |
|
78 Called before every function |
|
79 */ |
|
80 void TestCalenDayContainer::init() |
|
81 { |
|
82 mContainer = new CalenDayContainer(); |
|
83 } |
|
84 |
|
85 /*! |
|
86 Called after everyfunction |
|
87 */ |
|
88 void TestCalenDayContainer::cleanup() |
|
89 { |
|
90 if (mContainer) { |
|
91 delete mContainer; |
|
92 mContainer = NULL; |
|
93 } |
|
94 } |
|
95 |
|
96 /*! |
|
97 Test function for constructors |
|
98 1. Test if container is not initialized |
|
99 2. Test if container is correcty created |
|
100 */ |
|
101 void TestCalenDayContainer::testConstructors() |
|
102 { |
|
103 //1) |
|
104 CalenDayContainer *testContainer = 0; |
|
105 QVERIFY(!testContainer); |
|
106 |
|
107 //2) |
|
108 testContainer = new CalenDayContainer(); |
|
109 QVERIFY(testContainer); |
|
110 |
|
111 delete testContainer; |
|
112 } |
|
113 |
|
114 QTEST_MAIN(TestCalenDayContainer); |
|
115 #include "unittest_calendaycontainer.moc" |