From 516b2daaeab00bb4d4c28055a434dc5ee53aeb60 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Thu, 24 Sep 2026 17:28:14 +0200 Subject: feat: open the calendar from the View menu and the toolbar --- tests/test_mainwindow.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/test_mainwindow.cpp') diff --git a/tests/test_mainwindow.cpp b/tests/test_mainwindow.cpp index e87843d..5446780 100644 --- a/tests/test_mainwindow.cpp +++ b/tests/test_mainwindow.cpp @@ -16,6 +16,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ +#include + #include #include @@ -44,6 +46,7 @@ #include #include +#include "calendarwindow.h" #include "config.h" #include "keymap.h" #include "mainwindow.h" @@ -618,6 +621,10 @@ private slots: void aConversationStaysWhileAnyMessageMatches(); void aConversationLeavesWhenItsUnionEmpties(); + // Item 206, task 15: the calendar opens from the View menu and toolbar, + // and does nothing at all when no calendars_dir is configured. + void theCalendarActionWithNoCalendarOpensNothing(); + private: /// Owns the throwaway lock table init() points every test at. A pointer /// rather than a value because it is rebuilt per test, and QTemporaryDir @@ -8817,6 +8824,25 @@ void TestMainWindow::theSpamActionCarriesTheBugIconWithAFallback() QCOMPARE(names.second, QStringLiteral("mail-mark-junk")); } +void TestMainWindow::theCalendarActionWithNoCalendarOpensNothing() +{ + // Item 206, task 15. The default test config leaves calendars_dir empty, so + // the feature is off: the action must exist (it is registered like any + // other) but triggering it may not crash or open an empty window. + const Config config; + MainWindow window(config); + auto *action = window.findChild(QStringLiteral("calendar")); + QVERIFY2(action, "no action named calendar"); + + action->trigger(); + + const QWidgetList tops = QApplication::topLevelWidgets(); + QVERIFY2(std::none_of(tops.cbegin(), tops.cend(), [](QWidget *w) { + return qobject_cast(w) != nullptr; + }), + "a calendar window opened with no calendars_dir configured"); +} + // Constructing a MainWindow needs a QApplication and a platform plugin. The // test has no display under ctest, so it runs offscreen unless the caller // asked for something else. -- cgit v1.2.3