// Copyright (c) 2026 Storm Dragon // Authors: Storm Dragon, Angus Kola // SPDX-License-Identifier: GPL-3.0-or-later package atspi import ( "strings" "testing" "unicode/utf8" ) func TestLibreOfficeFormulaPreservesLiteralSpacesAndBoundedPrefix(t *testing.T) { formula := `="two spaces"` if got := sanitizeLibreOfficeFormula(formula); got != formula { t.Fatalf("formula literal changed: %q", got) } formula += strings.Repeat("猫", maxSnapshotFieldLength) got := sanitizeLibreOfficeFormula(formula) if len(got) > maxSnapshotFieldLength || !utf8.ValidString(got) || !strings.HasPrefix(formula, got) { t.Fatalf("invalid bounded formula prefix: bytes=%d", len(got)) } }