1
use super::look;
2
use crate::chart::ChartLook;
3

            
4
#[test]
5
1
fn the_look_defaults_to_the_web_text_and_no_background() {
6
1
    assert_eq!(look(0, -1).expect("default"), ChartLook::default());
7
1
}
8

            
9
#[test]
10
1
fn the_look_carries_the_text_height_and_the_rgb_background() {
11
1
    let given = look(18, 0x0000AA).expect("look");
12
1
    assert_eq!(given.text_px, 18);
13
1
    assert_eq!(given.background, Some([0, 0, 0xaa]));
14
1
    assert_eq!(look(0, 0).expect("black").background, Some([0, 0, 0]));
15
1
    assert_eq!(
16
1
        look(0, 0x00FF_FFFF).expect("white").background,
17
1
        Some([255; 3])
18
    );
19
1
}
20

            
21
#[test]
22
1
fn a_bad_text_height_or_background_is_refused() {
23
1
    assert!(look(-1, -1).is_err());
24
1
    assert!(look(5000, -1).is_err());
25
1
    assert!(look(0, -2).is_err());
26
1
    assert!(look(0, 0x0100_0000).is_err());
27
1
}