View › Grid Settings…: spacing, subdivisions, colour, style and opacity, kept across launches (13.5b)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-01 12:43:50 -04:00
1 parent 3992bc913d
commit 93a4c62b8f
29 files changed
+1353 -46

No files matched your search

+22
View File
@@ -1,5 +1,6 @@
#include "MenuFixtures.h"
#include "Rendering/EditorCanvas.h"
#include "UI/GridSettingsSheet.h"
#include <QLineEdit>
// The View menu: zoom, the pixel grid and Snap.
@@ -9,6 +10,7 @@ private slots:
void viewEntriesZoomTheFrontSession();
void thePixelGridEntryTogglesTheSession();
void guideEntriesFollowTheSession();
void gridSettingsOpensItsSheet();
};
void ViewMenuTests::viewEntriesZoomTheFrontSession()
@@ -118,5 +120,25 @@ void ViewMenuTests::guideEntriesFollowTheSession()
QVERIFY(!bar.action("clearGuides").isEnabled());
}
void ViewMenuTests::gridSettingsOpensItsSheet()
{
Bar bar;
QAction &entry = bar.action("gridSettings");
QVERIFY(entry.text() == "Grid Settings…" && !entry.isCheckable() && !entry.isEnabled());
// Swift's place: after the Show submenu, before Rulers.
const QList<QAction *> view = qobject_cast<QMenu *>(entry.parent())->actions();
const qsizetype at = view.indexOf(&entry);
QVERIFY(view[at - 1]->menu() && view[at - 1]->menu()->title() == "Show" && view[at + 1] == &bar.action("showRulers"));
bar.session().createDocument(20, 20);
QVERIFY(entry.isEnabled());
bar.window.show();
entry.trigger();
QTRY_VERIFY(bar.window.findChild<GridSettingsSheet *>());
QVERIFY(bar.session().showsGrid());
QTest::keyClick(bar.window.findChild<GridSettingsSheet *>(), Qt::Key_Escape);
QTRY_VERIFY(!bar.window.findChild<GridSettingsSheet *>());
QVERIFY(!bar.session().showsGrid());
}
QTEST_MAIN(ViewMenuTests)
#include "ViewMenuTests.moc"