Skip to content

Commit

Permalink
windows: delete TestGetKeyboardLayout
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
alexbrainman authored and cherrymui committed Aug 5, 2024
1 parent aa1c4c8 commit 29298aa
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions windows/syscall_windows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 29298aa

Please sign in to comment.