Owns its configuration, moved to picom's window rules; started once from the session's xinitrc slot; Go tools restart, rules, window-opacity and toggle, which find the operator's X session from the window manager's environment.
62 lines
2.1 KiB
Go
62 lines
2.1 KiB
Go
package main
|
|
|
|
import (
|
|
"reflect"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// picom's shape (novox/hq ADR 0208): it claims node-compositor and serves no verb of it, requires the
|
|
// X display on its own machine, owns its configuration file, and is started once, by its package's
|
|
// XDG autostart entry, never by the window manager or the session's start as well.
|
|
|
|
func TestItClaimsTheCompositorSeatAndRequiresTheXDisplay(t *testing.T) {
|
|
m := readManifest(t)
|
|
if m.Module != "picom" || m.Seats != nil {
|
|
t.Fatalf("module %q declares seats %v", m.Module, m.Seats)
|
|
}
|
|
if !reflect.DeepEqual(m.Claims, []claim{{Name: "node-compositor", Scope: "node"}}) {
|
|
t.Fatalf("claims: %+v", m.Claims)
|
|
}
|
|
if !reflect.DeepEqual(m.Requires, []string{"x11-display"}) {
|
|
t.Fatalf("requires: %v", m.Requires)
|
|
}
|
|
if present, absent := m.packages(); !reflect.DeepEqual(present, []string{"picom", "xorg-xprop"}) || absent != nil {
|
|
t.Fatalf("packages: %v, absent %v", present, absent)
|
|
}
|
|
}
|
|
|
|
func TestItOwnsItsConfigurationAsWrittenInTheModule(t *testing.T) {
|
|
m := readManifest(t)
|
|
m.sameAsSource(t, "configuration", "files/picom.conf")
|
|
if p := m.resource(t, "configuration")["path"]; p != "${machine:account-home}/.config/picom/picom.conf" {
|
|
t.Fatalf("path: %v", p)
|
|
}
|
|
if d := m.resource(t, "configuration-dir"); d["type"] != "directory" || d["path"] != "${machine:account-home}/.config/picom" {
|
|
t.Fatalf("the directory: %v", d)
|
|
}
|
|
}
|
|
|
|
func TestThePackagesAutostartEntryIsItsOnlyStart(t *testing.T) {
|
|
m := readManifest(t)
|
|
// picom's package ships /etc/xdg/autostart/picom.desktop, which the session's dex runs. A second
|
|
// start from here would be a second compositor, refused by the first.
|
|
if m.Shell != nil {
|
|
t.Fatalf("a session-start line as well as the package's autostart entry: %+v", m.Shell)
|
|
}
|
|
for _, r := range m.Resources {
|
|
if p, _ := r["path"].(string); strings.Contains(p, "i3/config.d") || strings.Contains(p, "autostart") {
|
|
t.Fatalf("a second start: %v", r)
|
|
}
|
|
if r["type"] == "service" || r["type"] == "process" {
|
|
t.Fatalf("a unit: %v", r)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestTheToolsAgreeWithTheManifest(t *testing.T) {
|
|
m := readManifest(t)
|
|
checkTheToolsAgree(t, m)
|
|
checkNoSecretsOrInstallationNames(t)
|
|
}
|