summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-09-24 17:28:14 +0200
committerDanilo M. <danix@danix.xyz>2026-09-24 17:28:14 +0200
commit516b2daaeab00bb4d4c28055a434dc5ee53aeb60 (patch)
tree5e75f82d4b6022ef66544a0ad8b361b99dd0acb3 /tests
parentbf1d7ecf687adeadc98d60395a4efc7cb306e13f (diff)
downloadqtmaildir-516b2daaeab00bb4d4c28055a434dc5ee53aeb60.tar.gz
qtmaildir-516b2daaeab00bb4d4c28055a434dc5ee53aeb60.zip
feat: open the calendar from the View menu and the toolbar
Diffstat (limited to 'tests')
-rw-r--r--tests/test_mainwindow.cpp26
1 files changed, 26 insertions, 0 deletions
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 <algorithm>
+
#include <QProcess>
#include <QtTest>
@@ -44,6 +46,7 @@
#include <QTreeView>
#include <QTimer>
+#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<QAction *>(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<CalendarWindow *>(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.