Continue web fixes. Sound bug for locations hopefully fixed.
This commit is contained in:
1 parent
453206b85b
commit
f034a2ec97
2 files changed
+63
-29
No files matched your search
@@ -147,34 +147,56 @@ func TestNativeBrowserActionOwnership(t *testing.T) {
|
|||||||
t.Fatalf("clickable discovery for %s: %v", name, found)
|
t.Fatalf("clickable discovery for %s: %v", name, found)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
worker, err := review.NewWorker(adapter, 2*time.Second)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := worker.Start(ctx); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer worker.Stop(context.Background())
|
||||||
|
worker.SyncFocus(focus)
|
||||||
|
await_result := func() review.Result {
|
||||||
|
t.Helper()
|
||||||
|
select {
|
||||||
|
case result := <-worker.Results():
|
||||||
|
if result.Err != nil || result.CaretErr != nil {
|
||||||
|
t.Fatalf("document command failed: %+v", result)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
case <-ctx.Done():
|
||||||
|
t.Fatal(ctx.Err())
|
||||||
|
return review.Result{}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
move_caret := func(command review.DocumentCaretCommand) review.Result {
|
||||||
|
t.Helper()
|
||||||
|
if err := worker.MoveDocumentCaret(command); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
return await_result()
|
||||||
|
}
|
||||||
|
previousContent := "Initial mode content"
|
||||||
for _, mode := range []string{"Basic", "Advanced"} {
|
for _, mode := range []string{"Basic", "Advanced"} {
|
||||||
// Reacquire references after each iframe replacement. Enter's target
|
// Use the reader's command path so asynchronous replacement events
|
||||||
// still comes from the text leaf, with native focus on the start heading.
|
// exercise its bounded recapture and cursor recovery.
|
||||||
tree, err = adapter.CaptureDocument(ctx, focus)
|
move_caret(review.CaretDocumentStart)
|
||||||
if err != nil {
|
reached := false
|
||||||
t.Fatal(err)
|
for step := 0; step < 16; step++ {
|
||||||
}
|
move := move_caret(review.CaretNextLine)
|
||||||
root, _ = tree.Root()
|
if strings.TrimSpace(move.DocumentCaretText) == strings.ToUpper(mode) {
|
||||||
document, err = tree.Document(ctx, root)
|
reached = true
|
||||||
if err != nil {
|
break
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
var label atspi.ObjectID
|
|
||||||
for _, node := range document.Nodes {
|
|
||||||
if node.Snapshot.Role == "static" && node.Snapshot.Name == strings.ToUpper(mode) {
|
|
||||||
label = node.Reference.ID()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cursor, _ = review.NewDocumentCursor(tree)
|
if !reached {
|
||||||
if _, err := cursor.SyncFocus(ctx, label); err != nil {
|
t.Fatalf("browse caret could not reach %s", mode)
|
||||||
|
}
|
||||||
|
if err := worker.ActivateDocumentCaret(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
target, err := cursor.ActivationTarget()
|
if result := await_result(); !result.DocumentActivate {
|
||||||
if err != nil {
|
t.Fatalf("missing activation result: %+v", result)
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if err := adapter.ActivateDocumentObject(ctx, target, focus); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
}
|
||||||
activated := false
|
activated := false
|
||||||
for !activated {
|
for !activated {
|
||||||
@@ -197,11 +219,15 @@ func TestNativeBrowserActionOwnership(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
ready := false
|
ready, obsolete := false, false
|
||||||
for _, node := range document.Nodes {
|
for _, node := range document.Nodes {
|
||||||
ready = ready || node.Snapshot.Name == mode+" mode content"
|
ready = ready || node.Snapshot.Name == mode+" mode content"
|
||||||
|
obsolete = obsolete || node.Snapshot.Name == previousContent
|
||||||
}
|
}
|
||||||
if ready {
|
if ready {
|
||||||
|
if obsolete {
|
||||||
|
t.Fatalf("replacement retained %q", previousContent)
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
@@ -212,11 +238,8 @@ func TestNativeBrowserActionOwnership(t *testing.T) {
|
|||||||
}
|
}
|
||||||
readNewContent := false
|
readNewContent := false
|
||||||
for step := 0; step < 8; step++ {
|
for step := 0; step < 8; step++ {
|
||||||
move, err := cursor.MoveCaret(ctx, adapter, review.CaretNextLine)
|
move := move_caret(review.CaretNextLine)
|
||||||
if err != nil {
|
if strings.TrimSpace(move.DocumentCaretText) == mode+" mode content" {
|
||||||
t.Fatalf("reading after %s activation: %v", mode, err)
|
|
||||||
}
|
|
||||||
if strings.TrimSpace(move.Text) == mode+" mode content" {
|
|
||||||
readNewContent = true
|
readNewContent = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -224,5 +247,6 @@ func TestNativeBrowserActionOwnership(t *testing.T) {
|
|||||||
if !readNewContent {
|
if !readNewContent {
|
||||||
t.Fatalf("browse caret could not reach %s replacement content", mode)
|
t.Fatalf("browse caret could not reach %s replacement content", mode)
|
||||||
}
|
}
|
||||||
|
previousContent = mode + " mode content"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,6 +140,16 @@ func TestNativeBrowserCaretLinkSounds(t *testing.T) {
|
|||||||
if !heading {
|
if !heading {
|
||||||
t.Fatal("fixture heading focus missing")
|
t.Fatal("fixture heading focus missing")
|
||||||
}
|
}
|
||||||
|
// Focus speech can arrive before asynchronous mode resolution installs
|
||||||
|
// the browse grabs. Wait for X11 to acknowledge them before sending the
|
||||||
|
// first caret command; native Ctrl+Home at the heading can emit no event.
|
||||||
|
for !commands.BrowseNavigationEnabled() {
|
||||||
|
select {
|
||||||
|
case <-time.After(5 * time.Millisecond):
|
||||||
|
case <-ctx.Done():
|
||||||
|
t.Fatal("browse grabs were not installed", ctx.Err())
|
||||||
|
}
|
||||||
|
}
|
||||||
check := func(chord, want string, pan *float64) float64 {
|
check := func(chord, want string, pan *float64) float64 {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
key(chord)
|
key(chord)
|
||||||
|
|||||||
Reference in new issue
Block a user