Skip to content

[windows] Keyboard unit tests fail when run on a machine with a non-US keyboard layout #189566

Description

@sero583

Steps to reproduce

  1. On a Windows machine whose active keyboard layout is not US English (for example German, de-DE), build the Windows unit tests: et build -c host_debug_unopt //flutter/shell/platform/windows:flutter_windows_unittests (or the ninja target directly).
  2. Run the keyboard suite: flutter_windows_unittests.exe --gtest_filter=KeyboardTest.*.

Expected results

The keyboard tests pass regardless of the keyboard layout configured on the machine running them. Unit tests should be hermetic.

Actual results

KeyboardTest.DeadKeyTwiceThenLetter fails on a German layout (35 pass, 1 fail). The test presses VK_OEM_3 and expects the grave accent `, but the harness resolves the character through the real MapVirtualKey(vk, MAPVK_VK_TO_CHAR), which consults the active layout; on a German layout VK_OEM_3 is an umlaut (ö), so the logical key and character no longer match what the test, authored against the US and US-International layouts, expects.

The test helpers LayoutDefault and LayoutFrench in keyboard_unittests.cc both fall back to the real MapVirtualKey, so any test whose virtual keys map differently between the host layout and US will diverge. DeadKeyTwiceThenLetter is the one that currently diverges; the coupling is latent for the rest.

Code sample

Code sample
Not applicable: this is an engine unit-test hermeticity bug, reproduced by
running flutter_windows_unittests on a non-US-layout machine. No Dart app is
involved.

Screenshots or Video

Screenshots / Video demonstration

Not applicable.

Logs

Logs
[ RUN      ] KeyboardTest.DeadKeyTwiceThenLetter
[  FAILED  ] KeyboardTest.DeadKeyTwiceThenLetter
[  PASSED  ] 35 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] KeyboardTest.DeadKeyTwiceThenLetter

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.44.4, on Microsoft Windows [Version 10.0.19045.6466], locale de-DE) [874ms]
    • Flutter version 3.44.4 on channel stable at C:\Users\serha\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ad70ec4617 (3 weeks ago), 2026-06-24 11:07:06 -0700
    • Engine revision 53bfd6d932
    • Dart version 3.12.0 (build 3.12.0-139.0.dev)
    • DevTools version 2.54.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration

[√] Windows Version (10 Pro 64-bit, 22H2, 2009) [5,4s]

[√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [15,9s]
    • Android SDK at C:\Users\serha\AppData\Local\Android\sdk
    • Emulator version 31.2.9.0 (build_id 8316981) (CL:N/A)
    • Platform android-36, build-tools 36.1.0
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web [294ms]
    • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.14.20) [292ms]
    • Visual Studio at F:\VS_CPP_Tools
    • Visual Studio Build Tools 2022 version 17.14.36705.20
    • Windows 10 SDK version 10.0.26100.0

[√] Connected device (3 available) [281ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.19045.6466]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 150.0.7871.115
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 150.0.4078.65

[√] Network resources [752ms]
    • All expected network resources are available.

• No issues found!

Reproduces on current master; the two test layout helpers still fall back to MapVirtualKey.

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: desktopRunning on desktopa: tests"flutter test", flutter_test, or one of our testsengineflutter/engine related. See also e: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-windowsBuilding on or for Windows specificallyteam-windowsOwned by the Windows platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions