|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <QtTest/QtTest> |
|
19 #include <agendaentry.h> |
|
20 |
|
21 #include "calenagendautils.h" |
|
22 #include "test_calenagendautils.h" |
|
23 |
|
24 /*! |
|
25 \class TestCalenAgendaUtils |
|
26 |
|
27 This is unittest class for CalenAgendaUtils apis. |
|
28 */ |
|
29 |
|
30 TestCalenAgendaUtils::TestCalenAgendaUtils() |
|
31 { |
|
32 // No implementation yet |
|
33 } |
|
34 |
|
35 TestCalenAgendaUtils::~TestCalenAgendaUtils() |
|
36 { |
|
37 // No implementation yet |
|
38 } |
|
39 |
|
40 /*! |
|
41 This function is called to before every testcase. |
|
42 */ |
|
43 void TestCalenAgendaUtils::init() |
|
44 { |
|
45 // No implementation yet |
|
46 } |
|
47 |
|
48 /*! |
|
49 This function is called after every testcase. |
|
50 */ |
|
51 void TestCalenAgendaUtils::cleanup() |
|
52 { |
|
53 // No implementation yet |
|
54 } |
|
55 |
|
56 /*! |
|
57 This function is to test the api of CalenDateUtils::endsAtStartOfDayL. |
|
58 */ |
|
59 void TestCalenAgendaUtils::test_endsAtStartOfDay() |
|
60 { |
|
61 AgendaEntry entry; |
|
62 entry.setSummary("summary"); |
|
63 entry.setStartAndEndTime(QDateTime(QDate(2010, 5, 1), QTime(12, 30)), |
|
64 QDateTime(QDate(2010, 5, 6), QTime(2, 59))); |
|
65 bool outPut = CalenAgendaUtils::endsAtStartOfDay( |
|
66 entry, |
|
67 QDateTime(QDate(2010, 5, 6))); |
|
68 QVERIFY(!outPut); |
|
69 |
|
70 entry.setStartAndEndTime(QDateTime(QDate(2010, 5, 1), QTime(1, 35)), |
|
71 QDateTime(QDate(2010, 5, 6), QTime(23, 59))); |
|
72 outPut = CalenAgendaUtils::endsAtStartOfDay( |
|
73 entry, |
|
74 QDateTime(QDate(2010, 5, 6))); |
|
75 QVERIFY(!outPut); |
|
76 |
|
77 entry.setStartAndEndTime(QDateTime(QDate(2010, 5, 1), QTime(2, 30)), |
|
78 QDateTime(QDate(2010, 5, 5), QTime(23, 59, 59, 999))); |
|
79 outPut = CalenAgendaUtils::endsAtStartOfDay( |
|
80 entry, |
|
81 QDateTime(QDate(2010, 5, 6))); |
|
82 QVERIFY(!outPut); |
|
83 |
|
84 entry.setStartAndEndTime(QDateTime(QDate(2010, 5, 1), QTime(1, 35)), |
|
85 QDateTime(QDate(2010, 5, 6))); |
|
86 outPut = CalenAgendaUtils::endsAtStartOfDay( |
|
87 entry, |
|
88 QDateTime(QDate(2010, 5, 6))); |
|
89 QVERIFY(outPut); |
|
90 |
|
91 } |
|
92 // End of file --Don't remove this. |