mirror of
https://github.com/hyprwm/Hyprland
synced 2026-05-07 21:18:08 +02:00
test: dispatch window.focus({ direction }) when follow_focus = false
This commit is contained in:
parent
d16100b3de
commit
c57eb2e14a
1 changed files with 49 additions and 0 deletions
|
|
@ -993,3 +993,52 @@ TEST_CASE(testScrollingViewBehaviourFullscreen) {
|
|||
ASSERT(Tests::windowCount(), 0);
|
||||
}
|
||||
|
||||
TEST_CASE(testScrollingViewBehaviourMoveFocusFollowFocusFalse) {
|
||||
|
||||
|
||||
/*
|
||||
dispatching movefocus when follow_focus = false should not cause scrolling view to move
|
||||
---------------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
NLog::log("{}Testing scrolling view behaviour: movefocus does not cause scrolling view to move if follow_focus = false", Colors::GREEN);
|
||||
|
||||
OK(getFromSocket("r/eval hl.config({ general = { layout = 'scrolling' } })"));
|
||||
|
||||
// ensure variables are correctly set for the test
|
||||
OK(getFromSocket("/eval hl.config({scrolling = {follow_focus = false}})"));
|
||||
|
||||
if (!Tests::spawnKitty("a")) {
|
||||
FAIL_TEST("{}Failed to spawn kitty with win class `a`", Colors::RED);
|
||||
}
|
||||
|
||||
OK(getFromSocket("/dispatch hl.dsp.layout('colresize 0.8')"));
|
||||
|
||||
if (!Tests::spawnKitty("b")) {
|
||||
FAIL_TEST("{}Failed to spawn kitty with win class `b`", Colors::RED);
|
||||
}
|
||||
|
||||
// we expect that after dispatching this, scrolling view must not have moved
|
||||
OK(getFromSocket("/dispatch hl.dsp.focus({direction = 'left'})"));
|
||||
|
||||
// If the scrolling view did not move, class:a window's x coordinate for its `at:` value should be < 0.
|
||||
const std::string currentWindowPos = Tests::getWindowAttribute(getFromSocket("/activewindow"), "at:");
|
||||
const std::string currentWindowPosX = currentWindowPos.substr(4, currentWindowPos.find(',') - 4);
|
||||
// test pass
|
||||
if (std::stoi(currentWindowPosX) < 0) {
|
||||
NLog::log("{}Passed: {}window of class 'a' has negative x coordinates for its position: {}", Colors ::GREEN, Colors::RESET, currentWindowPosX);
|
||||
}
|
||||
// test fail
|
||||
else {
|
||||
FAIL_TEST("{}Failed: {}window of class 'a' does not have negative x coordinates for its position: {}", Colors::RED, Colors::RESET, currentWindowPosX);
|
||||
}
|
||||
|
||||
// clean up
|
||||
|
||||
// kill all windows
|
||||
NLog::log("{}Killing all windows", Colors::YELLOW);
|
||||
Tests::killAllWindows();
|
||||
EXPECT(Tests::windowCount(), 0);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue