Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(cua-driver): pace Windows foreground type_text one readable unit at a time (#4901)
injaneitye63171fabe7d
diff --git a/libs/cua-driver/rust/crates/cua-driver-e2e/Cargo.toml b/libs/cua-driver/rust/crates/cua-driver-e2e/Cargo.tomlindex 3932c32aa6..d413d182aa 100644--- a/libs/cua-driver/rust/crates/cua-driver-e2e/Cargo.toml+++ b/libs/cua-driver/rust/crates/cua-driver-e2e/Cargo.toml@@ -61,5 +61,7 @@ windows = { version = "0.61", features = ["Win32_Foundation","Win32_Security","Win32_System_Threading",+ "Win32_UI_Input_Ime",+ "Win32_UI_Input_KeyboardAndMouse","Win32_UI_WindowsAndMessaging",] }diff --git a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/installed_app_notepad_windows_test.rs b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/installed_app_notepad_windows_test.rsnew file mode 100644index 0000000000..09d237414b--- /dev/null+++ b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/installed_app_notepad_windows_test.rs@@ -0,0 +1,183 @@+//! Foreground `type_text` through packaged Notepad, saved and compared (#4830).+//!+//! Manual. Arm A's failure rate was not measured, so this uses the floor of 5 trials.++#![cfg(target_os = "windows")]++use std::path::Path;+use std::process::{Command, Stdio};+use std::time::{Duration, Instant};++use cua_driver_testkit::{spawn_in_job, ChildReaper, Driver, McpDriver};+use windows::Win32::Foundation::{HWND, LPARAM, WPARAM};+use windows::Win32::UI::Input::Ime::ImmGetDefaultIMEWnd;+use windows::Win32::UI::Input::KeyboardAndMouse::GetKeyboardLayout;+use windows::Win32::UI::WindowsAndMessaging::{+ GetWindowThreadProcessId, IsWindowVisible, SendMessageW,+};++#[path = "support/native_windows.rs"]+mod native_windows;+use native_windows::native_windows;++const TRIALS: usize = 5;+const T1: &str = "CH-RAW-20261006114218790-010444e4 \u{8f66}\u{6b21}1\u{ff1a}G4915 00:34 \u{4e0a}\u{6d77}\u{8679}\u{6865} \u{2192} 01:19 \u{676d}\u{5dde}\u{4e1c} \u{5386}\u{65f6}0\u{65f6}45\u{5206} \u{4e8c}\u{7b49}\u{5ea7}\u{6709}\u{7968}\u{ff08}\u{9875}\u{9762}\u{672a}\u{663e}\u{793a}\u{4ef7}\u{683c}\u{660e}\u{7ec6}\u{ff09}";+const WINUI3: &str = concat!(+ "\nCUA-MULTILINE-START\nASCII-LF-A-31\nASCII-LF-B-47\n",+ "ASCII-CRLF-A-52\r\nASCII-CRLF-B-68\nASCII-CR-A-13\rASCII-CR-B-24\n",+ "\u{8f66}\u{6b21} G7391\r\n\u{4e2d}\u{6587} 12345\nEMPTY-A-17\n\n\nEMPTY-B-29\n",+ "EMOJI-A \u{1f642} 123\r\nEMOJI-B \u{1f680} 456\nCUA-MULTILINE-END\n",+);++fn corpus_t2() -> String {+ let piece = format!("{T1}RAW-CUA-FT-CRLF-B-47数字 12345{WINUI3}");+ let mut out = String::new();+ while out.chars().count() < 390 {+ out.push_str(&piece);+ }+ out.chars().take(390).collect()+}++#[test]+#[ignore]+fn foreground_type_text_round_trips_through_notepad_save() {+ let t1: Vec<char> = T1.chars().collect();+ assert_eq!((t1.len(), &t1[75..78]), (91, &['二', '等', '座'][..]));+ let t2 = corpus_t2();+ assert_eq!(t2.chars().count(), 390);+ assert!(t2.contains("\r\n") && t2.contains('\n') && t2.contains("ASCII-CR-A-13\r"));+ assert!(t2.contains("二等座") && t2.contains('🙂') && t2.contains('🚀'));++ let mut driver = McpDriver::spawn_named("notepad-foreground-type-text")+ .expect("build cua-driver or set CUA_TEST_DRIVER_BIN");+ for trial in 0..TRIALS {+ round_trip(&mut driver, trial, "t1", T1);+ round_trip(&mut driver, trial, "t2", &t2);+ }+}++fn round_trip(driver: &mut McpDriver, trial: usize, label: &str, text: &str) {+ let dir = tempfile::tempdir().expect("tempdir");+ let path = dir.path().join(format!("cua4830-{label}-{trial}.txt"));+ std::fs::write(&path, "").expect("empty file");+ let mut command = Command::new("notepad.exe");+ command+ .arg(&path)+ .stdout(Stdio::null())+ .stderr(Stdio::null());+ driver+ .reaper()+ .push(spawn_in_job(&mut command).expect("notepad"));+ let stem = path.file_name().unwrap().to_string_lossy().into_owned();+ let (pid, hwnd) = wait_for_title(&stem)+ .unwrap_or_else(|| panic!("no Notepad window for {stem}\n{}", note(0)));+ let mut kill = ChildReaper::new();+ kill.track_pid(pid);+ let typed = driver.call(+ "type_text",+ serde_json::json!({+ "pid": pid as i64, "window_id": hwnd, "text": text, "delivery_mode": "foreground"+ }),+ );+ assert!(+ !typed.is_error(),+ "{label} type_text: {}\n{}",+ typed.text(),+ note(hwnd)+ );+ // Notepad's Save accelerator is under a closed File menu, so hotkey's UIA walk misses it.+ let saved = driver.call(+ "press_key",+ serde_json::json!({+ "pid": pid as i64, "window_id": hwnd, "key": "s",+ "modifiers": ["ctrl"], "delivery_mode": "foreground"+ }),+ );+ assert!(+ !saved.is_error(),+ "{label} Ctrl+S: {}\n{}",+ saved.text(),+ note(hwnd)+ );+ assert_eq!(+ read_saved(&path, hwnd),+ normalize(text),+ "{label} trial {trial}\n{}",+ note(hwnd)+ );+}++fn read_saved(path: &Path, hwnd: u64) -> String {+ let deadline = Instant::now() + Duration::from_secs(5);+ let mut last = 0u64;+ let mut stable: Option<Instant> = None;+ loop {+ let len = std::fs::metadata(path).map(|m| m.len()).unwrap_or(0);+ if len > 0+ && len == last+ && stable.get_or_insert_with(Instant::now).elapsed() >= Duration::from_millis(500)+ {+ break;+ }+ if len != last {+ last = len;+ stable = None;+ }+ assert!(Instant::now() < deadline, "file not stable\n{}", note(hwnd));+ std::thread::sleep(Duration::from_millis(50));+ }+ let bytes = std::fs::read(path).expect("read save");+ normalize(+ &String::from_utf8(bytes).unwrap_or_else(|e| panic!("not utf-8: {e}\n{}", note(hwnd))),+ )+}++fn normalize(text: &str) -> String {+ text.strip_prefix('\u{feff}')+ .unwrap_or(text)+ .replace("\r\n", "\n")+ .replace('\r', "\n")+}++fn wait_for_title(prefix: &str) -> Option<(u32, u64)> {+ let deadline = Instant::now() + Duration::from_secs(10);+ loop {+ if let Some((pid, hwnd, _)) = native_windows().into_iter().find(|(_, hwnd, title)| {+ title.starts_with(prefix) && unsafe { IsWindowVisible(HWND(*hwnd as *mut _)) }.as_bool()+ }) {+ return Some((pid, hwnd));+ }+ if Instant::now() >= deadline {+ return None;+ }+ std::thread::sleep(Duration::from_millis(100));+ }+}++fn note(hwnd: u64) -> String {+ let versions = Command::new("powershell.exe")+ .args(["-NoProfile", "-Command", "$c=Get-ItemProperty 'HKLM:\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'; $n=(Get-AppxPackage Microsoft.WindowsNotepad).Version; \"build=$($c.CurrentBuild).$($c.UBR) notepad=$n\""])+ .output()+ .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())+ .unwrap_or_else(|e| e.to_string());+ if hwnd == 0 {+ return format!("{versions} hkl=unknown ime_open=unknown");+ }+ unsafe {+ let window = HWND(hwnd as *mut _);+ let hkl = format!(+ "{:?}",+ GetKeyboardLayout(GetWindowThreadProcessId(window, None))+ );+ let ime = ImmGetDefaultIMEWnd(window);+ let open = if ime.0.is_null() {+ "none".into()+ } else {+ format!(+ "{:?}",+ SendMessageW(ime, 0x0283, Some(WPARAM(5)), Some(LPARAM(0)))+ )+ };+ format!("{versions} hkl={hkl} ime_open={open}")+ }+}diff --git a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/launch_windows_test.rs b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/launch_windows_test.rsindex e56113e721..cb59857840 100644--- a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/launch_windows_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/launch_windows_test.rs@@ -12,12 +12,12 @@ use cua_driver_testkit::e2e::{};use cua_driver_testkit::sentinel::ForegroundSentinel;use cua_driver_testkit::{harness_app, spawn_in_job, Driver, McpDriver};-use windows::core::BOOL;-use windows::Win32::Foundation::{HWND, LPARAM, TRUE};-use windows::Win32::UI::WindowsAndMessaging::{- EnumWindows, GetWindowTextLengthW, GetWindowTextW, GetWindowThreadProcessId, IsIconic,- ShowWindow, SW_MINIMIZE,-};+use windows::Win32::Foundation::HWND;+use windows::Win32::UI::WindowsAndMessaging::{IsIconic, ShowWindow, SW_MINIMIZE};++#[path = "support/native_windows.rs"]+mod native_windows;+use native_windows::native_windows;#[test]#[ignore]@@ -185,36 +185,6 @@ fn launch_app_minimized_preserves_foreground() {});}-fn native_windows() -> Vec<(u32, u64, String)> {- unsafe extern "system" fn callback(hwnd: HWND, lparam: LPARAM) -> BOOL {- let windows = &mut *(lparam.0 as *mut Vec<(u32, u64, String)>);- let title_len = GetWindowTextLengthW(hwnd);- if title_len > 0 {- let mut title = vec![0u16; title_len as usize + 1];- let copied = GetWindowTextW(hwnd, &mut title);- if copied > 0 {- let mut pid = 0u32;- GetWindowThreadProcessId(hwnd, Some(&mut pid));- windows.push((- pid,- hwnd.0 as u64,- String::from_utf16_lossy(&title[..copied as usize]),- ));- }- }- TRUE- }-- let mut windows = Vec::new();- unsafe {- let _ = EnumWindows(- Some(callback),- LPARAM(&mut windows as *mut Vec<(u32, u64, String)> as isize),- );- }- windows-}-fn wait_for_window(pid: u32) -> (u64, String) {let deadline = std::time::Instant::now() + Duration::from_secs(10);loop {diff --git a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/support/native_windows.rs b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/support/native_windows.rsnew file mode 100644index 0000000000..89e4c0449d--- /dev/null+++ b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/support/native_windows.rs@@ -0,0 +1,35 @@+use windows::core::BOOL;+use windows::Win32::Foundation::{HWND, LPARAM, TRUE};+use windows::Win32::UI::WindowsAndMessaging::{+ EnumWindows, GetWindowTextLengthW, GetWindowTextW, GetWindowThreadProcessId,+};++pub fn native_windows() -> Vec<(u32, u64, String)> {+ unsafe extern "system" fn callback(hwnd: HWND, lparam: LPARAM) -> BOOL {+ let windows = &mut *(lparam.0 as *mut Vec<(u32, u64, String)>);+ let title_len = GetWindowTextLengthW(hwnd);+ if title_len > 0 {+ let mut title = vec![0u16; title_len as usize + 1];+ let copied = GetWindowTextW(hwnd, &mut title);+ if copied > 0 {+ let mut pid = 0u32;+ GetWindowThreadProcessId(hwnd, Some(&mut pid));+ windows.push((+ pid,+ hwnd.0 as u64,+ String::from_utf16_lossy(&title[..copied as usize]),+ ));+ }+ }+ TRUE+ }++ let mut windows = Vec::new();+ unsafe {+ let _ = EnumWindows(+ Some(callback),+ LPARAM(&mut windows as *mut Vec<(u32, u64, String)> as isize),+ );+ }+ windows+}diff --git a/libs/cua-driver/rust/crates/platform-windows/src/input/keyboard.rs b/libs/cua-driver/rust/crates/platform-windows/src/input/keyboard.rsindex 116f094529..a0b1d9b8ae 100644--- a/libs/cua-driver/rust/crates/platform-windows/src/input/keyboard.rs+++ b/libs/cua-driver/rust/crates/platform-windows/src/input/keyboard.rs@@ -31,6 +31,8 @@ use windows::Win32::UI::WindowsAndMessaging::{};use windows::Win32::UI::WindowsAndMessaging::{GetForegroundWindow, SetForegroundWindow};+use crate::win32::{foreground_matches_target_or_owned_window, windows::ForegroundTarget};+// ── XAML / UWP host detection ────────────────────────────────────────────────//// Two routing signals, OR'd:@@ -470,7 +472,7 @@ pub fn send_key_synthesized_after_focus(events.push(key_input(*mvk, true));}- with_confirmed_foreground(target, "key delivery", focus, || unsafe {+ with_confirmed_foreground(target, "key delivery", focus, |_, _| unsafe {let sent = SendInput(&events, std::mem::size_of::<INPUT>() as i32);if sent as usize != events.len() {bail!(@@ -497,6 +499,7 @@ pub fn send_key_synthesized_after_focus(/// `send_key_synthesized` returns, so the caller gets an honest error instead/// of a false success. Required for VCL/LibreOffice document grids and other/// targets where PostMessage WM_CHAR is silently dropped.+/// Attached delivery paces one UTF-16 unit or line break at a time.pub fn send_text_synthesized(hwnd: u64, text: &str) -> Result<()> {send_text_synthesized_after_focus(hwnd, text, || Ok(()))}@@ -521,34 +524,51 @@ pub fn send_text_synthesized_after_focus(// (`post_enter_keystroke`) — because terminals and rich editors honour an// Enter key event, not a raw `\r`/`\n` Unicode packet. `\r\n` collapses to// a single Return (the `\r` emits the Enter; the following `\n` is silent).- let return_vk = windows::Win32::UI::Input::KeyboardAndMouse::VK_RETURN;- let mut events: Vec<INPUT> = Vec::with_capacity(text.len() * 2);- let mut prev_was_cr = false;- for ch in text.chars() {- match ch {- '\n' if prev_was_cr => {- prev_was_cr = false;- }- '\n' | '\r' => {- events.push(key_input(return_vk, false));- events.push(key_input(return_vk, true));- prev_was_cr = ch == '\r';- }- _ => {- prev_was_cr = false;- let mut buf = [0u16; 2];- for unit in ch.encode_utf16(&mut buf) {- events.push(unicode_key_input(*unit, false));- events.push(unicode_key_input(*unit, true));- }- }- }- }- if events.is_empty() {+ let units = text_units(text);+ if units.is_empty() {return Ok(());}+ let n = units.len();- with_confirmed_foreground(target, "text delivery", focus, || unsafe {+ with_confirmed_foreground(target, "text delivery", focus, |att, ft| unsafe {+ if let Some(att) = att {+ for (k, unit) in units.iter().enumerate() {+ let actual = GetForegroundWindow();+ if !foreground_matches_target_or_owned_window(ft, actual.0 as usize as u64) {+ bail!(+ "foreground_lost: foreground moved to HWND {h:?} after {k} of {n} \+ text units were read; the remaining {remaining} were not sent. \+ Nothing was retried; inspect the target before sending the rest.",+ h = actual.0,+ remaining = n - k,+ );+ }+ match att.send_and_await_read(&unit_events(unit), Duration::from_secs(2)) {+ UnitRead::Read => {}+ UnitRead::Short(sent) => bail!(+ "SendInput inserted only {sent} of 4 key events for text unit {} of {n} \+ ({k} earlier units were read). Windows blocked the rest: the target \+ runs at a higher integrity level than the Driver (UIPI), or the input \+ desktop is locked or showing a secure prompt. To drive an elevated \+ app, run the Driver elevated (the default autostart daemon is).",+ k + 1+ ),+ UnitRead::Stalled => bail!(+ "text_delivery_stalled: the target did not read text unit {} of {n} \+ within 2000 ms; {k} earlier units were read. Unit {} was inserted \+ and may still appear, possibly in the previously foreground window. \+ Nothing was retried; inspect the target before sending the rest.",+ k + 1,+ k + 1+ ),+ }+ }+ return Ok(());+ }+ let mut events = Vec::with_capacity(n * 2);+ for unit in &units {+ events.extend_from_slice(&unit_events(unit)[..2]);+ }let sent = SendInput(&events, std::mem::size_of::<INPUT>() as i32);if sent as usize != events.len() {bail!(@@ -587,7 +607,7 @@ fn with_confirmed_foreground<T>(target: HWND,operation: &str,focus: impl FnOnce() -> Result<()>,- body: impl FnOnce() -> Result<T>,+ body: impl FnOnce(Option<&InputQueueAttachment>, ForegroundTarget) -> Result<T>,) -> Result<T> {let previous = unsafe { GetForegroundWindow() };let _ = unsafe { crate::input::force_foreground_assisted(target) };@@ -624,7 +644,7 @@ fn with_confirmed_foreground<T>(let deadline = Instant::now() + Duration::from_millis(250);let actual = loop {let actual = unsafe { GetForegroundWindow() };- if crate::win32::foreground_matches_target_or_owned_window(+ if foreground_matches_target_or_owned_window(foreground_target,actual.0 as usize as u64,) {@@ -635,10 +655,7 @@ fn with_confirmed_foreground<T>(}sleep(Duration::from_millis(10));};- if !crate::win32::foreground_matches_target_or_owned_window(- foreground_target,- actual.0 as usize as u64,- ) {+ if !foreground_matches_target_or_owned_window(foreground_target, actual.0 as usize as u64) {bail!("foreground_unavailable: exact target HWND {:?} or a verified same-process \owned window was not foreground while preparing {operation} \@@ -650,7 +667,7 @@ fn with_confirmed_foreground<T>(// Attach before inserting anything: attaching resets the shared key// state, which must not race with modifiers the body is about to send.attachment = InputQueueAttachment::attach(actual);- body()+ body(attachment.as_ref(), foreground_target)})();// Keep the target foreground until its thread has read every inserted@@ -674,6 +691,12 @@ fn with_confirmed_foreground<T>(/// produces no character.const DRAIN_SENTINEL_VK: VIRTUAL_KEY = VIRTUAL_KEY(0xE8);+enum UnitRead {+ Read,+ Short(u32),+ Stalled,+}+/// The caller's thread attached to the foreground thread's input queue for/// the duration of one foreground input transaction; detaches on drop.struct InputQueueAttachment {@@ -727,6 +750,27 @@ impl InputQueueAttachment {sleep(Duration::from_millis(5));}}++ /// Insert `events`, then yield until the sentinel key-up is read or `timeout`.+ fn send_and_await_read(&self, events: &[INPUT], timeout: Duration) -> UnitRead {+ use windows::Win32::UI::Input::KeyboardAndMouse::GetKeyState;+ let before = unsafe { GetKeyState(DRAIN_SENTINEL_VK.0 as i32) } & 1;+ let sent = unsafe { SendInput(events, std::mem::size_of::<INPUT>() as i32) };+ if (sent as usize) < events.len() {+ return UnitRead::Short(sent);+ }+ let deadline = Instant::now() + timeout;+ loop {+ let state = unsafe { GetKeyState(DRAIN_SENTINEL_VK.0 as i32) };+ if (state & 1) != before && state >= 0 {+ return UnitRead::Read;+ }+ if Instant::now() >= deadline {+ return UnitRead::Stalled;+ }+ std::thread::yield_now();+ }+ }}impl Drop for InputQueueAttachment {@@ -755,6 +799,46 @@ fn sentinel_key_input(up: bool) -> INPUT {}}+enum TextUnit {+ Packet(u16),+ Return,+}++/// One readable VK_PACKET, or one Return. A supplementary scalar is two Packets (high, low).+fn text_units(text: &str) -> Vec<TextUnit> {+ let mut units = Vec::with_capacity(text.len());+ let mut prev_was_cr = false;+ for ch in text.chars() {+ match ch {+ '\n' if prev_was_cr => {+ prev_was_cr = false;+ }+ '\n' | '\r' => {+ units.push(TextUnit::Return);+ prev_was_cr = ch == '\r';+ }+ _ => {+ prev_was_cr = false;+ let mut buf = [0u16; 2];+ for unit in ch.encode_utf16(&mut buf) {+ units.push(TextUnit::Packet(*unit));+ }+ }+ }+ }+ units+}++/// The unit's key events followed by the drain sentinel, inserted by one SendInput.+fn unit_events(unit: &TextUnit) -> [INPUT; 4] {+ use windows::Win32::UI::Input::KeyboardAndMouse::VK_RETURN;+ let (d, u) = match unit {+ TextUnit::Packet(c) => (unicode_key_input(*c, false), unicode_key_input(*c, true)),+ TextUnit::Return => (key_input(VK_RETURN, false), key_input(VK_RETURN, true)),+ };+ [d, u, sentinel_key_input(false), sentinel_key_input(true)]+}+/// Build a single Unicode keyboard INPUT struct for one UTF-16 code unit,/// either down (`up = false`) or up (`up = true`). Used by/// [`send_text_synthesized`].@@ -934,3 +1018,84 @@ mod extended_key_tests {}}}++#[cfg(test)]+mod text_unit_tests {+ use super::*;++ #[test]+ fn cjk_issue_fixture_is_three_packets() {+ assert!(matches!(+ text_units("二等座").as_slice(),+ [+ TextUnit::Packet(0x4E8C),+ TextUnit::Packet(0x7B49),+ TextUnit::Packet(0x5EA7)+ ]+ ));+ }++ #[test]+ fn emoji_is_two_surrogate_packets() {+ assert!(matches!(+ text_units("🙂").as_slice(),+ [TextUnit::Packet(0xD83D), TextUnit::Packet(0xDE42)]+ ));+ }++ #[test]+ fn crlf_and_lone_breaks_are_one_return_each() {+ assert!(matches!(+ text_units("a\r\nb\rc\nd").as_slice(),+ [+ TextUnit::Packet(0x61),+ TextUnit::Return,+ TextUnit::Packet(0x62),+ TextUnit::Return,+ TextUnit::Packet(0x63),+ TextUnit::Return,+ TextUnit::Packet(0x64),+ ]+ ));+ }++ #[test]+ fn newline_then_cr_is_two_returns() {+ assert!(matches!(+ text_units("\n\r").as_slice(),+ [TextUnit::Return, TextUnit::Return]+ ));+ }++ #[test]+ fn empty_text_has_no_units() {+ assert!(text_units("").is_empty());+ }++ #[test]+ fn packet_events_are_unicode_then_sentinel() {+ let events = unit_events(&TextUnit::Packet(0x4E8C));+ let keys: Vec<_> = events+ .iter()+ .map(|input| unsafe { input.Anonymous.ki })+ .collect();+ assert_eq!(keys[0].wVk.0, 0);+ assert_eq!(keys[1].wVk.0, 0);+ assert_ne!(keys[0].dwFlags.0 & KEYEVENTF_UNICODE.0, 0);+ assert_ne!(keys[1].dwFlags.0 & KEYEVENTF_UNICODE.0, 0);+ assert_eq!(keys[0].dwFlags.0 & KEYEVENTF_KEYUP.0, 0);+ assert_ne!(keys[1].dwFlags.0 & KEYEVENTF_KEYUP.0, 0);+ assert_ne!(keys[3].dwFlags.0 & KEYEVENTF_KEYUP.0, 0);+ assert_eq!(keys[2].wVk.0, 0xE8);+ assert_eq!(keys[3].wVk.0, 0xE8);+ }++ #[test]+ fn return_events_are_not_unicode() {+ let events = unit_events(&TextUnit::Return);+ for input in &events[..2] {+ let flags = unsafe { input.Anonymous.ki.dwFlags };+ assert_eq!(flags.0 & KEYEVENTF_UNICODE.0, 0);+ }+ }+}diff --git a/libs/cua-driver/tests/manual-e2e-allowlist.txt b/libs/cua-driver/tests/manual-e2e-allowlist.txtindex 02a85b9d5a..6167c5b583 100644--- a/libs/cua-driver/tests/manual-e2e-allowlist.txt+++ b/libs/cua-driver/tests/manual-e2e-allowlist.txt@@ -45,3 +45,6 @@ protocol_schema_test::cursor_motion_knobs_are_applied | Ignored on macOS only, wtransport_config_persistence_test::cli_set_config_visible_across_daemon_backed_invocations | Mutates the real per-user driver config through a daemon-backed CLI; manual onlyprivate_worker_test::service_untrusted_child_probe | Subprocess probe that the routed private_worker_test parent spawns itself; never a standalone rowauthorized_live_jev_use_demo_test::authorized_live_jev_no_matching_action_control | Needs the reviewed live Jev chooser and a protected credential; Actions deliberately runs only the mock chooser++# Packaged Notepad reads VK_PACKET ahead of translation (#4830). Manual on the Windows Space image.+installed_app_notepad_windows_test::foreground_type_text_round_trips_through_notepad_save | Windows Space gate: packaged Notepad VK_PACKET read-ahead (#4830); record build, Notepad version, layout and IME