]> git.sur5r.net Git - i3/i3/blobdiff - testcases/t/206-fullscreen-scratchpad.t
Move is_num_fullscreen to Test.pm
[i3/i3] / testcases / t / 206-fullscreen-scratchpad.t
index 53fca52acd3feb6cedfed596f0eb76cc468d7edf..95245099332f991f736f36868a74d591c62f5ac4 100644 (file)
@@ -2,13 +2,13 @@
 # vim:ts=4:sw=4:expandtab
 #
 # Please read the following documents before working on tests:
-# • http://build.i3wm.org/docs/testsuite.html
+# • https://build.i3wm.org/docs/testsuite.html
 #   (or docs/testsuite)
 #
-# • http://build.i3wm.org/docs/lib-i3test.html
+# • https://build.i3wm.org/docs/lib-i3test.html
 #   (alternatively: perldoc ./testcases/lib/i3test.pm)
 #
-# • http://build.i3wm.org/docs/ipc.html
+# • https://build.i3wm.org/docs/ipc.html
 #   (or docs/ipc)
 #
 # • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
@@ -21,15 +21,6 @@ use i3test;
 
 my $tmp = fresh_workspace;
 
-sub fullscreen_windows {
-    my $ws = $tmp;
-    $ws = shift if @_;
-
-    my $nodes = scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)->[0]->{nodes}};
-    my $cons = scalar grep { $_->{fullscreen_mode} != 0 } @{get_ws_content($ws)};
-    return $nodes + $cons;
-}
-
 ##########################################################################################
 # map two windows in one container, fullscreen one of them and then move it to scratchpad
 ##########################################################################################
@@ -41,7 +32,7 @@ my $second_win = open_window;
 cmd 'fullscreen';
 
 # see if the window really is in fullscreen mode
-is(fullscreen_windows(), 1, 'amount of fullscreen windows after enabling fullscreen');
+is_num_fullscreen($tmp, 1, 'amount of fullscreen windows after enabling fullscreen');
 
 # move window to scratchpad
 cmd 'move scratchpad';
@@ -57,7 +48,7 @@ cmd 'scratchpad show';
 cmd 'floating toggle';
 
 # see if no window is in fullscreen mode
-is(fullscreen_windows(), 0, 'amount of fullscreen windows after showing previously fullscreened scratchpad window');
+is_num_fullscreen($tmp, 0, 'amount of fullscreen windows after showing previously fullscreened scratchpad window');
 
 ########################################################################################
 # move a window to scratchpad, focus parent container, make it fullscreen, focus a child
@@ -79,7 +70,7 @@ cmd 'fullscreen';
 cmd 'focus child';
 
 # see if the window really is in fullscreen mode
-is(fullscreen_windows(), 1, 'amount of fullscreen windows after enabling fullscreen on parent');
+is_num_fullscreen($tmp, 1, 'amount of fullscreen windows after enabling fullscreen on parent');
 
 ##########################################################################
 # show a scratchpad window; no window should be in fullscreen mode anymore
@@ -89,6 +80,6 @@ is(fullscreen_windows(), 1, 'amount of fullscreen windows after enabling fullscr
 cmd 'scratchpad show';
 
 # see if no window is in fullscreen mode
-is(fullscreen_windows(), 0, 'amount of fullscreen windows after showing a scratchpad window while a parent container was in fullscreen mode');
+is_num_fullscreen($tmp, 0, 'amount of fullscreen windows after showing a scratchpad window while a parent container was in fullscreen mode');
 
 done_testing;