Skip to content

Commit 83a8a0b

Browse files
committed
test/gestures: Add a test for a gesture with a multi-argument dispatcher
1 parent b039318 commit 83a8a0b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

hyprtester/src/tests/main/gestures.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,30 @@ static bool test() {
2727
NLog::log("{}Switching to workspace 1", Colors::YELLOW);
2828
getFromSocket("/dispatch workspace 1"); // no OK: we might be on 1 already
2929

30+
Tests::spawnKitty();
31+
EXPECT(Tests::windowCount(), 1);
32+
33+
// Give the shell a moment to initialize
34+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
35+
36+
OK(getFromSocket("/dispatch plugin:test:gesture up,4"));
37+
int counter = 0;
38+
while (Tests::windowCount() != 0) {
39+
counter++;
40+
std::this_thread::sleep_for(std::chrono::milliseconds(100));
41+
42+
if (counter > 50) {
43+
NLog::log("{}Gesture didnt send ctrl+d to kitty", Colors::RED);
44+
return false;
45+
}
46+
}
47+
48+
EXPECT(Tests::windowCount(), 0);
49+
3050
OK(getFromSocket("/dispatch plugin:test:gesture left,3"));
3151

3252
// wait while kitty spawns
33-
int counter = 0;
53+
counter = 0;
3454
while (Tests::windowCount() != 1) {
3555
counter++;
3656
std::this_thread::sleep_for(std::chrono::milliseconds(100));

hyprtester/test.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,5 @@ gesture = 3, down, mod:ALT, float
332332

333333
gesture = 3, horizontal, mod:ALT, workspace
334334

335+
gesture = 4, up, dispatcher, sendshortcut, ctrl, d, activewindow
336+

0 commit comments

Comments
 (0)