forge
Explore
Log in

Don't you dare go Hollow

tests: Make keyboard enter print order-indepentent

Browse files at this commit

807681c13610911288abced946b7ed55d05b46c9Ivan MolodetskikhParent: 66a03cf
src/tests/client.rsmodified+5 -1
@@ -118,7 +118,7 @@ pub struct Keyboard {
118118 #[derive(Debug)]
119119 pub enum KeyboardEvent {
120120 Enter {
121- keys: Vec<u8>,
121+ keys: Vec<u32>,
122122 },
123123 Leave,
124124 Key {
@@ -744,6 +744,10 @@ impl Dispatch<WlKeyboard, WlSeat> for State {
744744 wl_keyboard::Event::Enter { surface, keys, .. } => {
745745 keyboard.surface = Some(surface.clone());
746746
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+
747751 let event = KeyboardEvent::Enter { keys };
748752 let surface = state.surfaces.get_mut(&surface).unwrap();
749753 surface.keyboard_events_received.push(event);