From 29298aaa6a49af9eb63e0c3e6932893034b93051 Mon Sep 17 00:00:00 2001 From: Alex Brainman Date: Thu, 1 Aug 2024 18:02:11 +1000 Subject: [PATCH] windows: delete TestGetKeyboardLayout According to https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getforegroundwindow GetForegroundWindow can return nil in some circumstances. So GetForegroundWindow cannot be used in the TestGetKeyboardLayout. Just delete the test for now. Fixes golang/go#68671 Change-Id: I7e05ac2f19b1a6310a3f7f690c6d02b0d1f5571e Reviewed-on: https://go-review.googlesource.com/c/sys/+/602335 Reviewed-by: Cherry Mui Reviewed-by: David Chase LUCI-TryBot-Result: Go LUCI Reviewed-by: Ayman Bagabas --- windows/syscall_windows_test.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/windows/syscall_windows_test.go b/windows/syscall_windows_test.go index ca8a70d2a..b7703dfe1 100644 --- a/windows/syscall_windows_test.go +++ b/windows/syscall_windows_test.go @@ -1438,17 +1438,6 @@ uintptr_t beep(void) { } } -func TestGetKeyboardLayout(t *testing.T) { - fg := windows.GetForegroundWindow() - tid, err := windows.GetWindowThreadProcessId(fg, nil) - if err != nil { - t.Fatalf("GetWindowThreadProcessId failed: %v", err) - } - - // We don't care about the result, just that it doesn't crash. - _ = windows.GetKeyboardLayout(tid) -} - func TestToUnicodeEx(t *testing.T) { var utf16Buf [16]uint16