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 <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ayman Bagabas <ayman.bagabas@gmail.com>
This commit is contained in:
Alex Brainman
2024-08-01 18:02:11 +10:00
committed by Cherry Mui
parent aa1c4c8554
commit 29298aaa6a

View File

@@ -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