diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-24 18:56:08 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-24 18:56:08 +0200 |
| commit | 35b136944656c9ff9c3b064f47be08224f76c1f9 (patch) | |
| tree | 1668716a498c5d292dec57ea0710f454193c5ce9 /tests/test_calendarwindow.cpp | |
| parent | ab785283e6abd1730efd4499ba4bc436a3de2665 (diff) | |
| download | qtmaildir-35b136944656c9ff9c3b064f47be08224f76c1f9.tar.gz qtmaildir-35b136944656c9ff9c3b064f47be08224f76c1f9.zip | |
feat: close the calendar's event pane with Escape
Escape was scoped to the pane and only cancelled an edit, so once an
event was selected nothing closed the pane again. It is a window shortcut
now, labelled Close event: with no edit open it clears the selection and
the pane hides. With an edit open it cancels only when focus is inside
the pane, so a stray Escape after clicking the grid cannot discard the
form.
That guard needed the month grid to take focus on a click, which it never
did; the view-scoped PgUp/PgDn, Delete and Ctrl+Z were likewise reachable
only by Tab until now.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/test_calendarwindow.cpp')
| -rw-r--r-- | tests/test_calendarwindow.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_calendarwindow.cpp b/tests/test_calendarwindow.cpp index 5591b2b..ea83f12 100644 --- a/tests/test_calendarwindow.cpp +++ b/tests/test_calendarwindow.cpp @@ -128,6 +128,7 @@ private slots: void aFreshWindowShowsTheCurrentMonth(); void aStaleSaveCanBeRetried(); void aRolledBackWriteIsNotReportedLostAfterSync(); + void escapeClosesTheDetailsButNotAnEditFromOutsideThePane(); }; void TestCalendarWindow::loadsAndSelects() @@ -320,5 +321,23 @@ void TestCalendarWindow::aRolledBackWriteIsNotReportedLostAfterSync() 5000); } + +void TestCalendarWindow::escapeClosesTheDetailsButNotAnEditFromOutsideThePane() +{ + Fixture f; + std::unique_ptr<CalendarWindow> w(f.window()); + auto *close = w->findChild<QAction *>(QStringLiteral("cancelEdit")); + QVERIFY(close); + QVERIFY(w->selectEvent(QStringLiteral("one@example.org"))); + close->trigger(); + QVERIFY(w->selectedUid().isEmpty()); + + // Focus is nowhere inside the pane, as after a click on the grid. + QVERIFY(w->selectEvent(QStringLiteral("one@example.org"))); + editTitle(w.get(), QStringLiteral("Changed")); + close->trigger(); + QVERIFY(w->isEditing()); +} + QTEST_MAIN(TestCalendarWindow) #include "test_calendarwindow.moc" |
