Files
OmaPhoto/tests/BlendShortcutTests.cpp
T
雷电芽衣andClaude c864304695
Release / deb (push) Canceled after 0s
Release / rpm (push) Canceled after 0s
Release / arch (push) Canceled after 0s
Release / publish (push) Canceled after 0s
OmaPhoto 1.0.0: the Linux port of Compositor
A layered image editor for Linux and Omarchy, ported from Compositor
(github.com/robbietilton/Compositor), whose Swift source is its
specification. It reads and writes Compositor's .comp projects.

Packages for Ubuntu, Fedora and Arch come from the release workflow;
scripts/install/ holds one install script per distribution family,
and flake.nix serves NixOS.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-09-26 00:44:52 -04:00

53 lines
1.9 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "Rendering/EditorCanvas.h"
#include "UI/NativeLayerList.h"
#include <QLineEdit>
#include <QtTest>
// Shift-+ and Shift-− step the blend mode wherever focus sits.
class BlendShortcutTests : public QObject {
Q_OBJECT
private slots:
void shiftPlusAndMinusStepTheActiveLayersBlendModeWhereverFocusIsExceptTextFields();
};
void BlendShortcutTests::shiftPlusAndMinusStepTheActiveLayersBlendModeWhereverFocusIsExceptTextFields()
{
EditorSession session;
session.createDocument(40, 20);
session.addBlankLayer();
QWidget window;
auto *canvas = new CanvasView(session, &window);
canvas->setGeometry(0, 0, 300, 200);
auto *list = new NativeLayerList(session, &window);
list->setGeometry(300, 0, 200, 200);
auto *field = new QLineEdit(&window);
field->setGeometry(0, 210, 100, 22);
window.resize(500, 240);
window.show();
QVERIFY(QTest::qWaitForWindowActive(&window));
const auto mode = [&] { return session.activeLayer().value().blendMode; };
session.selectTool(NavigationTool::brush);
canvas->setFocus();
QTRY_VERIFY(canvas->hasFocus());
QTest::keyClick(canvas, Qt::Key_Plus, Qt::ShiftModifier);
QCOMPARE(mode(), LayerBlendMode::multiply);
// From the list, back past Normal to the last mode.
session.selectTool(NavigationTool::lasso);
list->setFocus();
QTRY_VERIFY(list->hasFocus());
QTest::keyClick(list, Qt::Key_Underscore, Qt::ShiftModifier);
QTest::keyClick(list, Qt::Key_Underscore, Qt::ShiftModifier);
QCOMPARE(mode(), LayerBlendMode::luminosity);
session.undo();
QCOMPARE(mode(), LayerBlendMode::normal);
// Typing in a text field keeps its characters.
field->setFocus();
QTRY_VERIFY(field->hasFocus());
QTest::keyClick(field, Qt::Key_Plus, Qt::ShiftModifier);
QCOMPARE(mode(), LayerBlendMode::normal);
QCOMPARE(field->text(), QString("+"));
}
QTEST_MAIN(BlendShortcutTests)
#include "BlendShortcutTests.moc"