Files
core/gui/window/filedialog_windows_test.go
terminarandClaude Opus 5.5 5d141c7cef gui/window: native open and save file dialogs
ShowFileDialog (UI thread) and ChooseFile (any goroutine, waits) show a
native dialog for the window -- NSOpenPanel/NSSavePanel as a sheet on
macOS, GetOpenFileNameW/GetSaveFileNameW on Windows -- with a title, a
start folder, a suggested name and allowed extensions. It only returns
the chosen path; one dialog at a time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 23:41:23 +01:00

23 lines
439 B
Go

//go:build windows
package window
import "testing"
func TestFileFilter(t *testing.T) {
raw := fileFilter([]string{"pdf", ".txt"})
s := string(utf16Runes(raw))
want := "*.pdf;*.txt (*.pdf;*.txt)\x00*.pdf;*.txt\x00All files (*.*)\x00*.*\x00\x00\x00"
if s != want {
t.Errorf("filter = %q, want %q", s, want)
}
}
func utf16Runes(u []uint16) []rune {
r := make([]rune, len(u))
for i, c := range u {
r[i] = rune(c)
}
return r
}