24 lines
931 B
Go
24 lines
931 B
Go
package preferences
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"git.stormux.org/storm/cthulhu/internal/platform/xorg"
|
|
)
|
|
|
|
func TestApplicationChoicesUseProfileIdentityAndWineChildren(t *testing.T) {
|
|
accessible := []applicationIdentity{{"Example Browser", 1}, {"Cthulhu Preferences", 2}, {"Example Terminal", 3}, {"Unknown PID Application", 0}, {"Other Unknown PID Application", 0}}
|
|
windows := []xorg.ApplicationWindow{
|
|
{Application: "browser-instance", PID: 1},
|
|
{Application: "browser-second-window", PID: 1},
|
|
{Application: "Game.exe", PID: 1, Wine: true},
|
|
{Application: "Game.exe", Wine: true},
|
|
{Application: "Example Editor", PID: 4},
|
|
}
|
|
want := []string{"Example Browser", "Example Editor", "Example Terminal", "Game.exe", "Other Unknown PID Application", "Unknown PID Application"}
|
|
if got := application_choices(accessible, windows); !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("applications = %v, want %v", got, want)
|
|
}
|
|
}
|