Merge origin/testing into hunter

This commit is contained in:
hjozwiak committed 2026-11-03 10:35:41 -05:00
commit a4d427099e
19 files changed
+424 -35

No files matched your search

+3 -1
View File
@@ -79,6 +79,7 @@ func brailleDocumentFrame(result review.Result, options config.BrailleOptions, c
}
}
if assembled != nil {
strippedObjects := false
for index, content := range assembled.Contents {
raw := content.RawText
if index == len(assembled.Contents)-1 {
@@ -91,11 +92,12 @@ func brailleDocumentFrame(result review.Result, options config.BrailleOptions, c
// as their own contents; drop it instead of duplicating them.
native := !strings.ContainsRune(raw, '\ufffc')
if !native {
strippedObjects = true
raw = stripEmbeddedObjects(raw)
}
appendContent(content.Snapshot, raw, content.Separator, content.Start, native)
}
if strings.TrimSpace(frame.Text) == "" {
if strippedObjects && strings.TrimSpace(frame.Text) == "" {
// Nothing but placeholders survived assembly; fall back to
// the displayed text speech would use for this object.
if text := brailleDisplayedText(snapshot); text != "" {
+18
View File
@@ -481,6 +481,24 @@ func TestBrowseBrailleAssembledLineDropsEmbeddedObjectPlaceholders(t *testing.T)
}
}
func TestBrowseBrailleAssembledWhitespaceKeepsNativeMapping(t *testing.T) {
snapshot := atspi.Snapshot{BusName: ":1.999", Path: "/text", Role: "static", Name: "Accessible label", Text: "Other text"}
tree, err := atspi.NewAccessibleTree(snapshot.ID(), []atspi.TreeNode{{Snapshot: snapshot}})
if err != nil {
t.Fatal(err)
}
object, _ := tree.Reference(snapshot.ID())
result := review.Result{DocumentEpoch: 1, DocumentFocus: snapshot.ID(),
DocumentPosition: review.DocumentPosition{Document: object, Snapshot: snapshot, Offset: 1},
DocumentCaretLine: &atspi.DocumentLine{Contents: []atspi.DocumentContent{{
Snapshot: snapshot, Start: 0, End: 2, RawText: " ",
}}}}
frame := brailleDocumentFrame(result, config.DefaultSettings().Braille)
if frame.Text != " " || frame.Cursor != 1 || len(frame.Routes) != 1 || frame.Routes[0].SourceText != " " {
t.Fatalf("ordinary whitespace replaced by object fallback: %+v", frame)
}
}
func (*tableBrailleCapturer) ReadDocumentCaret(context.Context, atspi.ObjectReference, int, atspi.DocumentCaretUnit) (atspi.DocumentCaretText, error) {
return atspi.DocumentCaretText{}, nil
}