Skip to content

Commit

Permalink
test xeyes
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Feb 2, 2025
1 parent 977b4d6 commit 1fc86ee
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
5 changes: 2 additions & 3 deletions hyprtester/src/hyprctlCompat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ std::vector<SInstanceData> instances() {
return result;
}


std::string getFromSocket(const std::string& cmd) {
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);

Expand All @@ -89,8 +88,8 @@ std::string getFromSocket(const std::string& cmd) {
return "";
}

sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;

std::string socketPath = getRuntimeDir() + "/" + HIS + "/.socket.sock";

Expand Down
2 changes: 1 addition & 1 deletion hyprtester/src/hyprctlCompat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ struct SInstanceData {
};

std::vector<SInstanceData> instances();
std::string getFromSocket(const std::string& cmd);
std::string getFromSocket(const std::string& cmd);
1 change: 1 addition & 0 deletions hyprtester/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

// Required runtime deps for checks:
// - kitty
// - xeyes

#include "shared.hpp"
#include "hyprctlCompat.hpp"
Expand Down
32 changes: 30 additions & 2 deletions hyprtester/src/tests/window/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,36 @@ bool testWindows() {
}

EXPECT(windowCount(), 2);

// kill both kitties

// open xeyes
getFromSocket("/dispatch exec xeyes");
counter = 0;

std::this_thread::sleep_for(std::chrono::milliseconds(100));

while (windowCount() != 3) {
counter++;
std::this_thread::sleep_for(std::chrono::milliseconds(100));

if (counter > 20) {
EXPECT(windowCount(), 3);
return !ret;
}
}

EXPECT(windowCount(), 3);

// check some window props of xeyes, try to tile them
{
auto str = getFromSocket("/clients");
EXPECT(str.contains("floating: 1"), true);
getFromSocket("/dispatch settiled class:XEyes");
std::this_thread::sleep_for(std::chrono::milliseconds(100));
str = getFromSocket("/clients");
EXPECT(str.contains("floating: 1"), false);
}

// kill all
{
auto str = getFromSocket("/clients");
auto pos = str.find("Window ");
Expand Down

0 comments on commit 1fc86ee

Please sign in to comment.