// SPDX-License-Identifier: GPL-3.0-or-later use molotov_core::input::ime::{ImeManager, Rect}; #[test] fn test_ime_preedit_composition_flow() { let mut ime = ImeManager::new(); ime.start_text_input(Rect { x: 100, y: 200, width: 20, height: 24 }); assert!(ime.is_active()); // User types in Japanese IME: preedit string "とうきょう" ime.update_preedit("とうきょう", 4); assert_eq!(ime.preedit_text(), "とうきょう"); assert_eq!(ime.cursor_pos(), 4); // User selects candidate: commit "東京" let committed = ime.commit_text("東京"); assert_eq!(committed, "東京"); assert_eq!(ime.preedit_text(), "", "Preedit must clear on commit"); ime.stop_text_input(); assert!(!ime.is_active()); }