Fifteen file components: FileExplorer, FileGrid, FileIcon, PathBar, MemoryCard, DiskUsage, UploadQueue, Trash, RecentFiles, FilePreview, ArchiveViewer, FileDetails, SharePanel, SyncStatus and QuotaMeter. FileIcon draws six kinds as hand-placed 12x12 pages and a folder. The browsers build on data.Tree, List, GridView and Table; ArchiveViewer owns its sort and keeps the caller's index on its entry. UploadQueue keys rows by name so focus stays on its row. SharePanel never logs the link. SyncStatus turns its arrows on Busy steps, so syncing moves under Reduce Motion. data.Tree now opens the closed branches above a chosen path it knows, so a caller's starting path survives the first frame.
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package gallery
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestFilesDemosLogTheirActions(t *testing.T) {
|
|
// Clicks that only focus a component may log nothing.
|
|
quiet := map[string]bool{"FOLDERS": true}
|
|
for _, tc := range []struct {
|
|
path string
|
|
steps []string
|
|
}{
|
|
{"/c/406-fileexplorer", []string{"FOLDERS", "key:Up"}}, {"/c/407-filegrid", []string{"SAVE1.SAV", "key:Right", "key:Enter"}},
|
|
{"/c/409-pathbar", []string{"GAMES", "BACK DOWN"}}, {"/c/410-memorycard", []string{"DELETE HERO QUEST"}},
|
|
{"/c/412-uploadqueue", []string{"CANCEL BOSS.PNG"}}, {"/c/413-trash", []string{"EMPTY", "THROW AWAY"}},
|
|
{"/c/414-recentfiles", []string{"Recent", "key:Down", "key:Enter"}}, {"/c/415-filepreview", []string{"SUNSET.PNG"}},
|
|
{"/c/416-archiveviewer", []string{"LOOT.ZIP", "key:Down", "SIZE"}}, {"/c/418-sharepanel", []string{"COPY", "EDIT"}},
|
|
} {
|
|
a, tt := open(tc.path)
|
|
slug := tc.path[3:]
|
|
for _, step := range tc.steps {
|
|
before := len(a.logs[slug])
|
|
if k, ok := strings.CutPrefix(step, "key:"); ok {
|
|
tt.Key(0, letters[k])
|
|
} else {
|
|
click(t, tt, step)
|
|
}
|
|
if len(a.logs[slug]) <= before && !quiet[step] {
|
|
t.Errorf("%s: %s logged nothing: %q", slug, step, a.logs[slug])
|
|
}
|
|
}
|
|
}
|
|
}
|