tests/floating: Extract set_up_with_config()
Browse files at this commit5ad3d661f0fd25c924d8a5efc7294f560bc42617Parent: 87dc96f1 changed file +6 -17
- src/tests/floating.rs +6 -17
src/tests/floating.rsmodified+6 -17
| @@ -9,7 +9,11 @@ use super::*; | |||
| 9 | 9 | ||
| 10 | // Sets up a fixture with two outputs and 100×100 window. | 10 | // Sets up a fixture with two outputs and 100×100 window. |
| 11 | fn set_up() -> (Fixture, ClientId, WlSurface) { | 11 | fn set_up() -> (Fixture, ClientId, WlSurface) { |
| 12 | - let mut f = Fixture::new(); | 12 | + set_up_with_config(Config::default()) |
| 13 | +} | ||
| 14 | + | ||
| 15 | +fn set_up_with_config(config: Config) -> (Fixture, ClientId, WlSurface) { | ||
| 16 | + let mut f = Fixture::with_config(config); | ||
| 13 | f.add_output(1, (1920, 1080)); | 17 | f.add_output(1, (1920, 1080)); |
| 14 | f.add_output(2, (1280, 720)); | 18 | f.add_output(2, (1280, 720)); |
| 15 | 19 | ||
| @@ -796,22 +800,7 @@ window-rule { | |||
| 796 | } | 800 | } |
| 797 | "##; | 801 | "##; |
| 798 | let config = Config::parse_mem(config).unwrap(); | 802 | let config = Config::parse_mem(config).unwrap(); |
| 799 | - let mut f = Fixture::with_config(config); | 803 | + let (mut f, id, surface) = set_up_with_config(config); |
| 800 | - f.add_output(1, (1920, 1080)); | ||
| 801 | - f.add_output(2, (1280, 720)); | ||
| 802 | - | ||
| 803 | - let id = f.add_client(); | ||
| 804 | - let window = f.client(id).create_window(); | ||
| 805 | - let surface = window.surface.clone(); | ||
| 806 | - window.commit(); | ||
| 807 | - f.roundtrip(id); | ||
| 808 | - | ||
| 809 | - // Open with smaller width than min. | ||
| 810 | - let window = f.client(id).window(&surface); | ||
| 811 | - window.attach_new_buffer(); | ||
| 812 | - window.set_size(100, 100); | ||
| 813 | - window.ack_last_and_commit(); | ||
| 814 | - f.double_roundtrip(id); | ||
| 815 | 804 | ||
| 816 | // Commit to the Activated state configure. | 805 | // Commit to the Activated state configure. |
| 817 | f.client(id).window(&surface).ack_last_and_commit(); | 806 | f.client(id).window(&surface).ack_last_and_commit(); |