Files
Das-OS/srcpkgs/das-theme/files/xfwm4gen/main_test.go
T
dasandClaude Opus 5.5 b7399031c7 Initial Das OS 0.1.0: Void Linux live ISO with Xfce
- xbps-src templates: das-theme (adw-gtk3-based GTK themes, generated
  xfwm4 frames, wallpapers, logo), das-settings (Xfce, panel, LightDM
  defaults in /etc/xdg/das), adw-gtk3 and font-jetbrains-mono
- void-mklive profile in live/: packages, runit services, rootfs overlay,
  Ukrainian locale, live user with autologin
- Void builder container, build scripts, QEMU runner and Makefile
- Bilingual README with screenshots

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 21:23:16 +03:00

62 lines
1.7 KiB
Go

package main
import (
"os"
"path/filepath"
"testing"
)
// xfwm4 falls back to an ugly built-in frame when any of these slices is missing.
var requiredSlices = []string{
"top-left", "top-right", "left", "right", "bottom", "bottom-left", "bottom-right",
"title-1", "title-2", "title-3", "title-4", "title-5",
}
var requiredButtons = []string{
"close", "hide", "maximize", "maximize-toggled", "menu",
"shade", "shade-toggled", "stick", "stick-toggled",
}
func TestGenerateWritesCompleteTheme(t *testing.T) {
for name, v := range variants {
t.Run(name, func(t *testing.T) {
dir := t.TempDir()
if err := generate(v, dir); err != nil {
t.Fatal(err)
}
want := []string{"themerc"}
for _, s := range requiredSlices {
want = append(want, s+"-active.png", s+"-inactive.png")
}
for _, b := range requiredButtons {
for _, state := range []string{"active", "inactive", "prelight", "pressed"} {
want = append(want, b+"-"+state+".png")
}
}
for _, f := range want {
if _, err := os.Stat(filepath.Join(dir, f)); err != nil {
t.Errorf("missing %s", f)
}
}
})
}
}
func TestTopLeftCornerIsTransparentOutsideRadius(t *testing.T) {
img := render(cornerWidth, titleHeight, topLeft(variants["light"].active))
if a := img.NRGBAAt(0, 0).A; a != 0 {
t.Errorf("corner pixel alpha = %d, want 0", a)
}
if a := img.NRGBAAt(cornerWidth-1, titleHeight/2).A; a != 0xff {
t.Errorf("title pixel alpha = %d, want 255", a)
}
}
func TestButtonsMatchTitleHeight(t *testing.T) {
for _, p := range pieces(variants["dark"]) {
if p.w == buttonWidth && p.h != titleHeight {
t.Errorf("%s height = %d, want %d", p.name, p.h, titleHeight)
}
}
}