GUI Milestone 8a

This commit is contained in:
Joey Yakimowich-Payne 2026-01-30 07:04:40 -07:00
commit a52f82d67b
7 changed files with 586 additions and 31 deletions

View file

@ -1,7 +1,9 @@
#include <warppipe/warppipe.hpp>
#include "../../gui/GraphEditorWidget.h"
#include "../../gui/WarpGraphModel.h"
#include <QAction>
#include <QApplication>
#include <catch2/catch_test_macros.hpp>
@ -453,3 +455,74 @@ TEST_CASE("volume meter streams are filtered") {
auto qtId = model.qtNodeIdForPw(100150);
REQUIRE(qtId == 0);
}
TEST_CASE("findPwNodeIdByName returns correct id") {
auto tc = TestClient::Create();
if (!tc.available()) { SUCCEED("PipeWire unavailable"); return; }
ensureApp();
REQUIRE(tc.client->Test_InsertNode(
MakeNode(100200, "find-me-node", "Audio/Sink")).ok());
REQUIRE(tc.client->Test_InsertNode(
MakeNode(100201, "other-node", "Audio/Source")).ok());
WarpGraphModel model(tc.client.get());
model.refreshFromClient();
REQUIRE(model.findPwNodeIdByName("find-me-node") == 100200);
REQUIRE(model.findPwNodeIdByName("other-node") == 100201);
REQUIRE(model.findPwNodeIdByName("nonexistent") == 0);
}
TEST_CASE("GraphEditorWidget registers custom keyboard actions") {
auto tc = TestClient::Create();
if (!tc.available()) { SUCCEED("PipeWire unavailable"); return; }
ensureApp();
GraphEditorWidget widget(tc.client.get());
QStringList actionTexts;
for (auto *action : widget.findChildren<QAction *>()) {
if (!action->text().isEmpty()) {
actionTexts.append(action->text());
}
}
REQUIRE(actionTexts.contains("Delete Selection"));
REQUIRE(actionTexts.contains("Copy Selection"));
REQUIRE(actionTexts.contains("Paste Selection"));
REQUIRE(actionTexts.contains("Duplicate Selection"));
REQUIRE(actionTexts.contains("Auto-Arrange"));
}
TEST_CASE("GraphEditorWidget reflects injected nodes") {
auto tc = TestClient::Create();
if (!tc.available()) { SUCCEED("PipeWire unavailable"); return; }
ensureApp();
REQUIRE(tc.client->Test_InsertNode(
MakeNode(100210, "warppipe-widget-test", "Audio/Sink")).ok());
REQUIRE(tc.client->Test_InsertPort(
MakePort(100211, 100210, "FL", true)).ok());
GraphEditorWidget widget(tc.client.get());
REQUIRE(widget.nodeCount() >= 1);
}
TEST_CASE("findPwNodeIdByName returns 0 for ghost nodes without pw mapping") {
auto tc = TestClient::Create();
if (!tc.available()) { SUCCEED("PipeWire unavailable"); return; }
ensureApp();
REQUIRE(tc.client->Test_InsertNode(
MakeNode(100220, "ghost-lookup", "Stream/Output/Audio", "App")).ok());
WarpGraphModel model(tc.client.get());
model.refreshFromClient();
REQUIRE(model.findPwNodeIdByName("ghost-lookup") == 100220);
REQUIRE(tc.client->Test_RemoveGlobal(100220).ok());
model.refreshFromClient();
REQUIRE(model.findPwNodeIdByName("ghost-lookup") == 100220);
}