test(core): cover a screen-sized tile mapping under a bound fullscreen
1 file · +28 -0
M internal/core/legacy_fullscreen_internal_test.go +28 -0
| @@ -1,6 +1,7 @@ | |||
| 1 | 1 | package core | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | + | "context" | |
| 4 | 5 | "testing" | |
| 5 | 6 | ||
| 6 | 7 | "github.com/bnema/neferwl/internal/ports" | |
| @@ -216,3 +217,30 @@ func TestLegacyFullscreenNeedsFocusAtFirstSize(t *testing.T) { | |||
| 216 | 217 | } | |
| 217 | 218 | }) | |
| 218 | 219 | } | |
| 220 | + | ||
| 221 | + | // The adapter's sequence for a screen-sized tile mapping under a cover | |
| 222 | + | // (bound fullscreen, animations on): the cover and its focus stay. | |
| 223 | + | func TestLegacyFullscreenUnderBoundCover(t *testing.T) { | |
| 224 | + | for _, anim := range []bool{false, true} { | |
| 225 | + | c, _, _ := fadeCore(t) | |
| 226 | + | c.cfg.Animations.On = anim | |
| 227 | + | sc := c.cur() | |
| 228 | + | c.mapWindow(ports.WindowMapped{ID: 1}) | |
| 229 | + | c.mapWindow(ports.WindowMapped{ID: 2}) | |
| 230 | + | sc.mon.ToggleFullscreen() | |
| 231 | + | w := sc.mon.Current() | |
| 232 | + | if w.fullscreen != 2 { | |
| 233 | + | t.Fatalf("setup: fullscreen = %d", w.fullscreen) | |
| 234 | + | } | |
| 235 | + | c.clientEvent(context.Background(), ports.WindowMapped{ID: 3}) | |
| 236 | + | o := sc.rect() | |
| 237 | + | c.clientEvent(context.Background(), ports.WindowResized{ID: 3, Width: o.W, Height: o.H}) | |
| 238 | + | _ = c.publish(context.Background()) | |
| 239 | + | if w.fullscreen != 2 { | |
| 240 | + | t.Fatalf("anim=%v: fullscreen = %d, want the cover 2", anim, w.fullscreen) | |
| 241 | + | } | |
| 242 | + | if id, _ := w.Focused(); id != 2 { | |
| 243 | + | t.Fatalf("anim=%v: focus moved to %d", anim, id) | |
| 244 | + | } | |
| 245 | + | } | |
| 246 | + | } | |
| @@ -1,6 +1,7 @@ | |||||
| 1 | package core | 1 | package core | ||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | + | "context" | |||
| 4 | "testing" | 5 | "testing" | ||
| 5 | 6 | ||||
| 6 | "github.com/bnema/neferwl/internal/ports" | 7 | "github.com/bnema/neferwl/internal/ports" | ||
| @@ -216,3 +217,30 @@ func TestLegacyFullscreenNeedsFocusAtFirstSize(t *testing.T) { | |||||
| 216 | } | 217 | } | ||
| 217 | }) | 218 | }) | ||
| 218 | } | 219 | } | ||
| 220 | + | ||||
| 221 | + | // The adapter's sequence for a screen-sized tile mapping under a cover | |||
| 222 | + | // (bound fullscreen, animations on): the cover and its focus stay. | |||
| 223 | + | func TestLegacyFullscreenUnderBoundCover(t *testing.T) { | |||
| 224 | + | for _, anim := range []bool{false, true} { | |||
| 225 | + | c, _, _ := fadeCore(t) | |||
| 226 | + | c.cfg.Animations.On = anim | |||
| 227 | + | sc := c.cur() | |||
| 228 | + | c.mapWindow(ports.WindowMapped{ID: 1}) | |||
| 229 | + | c.mapWindow(ports.WindowMapped{ID: 2}) | |||
| 230 | + | sc.mon.ToggleFullscreen() | |||
| 231 | + | w := sc.mon.Current() | |||
| 232 | + | if w.fullscreen != 2 { | |||
| 233 | + | t.Fatalf("setup: fullscreen = %d", w.fullscreen) | |||
| 234 | + | } | |||
| 235 | + | c.clientEvent(context.Background(), ports.WindowMapped{ID: 3}) | |||
| 236 | + | o := sc.rect() | |||
| 237 | + | c.clientEvent(context.Background(), ports.WindowResized{ID: 3, Width: o.W, Height: o.H}) | |||
| 238 | + | _ = c.publish(context.Background()) | |||
| 239 | + | if w.fullscreen != 2 { | |||
| 240 | + | t.Fatalf("anim=%v: fullscreen = %d, want the cover 2", anim, w.fullscreen) | |||
| 241 | + | } | |||
| 242 | + | if id, _ := w.Focused(); id != 2 { | |||
| 243 | + | t.Fatalf("anim=%v: focus moved to %d", anim, id) | |||
| 244 | + | } | |||
| 245 | + | } | |||
| 246 | + | } | |||