forge
Explore
Log in

Don't you dare go Hollow

layout/tests: Implement going into fullscreen state

Browse files at this commit

fbb399f01d739b8f1e3774dee725ae6ef33c2af9Ivan MolodetskikhParent: 6a80ec4
src/layout/tests.rsmodified+34 -3
@@ -28,6 +28,7 @@ struct TestWindowInner {
2828 max_size: Size<i32, Logical>,
2929 pending_fullscreen: Cell<bool>,
3030 pending_activated: Cell<bool>,
31+ is_fullscreen: Cell<bool>,
3132 }
3233
3334 #[derive(Debug, Clone)]
@@ -70,10 +71,13 @@ impl TestWindow {
7071 max_size: params.min_max_size.1,
7172 pending_fullscreen: Cell::new(false),
7273 pending_activated: Cell::new(false),
74+ is_fullscreen: Cell::new(false),
7375 }))
7476 }
7577
7678 fn communicate(&self) -> bool {
79+ let mut changed = false;
80+
7781 if let Some(size) = self.0.requested_size.get() {
7882 assert!(size.w >= 0);
7983 assert!(size.h >= 0);
@@ -88,11 +92,16 @@ impl TestWindow {
8892
8993 if self.0.bbox.get() != new_bbox {
9094 self.0.bbox.set(new_bbox);
91- return true;
95+ changed = true;
9296 }
9397 }
9498
95- false
99+ if self.0.is_fullscreen.get() != self.0.pending_fullscreen.get() {
100+ self.0.is_fullscreen.set(self.0.pending_fullscreen.get());
101+ changed = true;
102+ }
103+
104+ changed
96105 }
97106 }
98107
@@ -182,7 +191,7 @@ impl LayoutElement for TestWindow {
182191 fn set_floating(&mut self, _floating: bool) {}
183192
184193 fn is_fullscreen(&self) -> bool {
185- false
194+ self.0.is_fullscreen.get()
186195 }
187196
188197 fn is_pending_fullscreen(&self) -> bool {
@@ -3156,6 +3165,28 @@ fn disable_tabbed_mode_in_fullscreen() {
31563165 check_ops(&ops);
31573166 }
31583167
3168+#[test]
3169+fn unfullscreen_with_large_border() {
3170+ let ops = [
3171+ Op::AddWindow {
3172+ params: TestWindowParams::new(0),
3173+ },
3174+ Op::FullscreenWindow(0),
3175+ Op::Communicate(0),
3176+ Op::FullscreenWindow(0),
3177+ ];
3178+
3179+ let options = Options {
3180+ border: niri_config::Border {
3181+ off: false,
3182+ width: niri_config::FloatOrInt(10000.),
3183+ ..Default::default()
3184+ },
3185+ ..Default::default()
3186+ };
3187+ check_ops_with_options(options, &ops);
3188+}
3189+
31593190 fn parent_id_causes_loop(layout: &Layout<TestWindow>, id: usize, mut parent_id: usize) -> bool {
31603191 if parent_id == id {
31613192 return true;