tests: Move complete_animations() to Fixture
Browse files at this commit618c83c59f8f335f3f6dc9d2c68f730985fe106aParent: 318f6ca2 changed files +8 -7
- src/tests/animations.rs +1 -7
- src/tests/fixture.rs +7 -0
src/tests/animations.rsmodified+1 -7
| @@ -44,12 +44,6 @@ fn create_window(f: &mut Fixture, id: ClientId, w: u16, h: u16) -> WlSurface { | ||
| 44 | 44 | surface |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | -fn complete_animations(niri: &mut Niri) { | |
| 48 | - niri.clock.set_complete_instantly(true); | |
| 49 | - niri.advance_animations(); | |
| 50 | - niri.clock.set_complete_instantly(false); | |
| 51 | -} | |
| 52 | - | |
| 53 | 47 | fn set_time(niri: &mut Niri, time: Duration) { |
| 54 | 48 | // This is a bit involved because we're dealing with an AdjustableClock that maintains its own |
| 55 | 49 | // internal current_time. |
| @@ -118,7 +112,7 @@ fn set_up_two_in_column() -> (Fixture, ClientId, WlSurface, WlSurface) { | ||
| 118 | 112 | f.double_roundtrip(id); |
| 119 | 113 | |
| 120 | 114 | set_time(f.niri(), Duration::ZERO); |
| 121 | - complete_animations(f.niri()); | |
| 115 | + f.niri_complete_animations(); | |
| 122 | 116 | |
| 123 | 117 | (f, id, surface1, surface2) |
| 124 | 118 | } |
src/tests/fixture.rsmodified+7 -0
| @@ -82,6 +82,13 @@ impl Fixture { | ||
| 82 | 82 | niri.layout.focus_output(output); |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | + pub fn niri_complete_animations(&mut self) { | |
| 86 | + let niri = self.niri(); | |
| 87 | + niri.clock.set_complete_instantly(true); | |
| 88 | + niri.advance_animations(); | |
| 89 | + niri.clock.set_complete_instantly(false); | |
| 90 | + } | |
| 91 | + | |
| 85 | 92 | pub fn add_output(&mut self, n: u8, size: (u16, u16)) { |
| 86 | 93 | let state = self.niri_state(); |
| 87 | 94 | let niri = &mut state.niri; |