2021-04-12 10:21:30 +02:00
|
|
|
use crate::clock::Clock;
|
2021-04-17 18:20:39 +02:00
|
|
|
use crate::layout::Layout;
|
2021-04-09 07:48:27 +02:00
|
|
|
use crate::Config;
|
|
|
|
|
|
|
|
fn default_config() -> Config {
|
|
|
|
Config {
|
|
|
|
plain: false,
|
|
|
|
quit: false,
|
|
|
|
command: None,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Test if layout computation works without panicking.
|
|
|
|
#[test]
|
|
|
|
fn layout_computation() {
|
|
|
|
let config = default_config();
|
2021-04-12 10:21:30 +02:00
|
|
|
let mut clock = Clock::new(&config);
|
2021-04-09 07:48:27 +02:00
|
|
|
let mut layout = Layout::new(&config);
|
|
|
|
|
2021-04-12 10:21:30 +02:00
|
|
|
// Two segment display.
|
2021-04-09 07:48:27 +02:00
|
|
|
for roster_width in &[0, 10, 20, 30, 40] {
|
|
|
|
for width in 0..256 {
|
|
|
|
for height in 0..128 {
|
2021-04-12 10:21:30 +02:00
|
|
|
layout.test_update(&clock, width, height, *roster_width);
|
2021-04-09 07:48:27 +02:00
|
|
|
}
|
2021-04-12 10:21:30 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Three segment display.
|
|
|
|
clock.elapsed = 3600;
|
|
|
|
for roster_width in &[0, 10, 20, 30, 40] {
|
|
|
|
for width in 0..256 {
|
|
|
|
for height in 0..128 {
|
|
|
|
layout.test_update(&clock, width, height, *roster_width);
|
|
|
|
}
|
|
|
|
}
|
2021-04-09 07:48:27 +02:00
|
|
|
}
|
|
|
|
}
|