()
| 3303 | |
| 3304 | #[test] |
| 3305 | fn test_ensure_cursor_visible() { |
| 3306 | let mut state = TextEditState::default(); |
| 3307 | state.scroll_offset = 0.0; |
| 3308 | |
| 3309 | // Cursor at x=150, visible_width=100 → should scroll right |
| 3310 | state.ensure_cursor_visible(150.0, 100.0); |
| 3311 | assert_eq!(state.scroll_offset, 50.0); |
| 3312 | |
| 3313 | // Cursor at x=30, scroll_offset=50 → 30-50 = -20 < 0 → scroll left |
| 3314 | state.ensure_cursor_visible(30.0, 100.0); |
| 3315 | assert_eq!(state.scroll_offset, 30.0); |
| 3316 | } |
| 3317 | |
| 3318 | #[test] |
| 3319 | fn test_backspace_word() { |
nothing calls this directly
no test coverage detected