calendarui/views/dayview/tsrc/unittests/unittest_calendayitem/unittest_calendayitem.cpp
equal
deleted
inserted
replaced
17 #include <QGraphicsItem> |
17 #include <QGraphicsItem> |
18 #include <QtTest/QtTest> |
18 #include <QtTest/QtTest> |
19 |
19 |
20 |
20 |
21 #include "calendayitem.h" |
21 #include "calendayitem.h" |
|
22 #include "calendaycontainer.h" |
22 |
23 |
23 class TestCalenDayItem : public QObject |
24 class TestCalenDayItem : public QObject |
24 { |
25 { |
25 Q_OBJECT |
26 Q_OBJECT |
26 |
27 |
37 void testConstructors(); |
38 void testConstructors(); |
38 void testCreateItem(); |
39 void testCreateItem(); |
39 |
40 |
40 private: |
41 private: |
41 CalenDayItem *mItem; |
42 CalenDayItem *mItem; |
|
43 CalenDayContainer *mContainer; |
42 }; |
44 }; |
43 |
45 |
44 /*! |
46 /*! |
45 Constructor |
47 Constructor |
46 */ |
48 */ |
76 /*! |
78 /*! |
77 Called before every function |
79 Called before every function |
78 */ |
80 */ |
79 void TestCalenDayItem::init() |
81 void TestCalenDayItem::init() |
80 { |
82 { |
81 mItem = new CalenDayItem(); |
83 mContainer = new CalenDayContainer(); |
|
84 mItem = new CalenDayItem(mContainer); |
82 } |
85 } |
83 |
86 |
84 /*! |
87 /*! |
85 Called after everyfunction |
88 Called after everyfunction |
86 */ |
89 */ |
87 void TestCalenDayItem::cleanup() |
90 void TestCalenDayItem::cleanup() |
88 { |
91 { |
89 if (mItem) { |
92 if (mItem) { |
90 delete mItem; |
93 delete mItem; |
91 mItem = NULL; |
94 mItem = NULL; |
|
95 } |
|
96 |
|
97 if (mContainer) { |
|
98 delete mContainer; |
|
99 mContainer = NULL; |
92 } |
100 } |
93 } |
101 } |
94 |
102 |
95 /*! |
103 /*! |
96 Test function for constructors |
104 Test function for constructors |
102 //1) |
110 //1) |
103 CalenDayItem *testItem = 0; |
111 CalenDayItem *testItem = 0; |
104 QVERIFY(!testItem); |
112 QVERIFY(!testItem); |
105 |
113 |
106 //2) |
114 //2) |
107 testItem = new CalenDayItem(); |
115 testItem = new CalenDayItem(mContainer); |
108 QVERIFY(testItem); |
116 QVERIFY(testItem); |
109 delete testItem; |
117 delete testItem; |
110 } |
118 } |
111 |
119 |
112 /*! |
120 /*! |