1package capture
2
3import (
4 "testing"
5
6 "github.com/bnema/neferwl/internal/ports"
7 "github.com/stretchr/testify/require"
8)
9
10// A content change of a window only the hidden workspace draws needs a frame
11// (its child render and the reads it releases); the displayed scene alone
12// would say no.
13func TestShowsCountsHiddenWorkspace(t *testing.T) {
14 s := ports.Scene{
15 OutputWidth: 100, OutputHeight: 50,
16 Windows: []ports.SceneWindow{{ID: 1, Rect: ports.Rect{W: 100, H: 50}}},
17 CaptureScene: &ports.Scene{
18 OutputWidth: 100, OutputHeight: 50,
19 Windows: []ports.SceneWindow{{ID: 5, Rect: ports.Rect{W: 100, H: 50}}},
20 },
21 }
22 require.True(t, Shows(s, 1), "displayed window")
23 require.True(t, Shows(s, 5), "hidden workspace window")
24 require.False(t, s.Shows(5), "the displayed scene alone does not show it")
25 require.False(t, Shows(s, 9), "unrelated window")
26 s.CaptureScene = nil
27 require.False(t, Shows(s, 5), "no hidden workspace, no frame")
28 require.True(t, Shows(s, 1))
29}