29 lines
872 B
Go
29 lines
872 B
Go
package ui
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"testing"
|
||
|
|
|
||
|
|
"gioui.org/widget/material"
|
||
|
|
)
|
||
|
|
|
||
|
|
func TestShellStartsWithSemanticInstanceStatuses(t *testing.T) {
|
||
|
|
shell := NewShell(material.NewTheme())
|
||
|
|
seen := map[string]bool{}
|
||
|
|
for _, row := range shell.rows {
|
||
|
|
seen[row.Status] = true
|
||
|
|
}
|
||
|
|
for _, status := range []string{"运行中", "启动中", "外部占用", "已退出"} {
|
||
|
|
if !seen[status] {
|
||
|
|
t.Fatalf("status %q is missing", status)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestShellSettingsCanBeRestored(t *testing.T) {
|
||
|
|
shell := NewShell(material.NewTheme())
|
||
|
|
shell.SetSettings(SettingsState{ChromePath: "chrome", EdgePath: "edge", DefaultDir: "profiles", LogDir: "logs", CloseOnExit: false})
|
||
|
|
if shell.chromePath.Text() != "chrome" || shell.edgePath.Text() != "edge" || shell.dataDir.Text() != "profiles" || shell.logDir.Text() != "logs" || shell.closeOnExit.Value {
|
||
|
|
t.Fatalf("settings were not restored")
|
||
|
|
}
|
||
|
|
}
|