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:
Joachim Kohlhammer
2025-09-16 03:08:35 +02:00
committed by GitHub
parent 069e2942df
commit f84f9a410e
15 changed files with 1991 additions and 254 deletions

View File

@@ -0,0 +1,6 @@
QT += testlib core
SOURCES = testCalendarData.cpp
GC_OBJS = CalendarData
include(../../unittests.pri)

View 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"

View File

@@ -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")