summaryrefslogtreecommitdiff
path: root/hyprtester/src/tests/shared.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/shared.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/shared.cpp')
-rw-r--r--hyprtester/src/tests/shared.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/hyprtester/src/tests/shared.cpp b/hyprtester/src/tests/shared.cpp
index 03a64751..d08f4ea2 100644
--- a/hyprtester/src/tests/shared.cpp
+++ b/hyprtester/src/tests/shared.cpp
@@ -1,4 +1,5 @@
#include "shared.hpp"
+#include <cassert>
#include <csignal>
#include <cerrno>
#include <thread>
@@ -186,12 +187,14 @@ bool Tests::writeFile(const std::string& name, const std::string& contents) {
return true;
}
-std::string Tests::getWindowAttribute(const std::string& winInfo, const std::string& attr) {
- auto pos = winInfo.find(attr);
+std::string Tests::getAttribute(const std::string& hyprlandResponse, std::string attr) {
+ attr += ": ";
+ auto pos = hyprlandResponse.find(attr);
if (pos == std::string::npos) {
NLog::log("{}Window attribute not found: '{}'", Colors::RED, attr);
return "Wrong window attribute";
}
- auto pos2 = winInfo.find('\n', pos);
- return winInfo.substr(pos, pos2 - pos);
+ pos += attr.size();
+ auto pos2 = hyprlandResponse.find('\n', pos);
+ return hyprlandResponse.substr(pos, pos2 - pos);
}