From 7b06e2010509657bcdf4a54c76a5857506cb5d11 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 1 Jun 2014 11:48:10 +0200 Subject: [PATCH] tests: fix a few racy testcases by adding sync_with_i3 calls --- testcases/t/124-move.t | 10 ++++++++++ testcases/t/217-NET_CURRENT_DESKTOP.t | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/testcases/t/124-move.t b/testcases/t/124-move.t index 739dc605..28207a3c 100644 --- a/testcases/t/124-move.t +++ b/testcases/t/124-move.t @@ -151,6 +151,8 @@ my ($absolute_before, $top_before) = $floatwin->rect; cmd 'move left'; +sync_with_i3; + my ($absolute, $top) = $floatwin->rect; is($absolute->x, ($absolute_before->x - 10), 'moved 10 px to the left'); @@ -163,6 +165,8 @@ $top_before = $top; cmd 'move right'; +sync_with_i3; + ($absolute, $top) = $floatwin->rect; is($absolute->x, ($absolute_before->x + 10), 'moved 10 px to the right'); @@ -175,6 +179,8 @@ $top_before = $top; cmd 'move up'; +sync_with_i3; + ($absolute, $top) = $floatwin->rect; is($absolute->x, $absolute_before->x, 'x not changed'); @@ -187,6 +193,8 @@ $top_before = $top; cmd 'move down'; +sync_with_i3; + ($absolute, $top) = $floatwin->rect; is($absolute->x, $absolute_before->x, 'x not changed'); @@ -203,6 +211,8 @@ $top_before = $top; cmd 'move left 20 px'; +sync_with_i3; + ($absolute, $top) = $floatwin->rect; is($absolute->x, ($absolute_before->x - 20), 'moved 20 px to the left'); diff --git a/testcases/t/217-NET_CURRENT_DESKTOP.t b/testcases/t/217-NET_CURRENT_DESKTOP.t index 9ea4bd17..fe2ea675 100644 --- a/testcases/t/217-NET_CURRENT_DESKTOP.t +++ b/testcases/t/217-NET_CURRENT_DESKTOP.t @@ -41,9 +41,10 @@ $x->delete_property($root, $_NET_CURRENT_DESKTOP); $x->flush(); +# Returns the _NET_CURRENT_DESKTOP property from the root window. This is +# the 0 based index of the current desktop. sub current_desktop_index { - # Returns the _NET_CURRENT_DESKTOP property from the root window. This is - # the 0 based index of the current desktop. + sync_with_i3; my $cookie = $x->get_property(0, $root, $_NET_CURRENT_DESKTOP, $CARDINAL, 0, 1); -- 2.39.5