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