calendarui/views/dayview/tsrc/unittests/unittest_calendayutils/unittest_calendayutils.cpp
equal
deleted
inserted
replaced
15 * |
15 * |
16 */ |
16 */ |
17 #include <QGraphicsItem> |
17 #include <QGraphicsItem> |
18 #include <QtTest/QtTest> |
18 #include <QtTest/QtTest> |
19 |
19 |
|
20 #include "hbstyle.h" |
20 #include "calendayutils.h" |
21 #include "calendayutils.h" |
21 #include "hbdeviceprofile.h" |
22 #include "hbdeviceprofile.h" |
22 #include "calendaycommonheaders.h" |
23 #include "calendaycommonheaders.h" |
23 |
24 |
24 // Test variables |
25 // Test variables |
25 QRectF gTestWindowRect = QRectF(0, 0, 10, 20); |
26 QRectF gTestWindowRect = QRectF(0, 0, 10, 20); |
26 Qt::Orientation gTestOrientation = Qt::Horizontal; |
27 Qt::Orientation gTestOrientation = Qt::Horizontal; |
27 qreal param_value = 10; |
28 qreal param_value = 10; |
|
29 qreal unitInPix = 1; |
28 |
30 |
29 class TestCalenDayUtils : public QObject |
31 class TestCalenDayUtils : public QObject |
30 { |
32 { |
31 Q_OBJECT |
33 Q_OBJECT |
32 |
34 |
45 void testHourElementWidth(); |
47 void testHourElementWidth(); |
46 void testHourElementHeight(); |
48 void testHourElementHeight(); |
47 void testContentWidth(); |
49 void testContentWidth(); |
48 |
50 |
49 void testConstructors(); |
51 void testConstructors(); |
50 void testHorizontalSwipe(); |
|
51 void testOrientation(); |
52 void testOrientation(); |
52 |
53 |
53 private: |
54 private: |
54 CalenDayUtils *mUtils; |
55 CalenDayUtils *mUtils; |
55 qreal mUnit; |
56 qreal mUnit; |
156 //2) |
157 //2) |
157 testUtils = CalenDayUtils::instance(); |
158 testUtils = CalenDayUtils::instance(); |
158 QVERIFY(testUtils); |
159 QVERIFY(testUtils); |
159 } |
160 } |
160 |
161 |
161 /*! |
|
162 Test function for checking if swipe is horizontal or not |
|
163 1)test Horizontal swipe |
|
164 2)test no horizontal swipe |
|
165 */ |
|
166 void TestCalenDayUtils::testHorizontalSwipe() |
|
167 { |
|
168 //1) |
|
169 QCOMPARE(CalenDayUtils::instance()->isHorizontalSwipe(KCalenSwipeAngle-5), |
|
170 true); |
|
171 |
|
172 //2) |
|
173 QCOMPARE(CalenDayUtils::instance()->isHorizontalSwipe(KCalenSwipeAngle+5), |
|
174 false); |
|
175 } |
|
176 |
162 |
177 /*! |
163 /*! |
178 Test function for getting main window's orientation |
164 Test function for getting main window's orientation |
179 1)test if horizontal orientation is returned |
165 1)test if horizontal orientation is returned |
180 2)test if vertical orientation is returned |
166 2)test if vertical orientation is returned |