Descovered a but on Slint where if the reported sizes differ preferences would not rport. HOpefully fixed. This could probably affect more than just Slint, just happened to catch it there.

This commit is contained in:
Storm Dragon committed 2026-11-01 14:33:50 -05:00
1 parent 7591f65b58
commit d0fdce7285
9 files changed
+90

No files matched your search

+31
View File
@@ -44,6 +44,37 @@ func TestForegroundWindowCorrelationSteamBigPictureScale(t *testing.T) {
}
}
func TestPreferencesForegroundIdentity(t *testing.T) {
// Slint/i3 reports GTK's frame and the X11 client with different borders.
client := xorg.Foreground{Known: true, Window: 45, PID: 123,
X: 2, Y: 18, Width: 1912, Height: 974, OuterX: 2, OuterY: 18, OuterWidth: 1912, OuterHeight: 974}
if foregroundWindowMatches(client, 123, Rectangle{Width: 1916, Height: 994}) {
t.Fatal("fixture must reproduce the reported bounds mismatch")
}
for _, test := range []struct {
name string
client xorg.Foreground
pid int
owned int64
want bool
}{
{"owned foreground helper", client, 123, 123, true},
{"helper closed", client, 123, 0, false},
{"another reader's helper", client, 123, 124, false},
{"other provider", client, 124, 123, false},
{"helper in background", xorg.Foreground{Known: true, Window: 46, PID: 124}, 123, 123, false},
{"missing foreground PID", xorg.Foreground{Known: true, Window: 45}, 123, 123, false},
{"empty workspace", xorg.Foreground{Known: true, PID: 123}, 123, 123, false},
{"unknown foreground", xorg.Foreground{Window: 45, PID: 123}, 123, 123, false},
} {
t.Run(test.name, func(t *testing.T) {
if got := preferences_foreground_matches(test.client, test.pid, test.owned); got != test.want {
t.Fatalf("match = %v, want %v", got, test.want)
}
})
}
}
func TestForegroundMenuPopupCorrelation(t *testing.T) {
client := xorg.Foreground{Known: true, Window: 45, PID: 123}
main := NewObjectID(":1.40", "/main")