| 1 |
#include "Gui/CalendarData.h" |
| 2 |
|
| 3 |
#include <QTest> |
| 4 |
|
| 5 |
|
| 6 |
class TestCalendarData: public QObject |
| 7 |
{ |
| 8 |
Q_OBJECT |
| 9 |
|
| 10 |
private slots: |
| 11 |
|
| 12 |
void layoutCalendarEntry() { |
| 13 |
#if QT_VERSION < 0x060000 |
| 14 |
QSKIP("Skipping test with Qt5"); |
| 15 |
#else |
| 16 |
QList<CalendarEntry> entries = { |
| 17 |
{ "", "", "", "", "", Qt::red, "", QTime(9, 0), 3600 }, |
| 18 |
{ "", "", "", "", "", Qt::red, "", QTime(9, 30), 3600 }, |
| 19 |
{ "", "", "", "", "", Qt::red, "", QTime(10, 30), 1800 }, |
| 20 |
{ "", "", "", "", "", Qt::red, "", QTime(11, 0), 1800 }, |
| 21 |
{ "", "", "", "", "", Qt::red, "", QTime(11, 15), 3600 }, |
| 22 |
}; |
| 23 |
CalendarEntryLayouter layouter; |
| 24 |
QList<CalendarEntryLayout> layout = layouter.layout(entries); |
| 25 |
|
| 26 |
QCOMPARE(layout.count(), entries.count()); |
| 27 |
QCOMPARE(layout[0].columnIndex, 0); |
| 28 |
QCOMPARE(layout[0].columnCount, 2); |
| 29 |
QCOMPARE(layout[1].columnIndex, 1); |
| 30 |
QCOMPARE(layout[1].columnCount, 2); |
| 31 |
QCOMPARE(layout[2].columnIndex, 0); |
| 32 |
QCOMPARE(layout[2].columnCount, 1); |
| 33 |
QCOMPARE(layout[3].columnIndex, 0); |
| 34 |
QCOMPARE(layout[3].columnCount, 2); |
| 35 |
QCOMPARE(layout[4].columnIndex, 1); |
| 36 |
QCOMPARE(layout[4].columnCount, 2); |
| 37 |
#endif |
| 38 |
} |
| 39 |
}; |
| 40 |
|
| 41 |
|
| 42 |
QTEST_MAIN(TestCalendarData) |
| 43 |
#include "testCalendarData.moc" |