()
| 2783 | |
| 2784 | #[test] |
| 2785 | fn test_arrow_key_navigation() { |
| 2786 | let mut ply = Ply::<()>::new_headless(Dimensions::new(800.0, 600.0)); |
| 2787 | use engine::ArrowDirection; |
| 2788 | |
| 2789 | let id_a = Id::from("a").id; |
| 2790 | let id_b = Id::from("b").id; |
| 2791 | |
| 2792 | // Frame 1: create two elements with arrow overrides |
| 2793 | { |
| 2794 | let mut ui = ply.begin(); |
| 2795 | ui.element() |
| 2796 | .id("a") |
| 2797 | .width(fixed!(100.0)) |
| 2798 | .height(fixed!(50.0)) |
| 2799 | .accessibility(|a| a.button("A").focus_right("b")) |
| 2800 | .empty(); |
| 2801 | ui.element() |
| 2802 | .id("b") |
| 2803 | .width(fixed!(100.0)) |
| 2804 | .height(fixed!(50.0)) |
| 2805 | .accessibility(|a| a.button("B").focus_left("a")) |
| 2806 | .empty(); |
| 2807 | ui.eval(); |
| 2808 | } |
| 2809 | |
| 2810 | // Focus A first |
| 2811 | ply.context.set_focus(id_a); |
| 2812 | assert_eq!(ply.context.focused_element_id, id_a); |
| 2813 | |
| 2814 | // Arrow right → B |
| 2815 | ply.context.arrow_focus(ArrowDirection::Right); |
| 2816 | assert_eq!(ply.context.focused_element_id, id_b); |
| 2817 | |
| 2818 | // Arrow left → A |
| 2819 | ply.context.arrow_focus(ArrowDirection::Left); |
| 2820 | assert_eq!(ply.context.focused_element_id, id_a); |
| 2821 | |
| 2822 | // Arrow up → no override, stays on A |
| 2823 | ply.context.arrow_focus(ArrowDirection::Up); |
| 2824 | assert_eq!(ply.context.focused_element_id, id_a); |
| 2825 | } |
| 2826 | |
| 2827 | #[test] |
| 2828 | fn test_focused_query() { |
nothing calls this directly
no test coverage detected