aboutsummaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-12-23 20:31:03 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-12-30 20:12:37 +0300
commit5488aaf69ffeb6ef504a4bec0b54a893155713cf (patch)
treee8fad27ee7c7e14d79286f4cc6e2c26885f2ff5f /src/tests
parent96e493d8b1bcfdd62f608256f2fe1b90904d5798 (diff)
downloadniri-5488aaf69ffeb6ef504a4bec0b54a893155713cf.tar.gz
niri-5488aaf69ffeb6ef504a4bec0b54a893155713cf.tar.bz2
niri-5488aaf69ffeb6ef504a4bec0b54a893155713cf.zip
floating: Don't use fullscreen size as floating size
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/floating.rs60
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA2.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spB1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA2.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB2.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA2.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB2.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA2.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB2.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA2.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB1.snap2
-rw-r--r--src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB2.snap2
20 files changed, 79 insertions, 19 deletions
diff --git a/src/tests/floating.rs b/src/tests/floating.rs
index b880745f..ece1a5dc 100644
--- a/src/tests/floating.rs
+++ b/src/tests/floating.rs
@@ -725,3 +725,63 @@ fn interactive_move_restores_floating_size_when_set_to_floating() {
@""
);
}
+
+#[test]
+fn floating_doesnt_store_fullscreen_size() {
+ let mut f = Fixture::new();
+ f.add_output(1, (1920, 1080));
+ f.add_output(2, (1280, 720));
+
+ // Open a window fullscreen.
+ let id = f.add_client();
+ let window = f.client(id).create_window();
+ let surface = window.surface.clone();
+ window.set_fullscreen(None);
+ window.commit();
+ f.roundtrip(id);
+
+ let window = f.client(id).window(&surface);
+ window.attach_new_buffer();
+ window.set_size(1920, 1080);
+ window.ack_last_and_commit();
+ f.double_roundtrip(id);
+
+ let _ = f.client(id).window(&surface).recent_configures();
+
+ // Make it floating.
+ f.niri().layout.toggle_window_floating(None);
+ f.double_roundtrip(id);
+
+ // This should request 0 × 0 to unfullscreen.
+ assert_snapshot!(
+ f.client(id).window(&surface).format_recent_configures(),
+ @"size: 0 × 0, bounds: 1920 × 1080, states: [Activated]"
+ );
+
+ // Without committing, make it tiling again. We never committed while floating, so there's no
+ // floating size to remember.
+ f.niri().layout.toggle_window_floating(None);
+ f.double_roundtrip(id);
+
+ // This should request the tiled size.
+ assert_snapshot!(
+ f.client(id).window(&surface).format_recent_configures(),
+ @"size: 1920 × 1048, bounds: 1888 × 1048, states: [Activated]"
+ );
+
+ // Commit in response.
+ let window = f.client(id).window(&surface);
+ window.set_size(100, 100);
+ window.ack_last_and_commit();
+ f.roundtrip(id);
+
+ // Make the window floating again.
+ f.niri().layout.toggle_window_floating(None);
+ f.double_roundtrip(id);
+
+ // This shouldn't request any size change, particularly not the fullscreen size.
+ assert_snapshot!(
+ f.client(id).window(&surface).format_recent_configures(),
+ @"size: 100 × 100, bounds: 1920 × 1080, states: [Activated]"
+ );
+}
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA1.snap
index e8a53953..dbcb70f1 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA2.snap
index 5f068979..734218b9 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spA2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spB1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spB1.snap
index 94af9b36..be7991d7 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spB1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@fsT-wfsAA-spB1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA1.snap
index 245d6712..5e2ed003 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA2.snap
index d26d382d..08bb2929 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spA2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB1.snap
index 7f1ec39d..6396769d 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB2.snap
index e2b10554..ca10d9b2 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@out1-fsT-wfsAA-spB2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA1.snap
index 0e5bcffb..9ebdb8d8 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA2.snap
index 794b7a11..d4b89fdc 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spA2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB1.snap
index 67cff00f..22e105da 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB2.snap
index a8621ce9..dba34ea5 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-fsT-wfsAA-spB2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA1.snap
index 6d9f0828..0b35423b 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA2.snap
index 950503cc..ca0aea42 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spA2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB1.snap
index 79628535..765241e4 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB2.snap
index d97e1dcc..f8c022be 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out1-fsT-wfsAA-spB2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA1.snap
index 2708f587..932a6ad7 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA2.snap
index aae7b880..055c467c 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spA2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1248 × 688, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB1.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB1.snap
index 396d54d1..21a35d38 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB1.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB1.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]
diff --git a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB2.snap b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB2.snap
index bdbdf330..e5720dd4 100644
--- a/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB2.snap
+++ b/src/tests/snapshots/niri__tests__window_opening__check_target_output_and_workspace@ws1-out2-fsT-wfsAA-spB2.snap
@@ -12,4 +12,4 @@ size: 1280 × 720, bounds: 1280 × 720, states: [Fullscreen]
post-map configures:
size: 0 × 0, bounds: 1280 × 720, states: []
-size: 1 × 1, bounds: 1280 × 720, states: [Activated]
+size: 0 × 0, bounds: 1280 × 720, states: [Activated]