test(wayland): wait for the resume configure in TestPresentationFeedback
- commit
- 534f575ea7c7185d94d65beff0b85278ac2ad87b
- author
- brice · · 2026-10-02 10:42 UTC
- parent
- 0b4c780
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +14 -2
M internal/adapters/wayland/presentation_test.go +14 -2
| @@ -166,8 +166,20 @@ func TestPresentationFeedback(t *testing.T) { | |||
| 166 | 166 | t.Fatalf("hidden feedback: %+v", ev) | |
| 167 | 167 | } | |
| 168 | 168 | commands <- ports.ConfigureWindow{ID: w.ID, Width: 100, Height: 100, Output: "HEADLESS-1", Visible: true} | |
| 169 | - | // Synchronize the resume before committing the next feedback. | |
| 170 | - | s.display.Do(func() {}) | |
| 169 | + | // Wait for the resume before committing the next feedback: the command | |
| 170 | + | // goroutine applies it in its own display round trip, which an empty Do | |
| 171 | + | // here may overtake. | |
| 172 | + | for deadline := time.Now().Add(2 * time.Second); ; { | |
| 173 | + | var visible bool | |
| 174 | + | s.display.Do(func() { visible = s.windows[w.ID].last.Visible }) | |
| 175 | + | if visible { | |
| 176 | + | break | |
| 177 | + | } | |
| 178 | + | if time.Now().After(deadline) { | |
| 179 | + | t.Fatal("resume not applied") | |
| 180 | + | } | |
| 181 | + | time.Sleep(2 * time.Millisecond) | |
| 182 | + | } | |
| 171 | 183 | // Presented with the flip's time, counter and flags. | |
| 172 | 184 | a := feedback() | |
| 173 | 185 | commit() | |
| @@ -166,8 +166,20 @@ func TestPresentationFeedback(t *testing.T) { | |||||
| 166 | t.Fatalf("hidden feedback: %+v", ev) | 166 | t.Fatalf("hidden feedback: %+v", ev) | ||
| 167 | } | 167 | } | ||
| 168 | commands <- ports.ConfigureWindow{ID: w.ID, Width: 100, Height: 100, Output: "HEADLESS-1", Visible: true} | 168 | commands <- ports.ConfigureWindow{ID: w.ID, Width: 100, Height: 100, Output: "HEADLESS-1", Visible: true} | ||
| 169 | - | // Synchronize the resume before committing the next feedback. | 169 | + | // Wait for the resume before committing the next feedback: the command |
| 170 | - | s.display.Do(func() {}) | 170 | + | // goroutine applies it in its own display round trip, which an empty Do |
| 171 | + | // here may overtake. | |||
| 172 | + | for deadline := time.Now().Add(2 * time.Second); ; { | |||
| 173 | + | var visible bool | |||
| 174 | + | s.display.Do(func() { visible = s.windows[w.ID].last.Visible }) | |||
| 175 | + | if visible { | |||
| 176 | + | break | |||
| 177 | + | } | |||
| 178 | + | if time.Now().After(deadline) { | |||
| 179 | + | t.Fatal("resume not applied") | |||
| 180 | + | } | |||
| 181 | + | time.Sleep(2 * time.Millisecond) | |||
| 182 | + | } | |||
| 171 | // Presented with the flip's time, counter and flags. | 183 | // Presented with the flip's time, counter and flags. | ||
| 172 | a := feedback() | 184 | a := feedback() | ||
| 173 | commit() | 185 | commit() | ||