Fix Thunderbird deselection and review test synchronization
This commit is contained in:
1 parent
e7d02b1f62
commit
7752c4e566
4 files changed
+115
-20
No files matched your search
@@ -113,6 +113,49 @@ func TestProcessEventsSuppressesQtPopupSelectionRepeats(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessEventsPresentsDeselectionAfterRowFocus(t *testing.T) {
|
||||
for _, role := range []string{"list item", "tree item"} {
|
||||
t.Run(role, func(t *testing.T) {
|
||||
speech := &fakeSpeechQueue{spoken: make(chan string, 8)}
|
||||
adapter := &fakeAdapter{events: make(chan atspi.Event, 8)}
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
done := make(chan struct{})
|
||||
go func() {
|
||||
processEvents(ctx, slog.New(slog.DiscardHandler), speech, adapter, 0)
|
||||
close(done)
|
||||
}()
|
||||
defer func() { cancel(); <-done }()
|
||||
|
||||
row := atspi.Snapshot{BusName: ":1.7", Path: "/attachments/1", Name: "Attachment",
|
||||
Role: role, Focused: true, Selected: true}
|
||||
adapter.events <- atspi.NewEvent(atspi.FocusEvent, row)
|
||||
adapter.events <- atspi.NewEvent(atspi.SelectedStateEvent, row)
|
||||
// Mozilla can reassert focus with the new selection state before
|
||||
// emitting selected:false. Focus omits the negative state, so the
|
||||
// subsequent deselection still needs its own announcement.
|
||||
row.Selected = false
|
||||
adapter.events <- atspi.NewEvent(atspi.FocusEvent, row)
|
||||
focused := atspi.NewEvent(atspi.FocusedStateEvent, row)
|
||||
focused.Detail1 = 1
|
||||
adapter.events <- focused
|
||||
adapter.events <- atspi.NewEvent(atspi.SelectedStateEvent, row)
|
||||
adapter.events <- atspi.NewEvent(atspi.FocusEvent,
|
||||
atspi.Snapshot{BusName: row.BusName, Path: "/done", Name: "Done", Role: "button"})
|
||||
for _, want := range []string{"Attachment, " + role + ", selected", "Attachment, " + role,
|
||||
"not selected", "Done, button"} {
|
||||
select {
|
||||
case got := <-speech.spoken:
|
||||
if got != want {
|
||||
t.Fatalf("speech = %q, want %q", got, want)
|
||||
}
|
||||
case <-time.After(time.Second):
|
||||
t.Fatalf("timed out waiting for %q", want)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestProcessEventsSuppressesUnfocusedNameChangesDuringFileNavigation(t *testing.T) {
|
||||
speech := &fakeSpeechQueue{spoken: make(chan string, 8)}
|
||||
adapter := &fakeAdapter{events: make(chan atspi.Event, 8)}
|
||||
|
||||
Reference in new issue
Block a user