Files
Reims-Go/internal/host/process_tree_windows_test.go

28 lines
746 B
Go

//go:build windows
package host
import "testing"
func TestForegroundInPIDsMatchesAnyListedProcess(t *testing.T) {
fg := ForegroundPID()
if fg == 0 {
t.Skip("no foreground window in this session")
}
if !ForegroundInPIDs([]uint32{1, fg, 2}) {
t.Errorf("ForegroundInPIDs missed the foreground process %d among several", fg)
}
if ForegroundInPIDs([]uint32{fg + 1000003}) {
t.Error("ForegroundInPIDs matched an unrelated process")
}
}
func TestProcessTreeDisplayWindowNeedsAPID(t *testing.T) {
if hwnd := ProcessTreeDisplayWindow(nil); hwnd != 0 {
t.Errorf("ProcessTreeDisplayWindow(nil) = %#x", hwnd)
}
if hwnd := ProcessTreeDisplayWindow([]uint32{0}); hwnd != 0 {
t.Errorf("ProcessTreeDisplayWindow(PID 0) = %#x", hwnd)
}
}