test(cef): require effective mapped ancestor visibility
- commit
- 04c1bf88e96bf6f8fd9387520c43d52cd8e65674
- author
- brice · · 2026-07-14 07:16 UTC
- committer
- brice · · 2026-07-14 09:32 UTC
- parent
- ca9c392
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +19 -0
M internal/infrastructure/cef/webview_visibility_test.go +19 -0
| @@ -6,6 +6,25 @@ import ( | |||
| 6 | 6 | "github.com/stretchr/testify/require" | |
| 7 | 7 | ) | |
| 8 | 8 | ||
| 9 | + | func TestEffectiveViewportVisibilityRequiresMappedVisibleAncestors(t *testing.T) { | |
| 10 | + | tests := []struct { | |
| 11 | + | name string | |
| 12 | + | states []viewportWidgetVisibility | |
| 13 | + | visible bool | |
| 14 | + | }{ | |
| 15 | + | {name: "mapped visible widget", states: []viewportWidgetVisibility{{visible: true, mapped: true}}, visible: true}, | |
| 16 | + | {name: "unmapped widget", states: []viewportWidgetVisibility{{visible: true, mapped: false}}}, | |
| 17 | + | {name: "hidden widget", states: []viewportWidgetVisibility{{visible: false, mapped: true}}}, | |
| 18 | + | {name: "hidden ancestor", states: []viewportWidgetVisibility{{visible: true, mapped: true}, {visible: false, mapped: true}}}, | |
| 19 | + | {name: "unmapped ancestor", states: []viewportWidgetVisibility{{visible: true, mapped: true}, {visible: true, mapped: false}}}, | |
| 20 | + | } | |
| 21 | + | for _, tt := range tests { | |
| 22 | + | t.Run(tt.name, func(t *testing.T) { | |
| 23 | + | require.Equal(t, tt.visible, effectiveViewportVisibility(tt.states)) | |
| 24 | + | }) | |
| 25 | + | } | |
| 26 | + | } | |
| 27 | + | ||
| 9 | 28 | func TestWebViewEffectiveVisibilitySendsInitialStateAndDeduplicatesTransitions(t *testing.T) { | |
| 10 | 29 | host := &viewportSyncOrderHost{} | |
| 11 | 30 | wv := &WebView{} | |
| @@ -6,6 +6,25 @@ import ( | |||||
| 6 | "github.com/stretchr/testify/require" | 6 | "github.com/stretchr/testify/require" | ||
| 7 | ) | 7 | ) | ||
| 8 | 8 | ||||
| 9 | + | func TestEffectiveViewportVisibilityRequiresMappedVisibleAncestors(t *testing.T) { | |||
| 10 | + | tests := []struct { | |||
| 11 | + | name string | |||
| 12 | + | states []viewportWidgetVisibility | |||
| 13 | + | visible bool | |||
| 14 | + | }{ | |||
| 15 | + | {name: "mapped visible widget", states: []viewportWidgetVisibility{{visible: true, mapped: true}}, visible: true}, | |||
| 16 | + | {name: "unmapped widget", states: []viewportWidgetVisibility{{visible: true, mapped: false}}}, | |||
| 17 | + | {name: "hidden widget", states: []viewportWidgetVisibility{{visible: false, mapped: true}}}, | |||
| 18 | + | {name: "hidden ancestor", states: []viewportWidgetVisibility{{visible: true, mapped: true}, {visible: false, mapped: true}}}, | |||
| 19 | + | {name: "unmapped ancestor", states: []viewportWidgetVisibility{{visible: true, mapped: true}, {visible: true, mapped: false}}}, | |||
| 20 | + | } | |||
| 21 | + | for _, tt := range tests { | |||
| 22 | + | t.Run(tt.name, func(t *testing.T) { | |||
| 23 | + | require.Equal(t, tt.visible, effectiveViewportVisibility(tt.states)) | |||
| 24 | + | }) | |||
| 25 | + | } | |||
| 26 | + | } | |||
| 27 | + | ||||
| 9 | func TestWebViewEffectiveVisibilitySendsInitialStateAndDeduplicatesTransitions(t *testing.T) { | 28 | func TestWebViewEffectiveVisibilitySendsInitialStateAndDeduplicatesTransitions(t *testing.T) { | ||
| 10 | host := &viewportSyncOrderHost{} | 29 | host := &viewportSyncOrderHost{} | ||
| 11 | wv := &WebView{} | 30 | wv := &WebView{} | ||