Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): clear platform-linux test-target clippy lints (#6695)

injaneity823255524bfa
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/input/mod.rs b/libs/cua-driver/rust/crates/platform-linux/src/input/mod.rs
index 4befe02640..5f7b134a38 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/input/mod.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/input/mod.rs
@@ -4418,7 +4418,7 @@ mod own_dialog_tests {
use super::*;
use std::io::{BufRead, BufReader};
use std::process::{Command, Stdio};
- use x11rb::protocol::{xproto::*, Event};
+ use x11rb::protocol::Event;
use x11rb::wrapper::ConnectionExt as _;
struct Server(std::process::Child);
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/tools/launch_app.rs b/libs/cua-driver/rust/crates/platform-linux/src/tools/launch_app.rs
index d21bea9d13..174e1436ec 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/tools/launch_app.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/tools/launch_app.rs
@@ -696,7 +696,8 @@ mod launch_resolution_tests {
let none = std::collections::HashSet::new();
let is_splash = |w: &crate::x11::WindowInfo| w.xid == 10;
- assert!(settle_launch(&[splash.clone()], 377, "libreoffice", &none, is_splash).is_none());
+ let splash_only = std::slice::from_ref(&splash);
+ assert!(settle_launch(splash_only, 377, "libreoffice", &none, is_splash).is_none());
let launched =
settle_launch(&[splash, calc], 377, "libreoffice", &none, is_splash).unwrap();
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/tools/press_key.rs b/libs/cua-driver/rust/crates/platform-linux/src/tools/press_key.rs
index d439fd766f..805b6569fc 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/tools/press_key.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/tools/press_key.rs
@@ -55,55 +55,6 @@ fn press_key_chord(mods: &[String], key: &str) -> Option<Vec<String>> {
Some(chord)
}
-#[cfg(test)]
-mod press_key_tests {
- use super::is_enter_key;
- use super::press_key_chord;
-
- #[test]
- fn unmodified_press_stays_on_the_single_key_route() {
- assert_eq!(press_key_chord(&[], "return"), None);
- }
-
- #[test]
- fn enter_key_gate_accepts_the_documented_enter_spelling() {
- assert!(is_enter_key("enter"));
- assert!(is_enter_key("Enter"));
- assert!(is_enter_key("ENTER"));
- }
-
- #[test]
- fn enter_key_gate_accepts_the_documented_return_spelling() {
- // `key_name_to_keysym` resolves "return" and "enter" to the same
- // physical key (XK_Return, 0xFF0D); the pty short-circuit must not
- // drop a documented spelling on terminals (they discard synthetic
- // XSendEvent keys, so a dropped short-circuit loses the keypress).
- assert!(is_enter_key("return"));
- assert!(is_enter_key("Return"));
- assert!(is_enter_key("RETURN"));
- }
-
- #[test]
- fn enter_key_gate_rejects_non_enter_keys() {
- assert!(!is_enter_key("tab"));
- assert!(!is_enter_key("escape"));
- assert!(!is_enter_key("space"));
- assert!(!is_enter_key(""));
- }
-
- #[test]
- fn modifiers_are_promoted_to_a_chord_in_order() {
- assert_eq!(
- press_key_chord(&["ctrl".to_owned()], "s"),
- Some(vec!["ctrl".to_owned(), "s".to_owned()])
- );
- assert_eq!(
- press_key_chord(&["ctrl".to_owned(), "shift".to_owned()], "t"),
- Some(vec!["ctrl".to_owned(), "shift".to_owned(), "t".to_owned()])
- );
- }
-}
-
#[async_trait]
impl Tool for PressKeyTool {
fn def(&self) -> &ToolDef {
@@ -515,3 +466,52 @@ impl Tool for PressKeyTool {
}
}
}
+
+#[cfg(test)]
+mod press_key_tests {
+ use super::is_enter_key;
+ use super::press_key_chord;
+
+ #[test]
+ fn unmodified_press_stays_on_the_single_key_route() {
+ assert_eq!(press_key_chord(&[], "return"), None);
+ }
+
+ #[test]
+ fn enter_key_gate_accepts_the_documented_enter_spelling() {
+ assert!(is_enter_key("enter"));
+ assert!(is_enter_key("Enter"));
+ assert!(is_enter_key("ENTER"));
+ }
+
+ #[test]
+ fn enter_key_gate_accepts_the_documented_return_spelling() {
+ // `key_name_to_keysym` resolves "return" and "enter" to the same
+ // physical key (XK_Return, 0xFF0D); the pty short-circuit must not
+ // drop a documented spelling on terminals (they discard synthetic
+ // XSendEvent keys, so a dropped short-circuit loses the keypress).
+ assert!(is_enter_key("return"));
+ assert!(is_enter_key("Return"));
+ assert!(is_enter_key("RETURN"));
+ }
+
+ #[test]
+ fn enter_key_gate_rejects_non_enter_keys() {
+ assert!(!is_enter_key("tab"));
+ assert!(!is_enter_key("escape"));
+ assert!(!is_enter_key("space"));
+ assert!(!is_enter_key(""));
+ }
+
+ #[test]
+ fn modifiers_are_promoted_to_a_chord_in_order() {
+ assert_eq!(
+ press_key_chord(&["ctrl".to_owned()], "s"),
+ Some(vec!["ctrl".to_owned(), "s".to_owned()])
+ );
+ assert_eq!(
+ press_key_chord(&["ctrl".to_owned(), "shift".to_owned()], "t"),
+ Some(vec!["ctrl".to_owned(), "shift".to_owned(), "t".to_owned()])
+ );
+ }
+}
diff --git a/libs/cua-driver/rust/crates/platform-linux/src/wayland/hyprland.rs b/libs/cua-driver/rust/crates/platform-linux/src/wayland/hyprland.rs
index 036d5793cc..4fb4d2d3d3 100644
--- a/libs/cua-driver/rust/crates/platform-linux/src/wayland/hyprland.rs
+++ b/libs/cua-driver/rust/crates/platform-linux/src/wayland/hyprland.rs
@@ -1355,7 +1355,8 @@ mod tests {
}
// (output mode, scale, logical frame). 1.6666666 is the #4219 laptop.
- const SCALED_OUTPUTS: [((u32, u32), f64, (u32, u32)); 5] = [
+ type Size = (u32, u32);
+ const SCALED_OUTPUTS: [(Size, f64, Size); 5] = [
((1920, 1080), 1.0, (1920, 1080)),
((2560, 1600), 1.25, (2048, 1280)),
((2880, 1800), 1.5, (1920, 1200)),