summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilhelm Schuster <ws@rot13.io>2020-11-10 16:58:09 +0100
committerWilhelm Schuster <ws@rot13.io>2020-11-10 17:16:56 +0100
commitc246f176eb7a9793a54b823eb0d58c0a1c83c645 (patch)
treee3556e9a7a2134abbb50ee65e2a20be88a7d1087
parent377f7d7ab2789400b39a717785d3e7d4f2ff8596 (diff)
downloadi3-c246f176eb7a9793a54b823eb0d58c0a1c83c645.tar.gz
i3-c246f176eb7a9793a54b823eb0d58c0a1c83c645.zip
Add regression test for #3888
-rw-r--r--RELEASE-NOTES-next1
-rw-r--r--testcases/t/542-layout-restore-remanage.t66
2 files changed, 67 insertions, 0 deletions
diff --git a/RELEASE-NOTES-next b/RELEASE-NOTES-next
index f8b6c65c..56e31bee 100644
--- a/RELEASE-NOTES-next
+++ b/RELEASE-NOTES-next
@@ -52,3 +52,4 @@ working. Please reach out to us in that case!
• fix Xorg memory leak with i3bar
• fix named workspace assignments on output changes
• fix named workspace assignment precedence on workspace renames
+ • fix windows getting swallowed more than once
diff --git a/testcases/t/542-layout-restore-remanage.t b/testcases/t/542-layout-restore-remanage.t
index 26b50835..82ec84d0 100644
--- a/testcases/t/542-layout-restore-remanage.t
+++ b/testcases/t/542-layout-restore-remanage.t
@@ -83,4 +83,70 @@ is($nodes[0]->{name}, 'different_title', 'test window got swallowed');
close($fh);
+############################################################
+# Make sure window only gets swallowed once
+############################################################
+# Regression, issue #3888
+$ws = fresh_workspace;
+
+($fh, $filename) = tempfile(UNLINK => 1);
+print $fh <<'EOT';
+// vim:ts=4:sw=4:et
+{
+ // splith split container with 2 children
+ "layout": "splith",
+ "type": "con",
+ "nodes": [
+ {
+ "type": "con",
+ "swallows": [
+ {
+ "class": "^foo$"
+ }
+ ]
+ },
+ {
+ // splitv split container with 2 children
+ "layout": "splitv",
+ "type": "con",
+ "nodes": [
+ {
+ "type": "con",
+ "swallows": [
+ {
+ "class": "^foo$"
+ }
+ ]
+ },
+ {
+ "type": "con",
+ "swallows": [
+ {
+ "class": "^foo$"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
+EOT
+$fh->flush;
+cmd "append_layout $filename";
+
+$window = open_window wm_class => 'foo';
+
+# Changing an unrelated window property originally resulted in the window
+# getting remanaged and swallowd by a different placeholder, even though the
+# matching property (class for the layout above) didn't change.
+change_window_title($window, "different_title");
+
+@content = @{get_ws_content($ws)};
+
+subtest 'regression test that window gets only swallowed once', sub {
+ is($content[0]->{nodes}[0]->{window}, $window->id, 'first placeholder swallowed window');
+ isnt($content[0]->{nodes}[1]->{nodes}[0]->{window}, $window->id, 'second placeholder did not swallow window');
+ isnt($content[0]->{nodes}[1]->{nodes}[1]->{window}, $window->id, 'thid placeholder did not swallow window');
+};
+
done_testing;