summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2022-10-31 18:47:04 +0100
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2022-11-01 17:55:46 +0100
commitb2c696f680cd76d1e5c4ae2466e14ae994d9dff3 (patch)
tree086faa8e93babe7f64296a6b7e028ed461a0df17
parentb82b3e85da6da10eeee6010f1331a30b07b0ba07 (diff)
downloadi3-b2c696f680cd76d1e5c4ae2466e14ae994d9dff3.tar.gz
i3-b2c696f680cd76d1e5c4ae2466e14ae994d9dff3.zip
add basic gaps test
-rw-r--r--testcases/t/319-gaps.t64
1 files changed, 64 insertions, 0 deletions
diff --git a/testcases/t/319-gaps.t b/testcases/t/319-gaps.t
new file mode 100644
index 00000000..1ce3b0b8
--- /dev/null
+++ b/testcases/t/319-gaps.t
@@ -0,0 +1,64 @@
+#!perl
+# vim:ts=4:sw=4:expandtab
+#
+# Please read the following documents before working on tests:
+# • https://build.i3wm.org/docs/testsuite.html
+# (or docs/testsuite)
+#
+# • https://build.i3wm.org/docs/lib-i3test.html
+# (alternatively: perldoc ./testcases/lib/i3test.pm)
+#
+# • https://build.i3wm.org/docs/ipc.html
+# (or docs/ipc)
+#
+# • http://onyxneon.com/books/modern_perl/modern_perl_a4.pdf
+# (unless you are already familiar with Perl)
+#
+# Basic gaps functionality test
+# Ticket: #3724
+
+use i3test i3_config => <<EOT;
+# i3 config file (v4)
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+gaps inner 10
+gaps outer 20
+
+default_border pixel 0
+EOT
+
+my $tmp = fresh_workspace;
+
+my $left = open_window;
+my $right = open_window;
+
+my $screen_width = 1280;
+my $screen_height = 800;
+my $outer_gaps = 20;
+my $inner_gaps = 10;
+my $total_gaps = $outer_gaps + $inner_gaps;
+my $left_rect = $left->rect;
+my $right_rect = $right->rect;
+
+# Gaps toward one screen edge, each window covers half of the screen,
+# each gets half of the inner gaps.
+my $expected_width = ($screen_width / 2) - $total_gaps - ($inner_gaps / 2);
+
+# Gaps toward the screen edges at top and bottom.
+my $expected_height = $screen_height - 2 * $total_gaps;
+
+is_deeply($left_rect, {
+ x => $total_gaps,
+ y => $total_gaps,
+ width => $expected_width,
+ height => $expected_height,
+}, 'left window position and size matches gaps expectations');
+
+is_deeply($right_rect, {
+ x => $left_rect->x + $left_rect->width + $inner_gaps,
+ y => $total_gaps,
+ width => $expected_width,
+ height => $expected_height,
+}, 'right window position and size matches gaps expectations');
+
+done_testing;