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