Changeset View
Changeset View
Standalone View
Standalone View
src/freebusymodel/autotests/testfreebusyitemmodel.cpp
Show All 17 Lines | 1 | /* | |||
---|---|---|---|---|---|
18 | 02110-1301, USA. | 18 | 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include "testfreebusyitemmodel.h" | 21 | #include "testfreebusyitemmodel.h" | ||
22 | #include "modeltest.h" | 22 | #include "modeltest.h" | ||
23 | #include "../freebusyitemmodel.h" | 23 | #include "../freebusyitemmodel.h" | ||
24 | #include "../freebusyitem.h" | 24 | #include "../freebusyitem.h" | ||
25 | 25 | | |||
26 | #include <KCalCore/Attendee> | 26 | #include <KCalendarCore/Attendee> | ||
27 | 27 | | |||
28 | #include <QTest> | 28 | #include <QTest> | ||
29 | 29 | | |||
30 | using namespace CalendarSupport; | 30 | using namespace CalendarSupport; | ||
31 | 31 | | |||
32 | // Workaround QTBUG-51789 causing a crash when QtWebEngineWidgets | 32 | // Workaround QTBUG-51789 causing a crash when QtWebEngineWidgets | ||
33 | // is linked into a QCoreApplication. | 33 | // is linked into a QCoreApplication. | ||
34 | QTEST_GUILESS_MAIN(FreeBusyItemModelTest) | 34 | QTEST_GUILESS_MAIN(FreeBusyItemModelTest) | ||
35 | 35 | | |||
36 | void FreeBusyItemModelTest::testModelValidity() | 36 | void FreeBusyItemModelTest::testModelValidity() | ||
37 | { | 37 | { | ||
38 | FreeBusyItemModel *model = new FreeBusyItemModel(this); | 38 | FreeBusyItemModel *model = new FreeBusyItemModel(this); | ||
39 | new ModelTest(model, this); | 39 | new ModelTest(model, this); | ||
40 | 40 | | |||
41 | QVERIFY(model->rowCount() == 0); | 41 | QVERIFY(model->rowCount() == 0); | ||
42 | 42 | | |||
43 | const QDateTime dt1(QDate(2010, 7, 24), QTime(7, 0, 0), Qt::UTC); | 43 | const QDateTime dt1(QDate(2010, 7, 24), QTime(7, 0, 0), Qt::UTC); | ||
44 | const QDateTime dt2(QDate(2010, 7, 24), QTime(10, 0, 0), Qt::UTC); | 44 | const QDateTime dt2(QDate(2010, 7, 24), QTime(10, 0, 0), Qt::UTC); | ||
45 | KCalCore::Attendee a1(QStringLiteral("fred"), QStringLiteral( "fred@example.com")); | 45 | KCalendarCore::Attendee a1(QStringLiteral("fred"), QStringLiteral( "fred@example.com")); | ||
46 | KCalCore::FreeBusy::Ptr fb1(new KCalCore::FreeBusy()); | 46 | KCalendarCore::FreeBusy::Ptr fb1(new KCalendarCore::FreeBusy()); | ||
47 | 47 | | |||
48 | fb1->addPeriod(dt1, KCalCore::Duration(60 * 60)); | 48 | fb1->addPeriod(dt1, KCalendarCore::Duration(60 * 60)); | ||
49 | fb1->addPeriod(dt2, KCalCore::Duration(60 * 60)); | 49 | fb1->addPeriod(dt2, KCalendarCore::Duration(60 * 60)); | ||
50 | 50 | | |||
51 | FreeBusyItem::Ptr item1(new FreeBusyItem(a1, nullptr)); | 51 | FreeBusyItem::Ptr item1(new FreeBusyItem(a1, nullptr)); | ||
52 | item1->setFreeBusy(fb1); | 52 | item1->setFreeBusy(fb1); | ||
53 | 53 | | |||
54 | model->addItem(item1); | 54 | model->addItem(item1); | ||
55 | QVERIFY(model->rowCount() == 1); | 55 | QVERIFY(model->rowCount() == 1); | ||
56 | QVERIFY(model->containsAttendee(a1)); | 56 | QVERIFY(model->containsAttendee(a1)); | ||
57 | 57 | | |||
58 | QModelIndex i = model->index(0, 0); | 58 | QModelIndex i = model->index(0, 0); | ||
59 | QCOMPARE(a1.fullName(), model->data(i, Qt::DisplayRole).toString()); | 59 | QCOMPARE(a1.fullName(), model->data(i, Qt::DisplayRole).toString()); | ||
60 | QCOMPARE(a1, | 60 | QCOMPARE(a1, | ||
61 | model->data(i, FreeBusyItemModel::AttendeeRole).value<KCalCore::Attendee>()); | 61 | model->data(i, FreeBusyItemModel::AttendeeRole).value<KCalendarCore::Attendee>()); | ||
62 | QCOMPARE(item1->freeBusy(), | 62 | QCOMPARE(item1->freeBusy(), | ||
63 | model->data(i, FreeBusyItemModel::FreeBusyRole).value<KCalCore::FreeBusy::Ptr>()); | 63 | model->data(i, FreeBusyItemModel::FreeBusyRole).value<KCalendarCore::FreeBusy::Ptr>()); | ||
64 | 64 | | |||
65 | QCOMPARE(model->rowCount(i), 2); | 65 | QCOMPARE(model->rowCount(i), 2); | ||
66 | 66 | | |||
67 | model->removeRow(0); | 67 | model->removeRow(0); | ||
68 | QVERIFY(model->rowCount() == 0); | 68 | QVERIFY(model->rowCount() == 0); | ||
69 | 69 | | |||
70 | model->addItem(item1); | 70 | model->addItem(item1); | ||
71 | QVERIFY(model->rowCount() == 1); | 71 | QVERIFY(model->rowCount() == 1); | ||
Show All 19 Lines | 90 | { | |||
91 | FreeBusyItemModel *model = new FreeBusyItemModel(this); | 91 | FreeBusyItemModel *model = new FreeBusyItemModel(this); | ||
92 | new ModelTest(model, this); | 92 | new ModelTest(model, this); | ||
93 | 93 | | |||
94 | const QDateTime dt1(QDate(2010, 7, 24), QTime(7, 0, 0), Qt::UTC); | 94 | const QDateTime dt1(QDate(2010, 7, 24), QTime(7, 0, 0), Qt::UTC); | ||
95 | const QDateTime dt2(QDate(2010, 7, 24), QTime(10, 0, 0), Qt::UTC); | 95 | const QDateTime dt2(QDate(2010, 7, 24), QTime(10, 0, 0), Qt::UTC); | ||
96 | const QDateTime dt3(QDate(2010, 7, 24), QTime(12, 0, 0), Qt::UTC); | 96 | const QDateTime dt3(QDate(2010, 7, 24), QTime(12, 0, 0), Qt::UTC); | ||
97 | const QDateTime dt4(QDate(2010, 7, 24), QTime(14, 0, 0), Qt::UTC); | 97 | const QDateTime dt4(QDate(2010, 7, 24), QTime(14, 0, 0), Qt::UTC); | ||
98 | 98 | | |||
99 | KCalCore::Attendee a1(QStringLiteral("fred"), QStringLiteral( "fred@example.com")); | 99 | KCalendarCore::Attendee a1(QStringLiteral("fred"), QStringLiteral( "fred@example.com")); | ||
100 | KCalCore::Attendee a2(QStringLiteral("joe"), QStringLiteral( "joe@example.com")); | 100 | KCalendarCore::Attendee a2(QStringLiteral("joe"), QStringLiteral( "joe@example.com")); | ||
101 | KCalCore::Attendee a3(QStringLiteral("max"), QStringLiteral( "max@example.com")); | 101 | KCalendarCore::Attendee a3(QStringLiteral("max"), QStringLiteral( "max@example.com")); | ||
102 | KCalCore::FreeBusy::Ptr fb1(new KCalCore::FreeBusy()); | 102 | KCalendarCore::FreeBusy::Ptr fb1(new KCalendarCore::FreeBusy()); | ||
103 | KCalCore::FreeBusy::Ptr fb2(new KCalCore::FreeBusy()); | 103 | KCalendarCore::FreeBusy::Ptr fb2(new KCalendarCore::FreeBusy()); | ||
104 | KCalCore::FreeBusy::Ptr fb3(new KCalCore::FreeBusy()); | 104 | KCalendarCore::FreeBusy::Ptr fb3(new KCalendarCore::FreeBusy()); | ||
105 | 105 | | |||
106 | fb1->addPeriod(dt1, KCalCore::Duration(60 * 60)); | 106 | fb1->addPeriod(dt1, KCalendarCore::Duration(60 * 60)); | ||
107 | fb1->addPeriod(dt2, KCalCore::Duration(60 * 60)); | 107 | fb1->addPeriod(dt2, KCalendarCore::Duration(60 * 60)); | ||
108 | 108 | | |||
109 | fb2->addPeriod(dt1, KCalCore::Duration(60 * 60)); | 109 | fb2->addPeriod(dt1, KCalendarCore::Duration(60 * 60)); | ||
110 | fb2->addPeriod(dt2, KCalCore::Duration(60 * 60)); | 110 | fb2->addPeriod(dt2, KCalendarCore::Duration(60 * 60)); | ||
111 | fb2->addPeriod(dt3, KCalCore::Duration(60 * 60)); | 111 | fb2->addPeriod(dt3, KCalendarCore::Duration(60 * 60)); | ||
112 | 112 | | |||
113 | fb3->addPeriod(dt1, KCalCore::Duration(60 * 60)); | 113 | fb3->addPeriod(dt1, KCalendarCore::Duration(60 * 60)); | ||
114 | fb3->addPeriod(dt2, KCalCore::Duration(60 * 60)); | 114 | fb3->addPeriod(dt2, KCalendarCore::Duration(60 * 60)); | ||
115 | fb3->addPeriod(dt4, KCalCore::Duration(60 * 60 * 2)); | 115 | fb3->addPeriod(dt4, KCalendarCore::Duration(60 * 60 * 2)); | ||
116 | 116 | | |||
117 | FreeBusyItem::Ptr item1(new FreeBusyItem(a1, nullptr)); | 117 | FreeBusyItem::Ptr item1(new FreeBusyItem(a1, nullptr)); | ||
118 | item1->setFreeBusy(fb1); | 118 | item1->setFreeBusy(fb1); | ||
119 | FreeBusyItem::Ptr item2(new FreeBusyItem(a2, nullptr)); | 119 | FreeBusyItem::Ptr item2(new FreeBusyItem(a2, nullptr)); | ||
120 | FreeBusyItem::Ptr item3(new FreeBusyItem(a3, nullptr)); | 120 | FreeBusyItem::Ptr item3(new FreeBusyItem(a3, nullptr)); | ||
121 | 121 | | |||
122 | model->addItem(item1); | 122 | model->addItem(item1); | ||
123 | model->addItem(item2); | 123 | model->addItem(item2); | ||
124 | model->addItem(item3); | 124 | model->addItem(item3); | ||
125 | 125 | | |||
126 | QCOMPARE(model->rowCount(), 3); | 126 | QCOMPARE(model->rowCount(), 3); | ||
127 | 127 | | |||
128 | QVERIFY(model->containsAttendee(a1)); | 128 | QVERIFY(model->containsAttendee(a1)); | ||
129 | QVERIFY(model->containsAttendee(a2)); | 129 | QVERIFY(model->containsAttendee(a2)); | ||
130 | QVERIFY(model->containsAttendee(a3)); | 130 | QVERIFY(model->containsAttendee(a3)); | ||
131 | 131 | | |||
132 | QModelIndex i1 = model->index(0, 0); | 132 | QModelIndex i1 = model->index(0, 0); | ||
133 | QCOMPARE(a1.fullName(), model->data(i1, Qt::DisplayRole).toString()); | 133 | QCOMPARE(a1.fullName(), model->data(i1, Qt::DisplayRole).toString()); | ||
134 | QCOMPARE(a1, | 134 | QCOMPARE(a1, | ||
135 | model->data(i1, FreeBusyItemModel::AttendeeRole).value<KCalCore::Attendee>()); | 135 | model->data(i1, FreeBusyItemModel::AttendeeRole).value<KCalendarCore::Attendee>()); | ||
136 | QCOMPARE(item1->freeBusy(), | 136 | QCOMPARE(item1->freeBusy(), | ||
137 | model->data(i1, FreeBusyItemModel::FreeBusyRole).value<KCalCore::FreeBusy::Ptr>()); | 137 | model->data(i1, FreeBusyItemModel::FreeBusyRole).value<KCalendarCore::FreeBusy::Ptr>()); | ||
138 | 138 | | |||
139 | QModelIndex i2 = model->index(1, 0); | 139 | QModelIndex i2 = model->index(1, 0); | ||
140 | QCOMPARE(a2.fullName(), model->data(i2, Qt::DisplayRole).toString()); | 140 | QCOMPARE(a2.fullName(), model->data(i2, Qt::DisplayRole).toString()); | ||
141 | QCOMPARE(a2, | 141 | QCOMPARE(a2, | ||
142 | model->data(i2, FreeBusyItemModel::AttendeeRole).value<KCalCore::Attendee>()); | 142 | model->data(i2, FreeBusyItemModel::AttendeeRole).value<KCalendarCore::Attendee>()); | ||
143 | QVERIFY(model->rowCount(i2) == 0); | 143 | QVERIFY(model->rowCount(i2) == 0); | ||
144 | QVERIFY(model->data(i2, FreeBusyItemModel::FreeBusyRole).isValid() == false); | 144 | QVERIFY(model->data(i2, FreeBusyItemModel::FreeBusyRole).isValid() == false); | ||
145 | 145 | | |||
146 | QModelIndex i3 = model->index(2, 0); | 146 | QModelIndex i3 = model->index(2, 0); | ||
147 | QCOMPARE(a3.fullName(), | 147 | QCOMPARE(a3.fullName(), | ||
148 | model->data(i3, Qt::DisplayRole).toString()); | 148 | model->data(i3, Qt::DisplayRole).toString()); | ||
149 | QCOMPARE(a3, | 149 | QCOMPARE(a3, | ||
150 | model->data(i3, FreeBusyItemModel::AttendeeRole).value<KCalCore::Attendee>()); | 150 | model->data(i3, FreeBusyItemModel::AttendeeRole).value<KCalendarCore::Attendee>()); | ||
151 | QVERIFY(model->rowCount(i3) == 0); | 151 | QVERIFY(model->rowCount(i3) == 0); | ||
152 | QVERIFY(model->data(i3, FreeBusyItemModel::FreeBusyRole).isValid() == false); | 152 | QVERIFY(model->data(i3, FreeBusyItemModel::FreeBusyRole).isValid() == false); | ||
153 | 153 | | |||
154 | model->slotInsertFreeBusy(fb2, QStringLiteral("joe@example.com")); | 154 | model->slotInsertFreeBusy(fb2, QStringLiteral("joe@example.com")); | ||
155 | QCOMPARE(item2->freeBusy(), | 155 | QCOMPARE(item2->freeBusy(), | ||
156 | model->data(i2, FreeBusyItemModel::FreeBusyRole).value<KCalCore::FreeBusy::Ptr>()); | 156 | model->data(i2, FreeBusyItemModel::FreeBusyRole).value<KCalendarCore::FreeBusy::Ptr>()); | ||
157 | QVERIFY(model->rowCount(i2) == fb2->fullBusyPeriods().size()); | 157 | QVERIFY(model->rowCount(i2) == fb2->fullBusyPeriods().size()); | ||
158 | 158 | | |||
159 | QModelIndex i2_0 = model->index(0, 0, i2); | 159 | QModelIndex i2_0 = model->index(0, 0, i2); | ||
160 | QCOMPARE(fb2->fullBusyPeriods().first(), | 160 | QCOMPARE(fb2->fullBusyPeriods().first(), | ||
161 | model->data( | 161 | model->data( | ||
162 | i2_0, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 162 | i2_0, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
163 | QModelIndex i2_1 = model->index(1, 0, i2); | 163 | QModelIndex i2_1 = model->index(1, 0, i2); | ||
164 | QCOMPARE(fb2->fullBusyPeriods().at(1), | 164 | QCOMPARE(fb2->fullBusyPeriods().at(1), | ||
165 | model->data( | 165 | model->data( | ||
166 | i2_1, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 166 | i2_1, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
167 | QModelIndex i2_2 = model->index(2, 0, i2); | 167 | QModelIndex i2_2 = model->index(2, 0, i2); | ||
168 | QCOMPARE(fb2->fullBusyPeriods().last(), | 168 | QCOMPARE(fb2->fullBusyPeriods().last(), | ||
169 | model->data( | 169 | model->data( | ||
170 | i2_2, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 170 | i2_2, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
171 | 171 | | |||
172 | model->slotInsertFreeBusy(fb3, QStringLiteral("max@example.com")); | 172 | model->slotInsertFreeBusy(fb3, QStringLiteral("max@example.com")); | ||
173 | QCOMPARE(item3->freeBusy(), | 173 | QCOMPARE(item3->freeBusy(), | ||
174 | model->data(i3, FreeBusyItemModel::FreeBusyRole).value<KCalCore::FreeBusy::Ptr>()); | 174 | model->data(i3, FreeBusyItemModel::FreeBusyRole).value<KCalendarCore::FreeBusy::Ptr>()); | ||
175 | QVERIFY(model->rowCount(i3) == fb3->fullBusyPeriods().size()); | 175 | QVERIFY(model->rowCount(i3) == fb3->fullBusyPeriods().size()); | ||
176 | 176 | | |||
177 | QModelIndex i3_0 = model->index(0, 0, i3); | 177 | QModelIndex i3_0 = model->index(0, 0, i3); | ||
178 | QCOMPARE(fb3->fullBusyPeriods().first(), | 178 | QCOMPARE(fb3->fullBusyPeriods().first(), | ||
179 | model->data( | 179 | model->data( | ||
180 | i3_0, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 180 | i3_0, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
181 | QModelIndex i3_1 = model->index(1, 0, i3); | 181 | QModelIndex i3_1 = model->index(1, 0, i3); | ||
182 | QCOMPARE(fb3->fullBusyPeriods().at(1), | 182 | QCOMPARE(fb3->fullBusyPeriods().at(1), | ||
183 | model->data( | 183 | model->data( | ||
184 | i3_1, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 184 | i3_1, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
185 | QModelIndex i3_2 = model->index(2, 0, i3); | 185 | QModelIndex i3_2 = model->index(2, 0, i3); | ||
186 | QCOMPARE(fb3->fullBusyPeriods().last(), | 186 | QCOMPARE(fb3->fullBusyPeriods().last(), | ||
187 | model->data( | 187 | model->data( | ||
188 | i3_2, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 188 | i3_2, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
189 | 189 | | |||
190 | model->removeAttendee(a2); | 190 | model->removeAttendee(a2); | ||
191 | 191 | | |||
192 | QCOMPARE(2, model->rowCount()); | 192 | QCOMPARE(2, model->rowCount()); | ||
193 | 193 | | |||
194 | QVERIFY(model->containsAttendee(a1) == true); | 194 | QVERIFY(model->containsAttendee(a1) == true); | ||
195 | QVERIFY(model->containsAttendee(a2) == false); | 195 | QVERIFY(model->containsAttendee(a2) == false); | ||
196 | QVERIFY(model->containsAttendee(a3) == true); | 196 | QVERIFY(model->containsAttendee(a3) == true); | ||
197 | 197 | | |||
198 | i3_0 = model->index(0, 0, i3); | 198 | i3_0 = model->index(0, 0, i3); | ||
199 | QCOMPARE(fb3->fullBusyPeriods().first(), | 199 | QCOMPARE(fb3->fullBusyPeriods().first(), | ||
200 | model->data( | 200 | model->data( | ||
201 | i3_0, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 201 | i3_0, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
202 | i3_1 = model->index(1, 0, i3); | 202 | i3_1 = model->index(1, 0, i3); | ||
203 | QCOMPARE(fb3->fullBusyPeriods().at(1), | 203 | QCOMPARE(fb3->fullBusyPeriods().at(1), | ||
204 | model->data( | 204 | model->data( | ||
205 | i3_1, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 205 | i3_1, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
206 | i3_2 = model->index(2, 0, i3); | 206 | i3_2 = model->index(2, 0, i3); | ||
207 | QCOMPARE(fb3->fullBusyPeriods().last(), | 207 | QCOMPARE(fb3->fullBusyPeriods().last(), | ||
208 | model->data( | 208 | model->data( | ||
209 | i3_2, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalCore::FreeBusyPeriod>()); | 209 | i3_2, FreeBusyItemModel::FreeBusyPeriodRole).value<KCalendarCore::FreeBusyPeriod>()); | ||
210 | } | 210 | } | ||
211 | 211 | | |||
212 | void FreeBusyItemModelTest::testInsertFreeBusy() | 212 | void FreeBusyItemModelTest::testInsertFreeBusy() | ||
213 | { | 213 | { | ||
214 | FreeBusyItemModel *model = new FreeBusyItemModel(this); | 214 | FreeBusyItemModel *model = new FreeBusyItemModel(this); | ||
215 | new ModelTest(model, this); | 215 | new ModelTest(model, this); | ||
216 | 216 | | |||
217 | const QDateTime dt1(QDate(2010, 7, 24), QTime(7, 0, 0), Qt::UTC); | 217 | const QDateTime dt1(QDate(2010, 7, 24), QTime(7, 0, 0), Qt::UTC); | ||
218 | const QDateTime dt2(QDate(2010, 7, 24), QTime(10, 0, 0), Qt::UTC); | 218 | const QDateTime dt2(QDate(2010, 7, 24), QTime(10, 0, 0), Qt::UTC); | ||
219 | KCalCore::Attendee a1(QStringLiteral("fred"), QStringLiteral( "fred@example.com")); | 219 | KCalendarCore::Attendee a1(QStringLiteral("fred"), QStringLiteral( "fred@example.com")); | ||
220 | KCalCore::FreeBusy::Ptr fb1(new KCalCore::FreeBusy()); | 220 | KCalendarCore::FreeBusy::Ptr fb1(new KCalendarCore::FreeBusy()); | ||
221 | fb1->addPeriod(dt1, KCalCore::Duration(60 * 60)); | 221 | fb1->addPeriod(dt1, KCalendarCore::Duration(60 * 60)); | ||
222 | fb1->addPeriod(dt2, KCalCore::Duration(60 * 60)); | 222 | fb1->addPeriod(dt2, KCalendarCore::Duration(60 * 60)); | ||
223 | 223 | | |||
224 | const QDateTime dt3(QDate(2010, 7, 24), QTime(12, 0, 0), Qt::UTC); | 224 | const QDateTime dt3(QDate(2010, 7, 24), QTime(12, 0, 0), Qt::UTC); | ||
225 | const QDateTime dt4(QDate(2010, 7, 24), QTime(14, 0, 0), Qt::UTC); | 225 | const QDateTime dt4(QDate(2010, 7, 24), QTime(14, 0, 0), Qt::UTC); | ||
226 | KCalCore::FreeBusy::Ptr fb2(new KCalCore::FreeBusy()); | 226 | KCalendarCore::FreeBusy::Ptr fb2(new KCalendarCore::FreeBusy()); | ||
227 | fb2->addPeriod(dt1, KCalCore::Duration(60 * 60)); | 227 | fb2->addPeriod(dt1, KCalendarCore::Duration(60 * 60)); | ||
228 | fb2->addPeriod(dt2, KCalCore::Duration(60 * 60)); | 228 | fb2->addPeriod(dt2, KCalendarCore::Duration(60 * 60)); | ||
229 | fb2->addPeriod(dt3, KCalCore::Duration(60 * 60)); | 229 | fb2->addPeriod(dt3, KCalendarCore::Duration(60 * 60)); | ||
230 | fb2->addPeriod(dt4, KCalCore::Duration(60 * 60 * 2)); | 230 | fb2->addPeriod(dt4, KCalendarCore::Duration(60 * 60 * 2)); | ||
231 | 231 | | |||
232 | FreeBusyItem::Ptr item1(new FreeBusyItem(a1, nullptr)); | 232 | FreeBusyItem::Ptr item1(new FreeBusyItem(a1, nullptr)); | ||
233 | item1->setFreeBusy(fb1); | 233 | item1->setFreeBusy(fb1); | ||
234 | 234 | | |||
235 | model->addItem(item1); | 235 | model->addItem(item1); | ||
236 | 236 | | |||
237 | QModelIndex i = model->index(0, 0); | 237 | QModelIndex i = model->index(0, 0); | ||
238 | QCOMPARE(model->rowCount(i), 2); | 238 | QCOMPARE(model->rowCount(i), 2); | ||
239 | 239 | | |||
240 | model->slotInsertFreeBusy(fb2, QStringLiteral("fred@example.com")); | 240 | model->slotInsertFreeBusy(fb2, QStringLiteral("fred@example.com")); | ||
241 | 241 | | |||
242 | QCOMPARE(model->rowCount(i), 4); | 242 | QCOMPARE(model->rowCount(i), 4); | ||
243 | } | 243 | } |