More work on LibreOffice support.

This commit is contained in:
Storm Dragon committed 2026-10-15 00:50:49 -04:00
1 parent e0c8c6198c
commit 4ac59d4ced
25 files changed
+392 -57

No files matched your search

+36
View File
@@ -26,6 +26,42 @@ func calcTestEvent(eventType, path, value, coordinate string) atspi.Event {
return event
}
func TestLibreOfficeFormulaCommandUsesOwnedFocusAndSecurityGates(t *testing.T) {
speech := &fakeSpeechQueue{spoken: make(chan string, 4)}
state := eventLoopState{}
state.current = calcTestEvent(atspi.FocusEvent, "/cell", "43", "C1").Source
state.current.LibreOffice.Formula = "B1+1"
gate := &focusGate{}
display := &flashRecorder{}
live := &liveSettings{}
live.Store(config.DefaultSettings())
queue := outputQueue{speech: speech, braille: display, live: live}
handler := eventReviewHandler{state: &state, speech: queue, focusGate: gate,
syncForeground: func() {}}
handler.presentCellFormula()
if got := <-speech.spoken; got != "B1+1" {
t.Fatalf("formula = %q", got)
}
if len(display.messages) != 1 || display.messages[0] != "B1+1" {
t.Fatalf("formula Braille flash = %v", display.messages)
}
gate.secure.Store(true)
handler.presentCellFormula()
gate.secure.Store(false)
gate.suspended.Store(true)
handler.presentCellFormula()
gate.suspended.Store(false)
if len(speech.spoken) != 0 || len(display.messages) != 1 {
t.Fatal("formula command bypassed lock or suspension")
}
// Synchronizing foreground ownership can retire the old Calc focus.
handler.syncForeground = func() { state.current = atspi.Snapshot{} }
handler.presentCellFormula()
if got := <-speech.spoken; got != "Not in a table." {
t.Fatalf("stale foreground formula = %q", got)
}
}
func TestLibreOfficeMovementEditingAndFocusReturn(t *testing.T) {
state := eventLoopState{}
state.presentationOptions = presentation.DefaultOptions()