mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Added a day view to PlanningCalendarWindow (#4704)
* Reusing the existing configuration * Linked from days in month view to the more detailed view * Fixed color setting after construction
This commit is contained in:
committed by
GitHub
parent
069e2942df
commit
f84f9a410e
6
unittests/Gui/calendarData/calendarData.pro
Normal file
6
unittests/Gui/calendarData/calendarData.pro
Normal file
@@ -0,0 +1,6 @@
|
||||
QT += testlib core
|
||||
|
||||
SOURCES = testCalendarData.cpp
|
||||
GC_OBJS = CalendarData
|
||||
|
||||
include(../../unittests.pri)
|
||||
43
unittests/Gui/calendarData/testCalendarData.cpp
Normal file
43
unittests/Gui/calendarData/testCalendarData.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "Gui/CalendarData.h"
|
||||
|
||||
#include <QTest>
|
||||
|
||||
|
||||
class TestCalendarData: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
|
||||
void layoutCalendarEntry() {
|
||||
#if QT_VERSION < 0x060000
|
||||
QSKIP("Skipping test with Qt5");
|
||||
#else
|
||||
QList<CalendarEntry> entries = {
|
||||
{ "", "", "", "", Qt::red, "", QTime(9, 0), 3600 },
|
||||
{ "", "", "", "", Qt::red, "", QTime(9, 30), 3600 },
|
||||
{ "", "", "", "", Qt::red, "", QTime(10, 30), 1800 },
|
||||
{ "", "", "", "", Qt::red, "", QTime(11, 0), 1800 },
|
||||
{ "", "", "", "", Qt::red, "", QTime(11, 15), 3600 },
|
||||
};
|
||||
CalendarEntryLayouter layouter;
|
||||
QList<CalendarEntryLayout> layout = layouter.layout(entries);
|
||||
|
||||
QCOMPARE(layout.count(), entries.count());
|
||||
QCOMPARE(layout[0].columnIndex, 0);
|
||||
QCOMPARE(layout[0].columnCount, 2);
|
||||
QCOMPARE(layout[1].columnIndex, 1);
|
||||
QCOMPARE(layout[1].columnCount, 2);
|
||||
QCOMPARE(layout[2].columnIndex, 0);
|
||||
QCOMPARE(layout[2].columnCount, 1);
|
||||
QCOMPARE(layout[3].columnIndex, 0);
|
||||
QCOMPARE(layout[3].columnCount, 2);
|
||||
QCOMPARE(layout[4].columnIndex, 1);
|
||||
QCOMPARE(layout[4].columnCount, 2);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
QTEST_MAIN(TestCalendarData)
|
||||
#include "testCalendarData.moc"
|
||||
@@ -8,7 +8,8 @@ equals(GC_UNITTESTS, active) {
|
||||
SUBDIRS += Core/seasonOffset \
|
||||
Core/season \
|
||||
Core/seasonParser \
|
||||
Core/units
|
||||
Core/units \
|
||||
Gui/calendarData
|
||||
CONFIG += ordered
|
||||
} else {
|
||||
message("Unittests are disabled; to enable copy unittests/unittests.pri.in to unittests/unittests.pri")
|
||||
|
||||
Reference in New Issue
Block a user