From b572fea5c6d42c066dd4ebe4a874ef71e829b8b8 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Sat, 17 Jul 2010 15:52:22 +0200
Subject: [PATCH] testcase: use open_empty_con in some more testcases

---
 testcases/t/28-open-order.t        | 10 ++--------
 testcases/t/30-close-empty-split.t |  9 ++-------
 testcases/t/31-stacking-order.t    | 11 +++--------
 testcases/t/32-move-workspace.t    | 10 +++-------
 4 files changed, 10 insertions(+), 30 deletions(-)

diff --git a/testcases/t/28-open-order.t b/testcases/t/28-open-order.t
index b48e5ee5..98718e13 100644
--- a/testcases/t/28-open-order.t
+++ b/testcases/t/28-open-order.t
@@ -14,17 +14,11 @@ $i3->command("workspace $tmp")->recv;
 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
 
 # Open two new container
-$i3->command("open")->recv;
+my $first = open_empty_con($i3);
 
 ok(@{get_ws_content($tmp)} == 1, 'containers opened');
 
-my ($nodes, $focus) = get_ws_content($tmp);
-my $first = $focus->[0];
-
-$i3->command("open")->recv;
-
-($nodes, $focus) = get_ws_content($tmp);
-my $second = $focus->[0];
+my $second = open_empty_con($i3);
 
 isnt($first, $second, 'different container focused');
 
diff --git a/testcases/t/30-close-empty-split.t b/testcases/t/30-close-empty-split.t
index 31d0ad14..8685ff7f 100644
--- a/testcases/t/30-close-empty-split.t
+++ b/testcases/t/30-close-empty-split.t
@@ -13,9 +13,7 @@ $i3->command("workspace $tmp")->recv;
 
 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
 
-$i3->command('open')->recv;
-my ($nodes, $focus) = get_ws_content($tmp);
-my $first = $focus->[0];
+my $first = open_empty_con($i3);
 
 $i3->command('split v')->recv;
 
@@ -29,10 +27,7 @@ $i3->command('level up')->recv;
 my $split = $focus->[0];
 $i3->command('level down')->recv;
 
-$i3->command('open')->recv;
-
-($nodes, $focus) = get_ws_content($tmp);
-my $second = $focus->[0];
+my $second = open_empty_con($i3);
 
 isnt($first, $second, 'different container focused');
 
diff --git a/testcases/t/31-stacking-order.t b/testcases/t/31-stacking-order.t
index caf136fb..747d5b57 100644
--- a/testcases/t/31-stacking-order.t
+++ b/testcases/t/31-stacking-order.t
@@ -18,13 +18,8 @@ ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
 # Enforce vertical split mode
 $i3->command('split v')->recv;
 
-$i3->command('open')->recv;
-my ($nodes, $focus) = get_ws_content($tmp);
-my $first = $focus->[0];
-
-$i3->command('open')->recv;
-($nodes, $focus) = get_ws_content($tmp);
-my $second = $focus->[0];
+my $first = open_empty_con($i3);
+my $second = open_empty_con($i3);
 
 isnt($first, $second, 'two different containers opened');
 
@@ -33,7 +28,7 @@ isnt($first, $second, 'two different containers opened');
 ##############################################################
 
 $i3->command('layout stacking')->recv;
-($nodes, $focus) = get_ws_content($tmp);
+my ($nodes, $focus) = get_ws_content($tmp);
 is($focus->[0], $second, 'second container still focused');
 
 $i3->command('next v')->recv;
diff --git a/testcases/t/32-move-workspace.t b/testcases/t/32-move-workspace.t
index 7889d5a7..ceef9887 100644
--- a/testcases/t/32-move-workspace.t
+++ b/testcases/t/32-move-workspace.t
@@ -19,12 +19,8 @@ $i3->command("workspace $tmp")->recv;
 
 ok(@{get_ws_content($tmp)} == 0, 'no containers yet');
 
-$i3->command('open')->recv;
-my ($nodes, $focus) = get_ws_content($tmp);
-my $first = $focus->[0];
-$i3->command('open')->recv;
-($nodes, $focus) = get_ws_content($tmp);
-my $second = $focus->[0];
+my $first = open_empty_con($i3);
+my $second = open_empty_con($i3);
 ok(@{get_ws_content($tmp)} == 2, 'two containers on first ws');
 
 $i3->command("workspace $tmp2")->recv;
@@ -35,7 +31,7 @@ $i3->command("workspace $tmp")->recv;
 $i3->command("move workspace $tmp2")->recv;
 ok(@{get_ws_content($tmp)} == 1, 'one container on first ws anymore');
 ok(@{get_ws_content($tmp2)} == 1, 'one container on second ws');
-($nodes, $focus) = get_ws_content($tmp2);
+my ($nodes, $focus) = get_ws_content($tmp2);
 
 is($focus->[0], $second, 'same container on different ws');