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:
@@ -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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user