12.3a: guides, the layout grid, Snap To and the View entries (Compositor 1.1.7)
This commit is contained in:
1 parent
4bfc6c237e
commit
338451fc35
25 files changed
+1029
-52
No files matched your search
@@ -6,6 +6,7 @@ class ViewMenuTests : public QObject {
|
||||
private slots:
|
||||
void viewEntriesZoomTheFrontSession();
|
||||
void thePixelGridEntryTogglesTheSession();
|
||||
void guideEntriesFollowTheSession();
|
||||
};
|
||||
|
||||
void ViewMenuTests::viewEntriesZoomTheFrontSession()
|
||||
@@ -54,5 +55,43 @@ void ViewMenuTests::thePixelGridEntryTogglesTheSession()
|
||||
QVERIFY(!snap.isChecked());
|
||||
}
|
||||
|
||||
void ViewMenuTests::guideEntriesFollowTheSession()
|
||||
{
|
||||
Bar bar;
|
||||
const std::vector<std::tuple<const char *, QString, bool (EditorSession::*)() const, bool>> toggles{
|
||||
{"showGrid", "Grid", &EditorSession::showsGrid, false},
|
||||
{"showGuides", "Guides", &EditorSession::showsGuides, true},
|
||||
{"showRulers", "Rulers", &EditorSession::showsRulers, false},
|
||||
{"snapEnabled", "Snap", &EditorSession::snapEnabled, true},
|
||||
{"snapToGuides", "Guides", &EditorSession::snapToGuides, true},
|
||||
{"snapToGrid", "Grid", &EditorSession::snapToGrid, false},
|
||||
{"snapToLayers", "Layers", &EditorSession::snapToLayers, true},
|
||||
{"snapToDocumentBounds", "Document Bounds", &EditorSession::snapToDocumentBounds, true},
|
||||
{"lockGuides", "Lock Guides", &EditorSession::locksGuides, false}};
|
||||
// Without a document every entry rests.
|
||||
for (const auto &[name, text, read, start] : toggles) {
|
||||
QAction &entry = bar.action(name);
|
||||
QVERIFY2(entry.isCheckable() && !entry.isEnabled() && entry.isChecked() == start && entry.text() == text, name);
|
||||
}
|
||||
QVERIFY(!bar.action("clearGuides").isEnabled());
|
||||
bar.session().createDocument(20, 20);
|
||||
for (const auto &[name, text, read, start] : toggles) {
|
||||
QAction &entry = bar.action(name);
|
||||
QVERIFY2(entry.isEnabled(), name);
|
||||
entry.trigger();
|
||||
QVERIFY2((bar.session().*read)() != start && entry.isChecked() != start, name);
|
||||
entry.trigger();
|
||||
QVERIFY2((bar.session().*read)() == start && entry.isChecked() == start, name);
|
||||
}
|
||||
// The submenus Swift names, and Clear Guides with guides.
|
||||
QCOMPARE(qobject_cast<QMenu *>(bar.action("showGrid").parent())->title(), QString("Show"));
|
||||
QCOMPARE(qobject_cast<QMenu *>(bar.action("snapToGrid").parent())->title(), QString("Snap To"));
|
||||
bar.session().addGuide({QUuid::createUuid(), CanvasGuide::Axis::vertical, 5});
|
||||
QVERIFY(bar.action("clearGuides").isEnabled());
|
||||
bar.action("clearGuides").trigger();
|
||||
QVERIFY(bar.session().document().value().guides.empty());
|
||||
QVERIFY(!bar.action("clearGuides").isEnabled());
|
||||
}
|
||||
|
||||
QTEST_MAIN(ViewMenuTests)
|
||||
#include "ViewMenuTests.moc"
|
||||
Reference in new issue
Block a user