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