summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/main/window.cpp
diff options
context:
space:
mode:
authorNikolai Nechaev <nikolay_nechaev@mail.ru>2026-04-30 02:32:06 +0900
committerGitHub <noreply@github.com>2026-04-29 18:32:06 +0100
commit45ffaee09361110c018e962dbb3d93f7f1ee8e09 (patch)
tree6dc9398eda8a147202b093a6b964e6c5a10195cd /hyprtester/src/tests/main/window.cpp
parent202cf48ecf627839c0a7433cbeb018c744214390 (diff)
tests: Fix more tests failing on CI (#14159)
* tests: Relax color management requirements in the colors test This continues the work from d4dd299 (#14142): - Fixes a missed check assuming a fixed value for `colorManagementPreset` - Stricten checks to require that the expected keywords are present as json keys * tests: Refactor `Tests::getAttribute` (was `Tests::getWindowAttribute`) - Improve ergonomics by consistently handling attribute name; - Remove 'window' from the function name, since it is compatible with other responses too; - Document the function. * tests: Fix solitary test assuming it knows the complete set of blockers The test was failing on the CI because new blockers appeared, which were not expected by the text. Fix the test, so that it just checks the set of expected blockers is a subset of actual blockers
Diffstat (limited to 'hyprtester/src/tests/main/window.cpp')
-rw-r--r--hyprtester/src/tests/main/window.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/hyprtester/src/tests/main/window.cpp b/hyprtester/src/tests/main/window.cpp
index 7f36cf7b..4a4da0cc 100644
--- a/hyprtester/src/tests/main/window.cpp
+++ b/hyprtester/src/tests/main/window.cpp
@@ -75,7 +75,7 @@ TEST_CASE(swapWindow) {
// Test swapwindow by direction
{
getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_A' })");
- auto pos = Tests::getWindowAttribute(getFromSocket("/activewindow"), "at:");
+ auto pos = "at: " + Tests::getAttribute(getFromSocket("/activewindow"), "at");
NLog::log("{}Testing kitty_A {}, swapwindow with direction 'r'", Colors::YELLOW, pos);
OK(getFromSocket("/dispatch hl.dsp.window.swap({ direction = 'right' })"));
@@ -87,7 +87,7 @@ TEST_CASE(swapWindow) {
// Test swapwindow by class
{
getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_A' })");
- auto pos = Tests::getWindowAttribute(getFromSocket("/activewindow"), "at:");
+ auto pos = "at: " + Tests::getAttribute(getFromSocket("/activewindow"), "at");
NLog::log("{}Testing kitty_A {}, swapwindow with class:kitty_B", Colors::YELLOW, pos);
OK(getFromSocket("/dispatch hl.dsp.window.swap({ target = 'class:kitty_B' })"));
@@ -101,7 +101,7 @@ TEST_CASE(swapWindow) {
getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_B' })");
auto addr = getWindowAddress(getFromSocket("/activewindow"));
getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_A' })");
- auto pos = Tests::getWindowAttribute(getFromSocket("/activewindow"), "at:");
+ auto pos = "at: " + Tests::getAttribute(getFromSocket("/activewindow"), "at");
NLog::log("{}Testing kitty_A {}, swapwindow with address:0x{}(kitty_B)", Colors::YELLOW, pos, addr);
OK(getFromSocket(std::format("/dispatch hl.dsp.window.swap({{ target = 'address:0x{}' }})", addr)));
@@ -124,7 +124,7 @@ TEST_CASE(swapWindow) {
{
getFromSocket("/dispatch hl.dsp.focus({ window = 'class:kitty_B' })");
auto addr = getWindowAddress(getFromSocket("/activewindow"));
- auto ws = Tests::getWindowAttribute(getFromSocket("/activewindow"), "workspace:");
+ auto ws = "workspace: " + Tests::getAttribute(getFromSocket("/activewindow"), "workspace");
NLog::log("{}Sending address:0x{}(kitty_B) to workspace \"swapwindow2\"", Colors::YELLOW, addr);
OK(getFromSocket("/dispatch hl.dsp.window.move({ workspace = 'name:swapwindow2', follow = false })"));
@@ -190,9 +190,9 @@ TEST_CASE(windowGroupRules) {
static bool isActiveWindow(const std::string& class_, char fullscreen = '0', bool log = true) {
std::string activeWin = getFromSocket("/activewindow");
- auto winClass = Tests::getWindowAttribute(activeWin, "class:");
- auto winFullscreen = Tests::getWindowAttribute(activeWin, "fullscreen:").back();
- if (winClass.substr(strlen("class: ")) == class_ && winFullscreen == fullscreen)
+ auto winClass = Tests::getAttribute(activeWin, "class");
+ auto winFullscreen = Tests::getAttribute(activeWin, "fullscreen").back();
+ if (winClass == class_ && winFullscreen == fullscreen)
return true;
else {
if (log)