tests: Make keyboard enter print order-indepentent
Browse files at this commit807681c13610911288abced946b7ed55d05b46c9Parent: 66a03cf1 changed file +5 -1
- src/tests/client.rs +5 -1
src/tests/client.rsmodified+5 -1
| @@ -118,7 +118,7 @@ pub struct Keyboard { | ||
| 118 | 118 | #[derive(Debug)] |
| 119 | 119 | pub enum KeyboardEvent { |
| 120 | 120 | Enter { |
| 121 | - keys: Vec<u8>, | |
| 121 | + keys: Vec<u32>, | |
| 122 | 122 | }, |
| 123 | 123 | Leave, |
| 124 | 124 | Key { |
| @@ -744,6 +744,10 @@ impl Dispatch<WlKeyboard, WlSeat> for State { | ||
| 744 | 744 | wl_keyboard::Event::Enter { surface, keys, .. } => { |
| 745 | 745 | keyboard.surface = Some(surface.clone()); |
| 746 | 746 | |
| 747 | + // The order is arbitrary, but we need a fixed order for our tests. | |
| 748 | + let mut keys: Vec<u32> = bytemuck::pod_collect_to_vec(&keys); | |
| 749 | + keys.sort_unstable(); | |
| 750 | + | |
| 747 | 751 | let event = KeyboardEvent::Enter { keys }; |
| 748 | 752 | let surface = state.surfaces.get_mut(&surface).unwrap(); |
| 749 | 753 | surface.keyboard_events_received.push(event); |