Add enforce.Guard port with X11 and no-op adapters

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-01 12:33:02 -04:00
parent d0e6893659
commit 7fdcae5d14
5 changed files with 108 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
//go:build linux
package enforce
import (
"context"
"os"
"testing"
"time"
)
func TestX11GuardMinimizeActiveDoesNotPanic(t *testing.T) {
if os.Getenv("DISPLAY") == "" {
t.Skip("no DISPLAY; skipping live X11 minimize smoke test")
}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
// Either it minimizes the active window or returns an error (e.g. no active
// window); we only assert it returns without panicking.
if err := NewGuard().MinimizeActive(ctx); err != nil {
t.Logf("MinimizeActive returned (acceptable): %v", err)
}
}