Group inline links and list items into browse lines

This commit is contained in:
ak47 committed 2026-11-07 20:31:50 -05:00
1 parent 3dbd7f2554
commit d01965c00d
16 files changed
+309 -15

No files matched your search

+28
View File
@@ -26,6 +26,7 @@ import (
"git.stormux.org/storm/cthulhu/internal/review"
"git.stormux.org/storm/cthulhu/internal/sound"
"log/slog"
"strings"
"testing"
"time"
)
@@ -420,3 +421,30 @@ func TestCaretPresentationUsesAncestorRoleSound(t *testing.T) {
t.Fatal("missing link sound")
}
}
func TestCaretVisualLinePresentsEveryLink(t *testing.T) {
plain := atspi.Snapshot{BusName: ":1.20", Path: "/plain", Role: "static"}
link := atspi.Snapshot{BusName: ":1.20", Path: "/link", Role: "link", Visited: true}
line := atspi.DocumentLine{Contents: []atspi.DocumentContent{
{Snapshot: plain, Text: "Before "}, {Snapshot: link, Text: "Example"}, {Snapshot: plain, Text: " after."},
}, SourceContexts: [][]atspi.Snapshot{{plain}, {link}, {plain}}}
result := review.Result{Moved: true, DocumentCaretCommand: review.CaretNextLine,
DocumentCaretText: "Before Example after.", DocumentCaretLine: &line,
DocumentPosition: review.DocumentPosition{Snapshot: plain},
}
queue := &autocompleteRequestQueue{requests: make(chan speechRequest, 1)}
presentDocumentCaretResult(slog.New(slog.DiscardHandler), queue, result, presentation.DefaultOptions())
if got := (<-queue.requests).Text; got != "Before, Example, visited link, after." {
t.Fatalf("line speech = %q", got)
}
result.ReadAllContext, result.ReadAllLines = t.Context(), []atspi.DocumentLine{line}
presentReadAllResult(slog.New(slog.DiscardHandler), queue, result, presentation.DefaultOptions())
request := <-queue.requests
var text []string
for _, part := range request.ReadAll {
text = append(text, part.Text)
}
if got := strings.Join(text, " "); got != "Before Example visited link after." {
t.Fatalf("Say All = %q", got)
}
}