7fdcae5d14
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
24 lines
585 B
Go
24 lines
585 B
Go
//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)
|
|
}
|
|
}
|