fn test_truncated()

in src/components/padding.rs [245:281]


    fn test_truncated() {
        let padder = Padded {
            child: Box::new(Echo::<Msg>::new(false)),
            left: 5,
            right: 3,
            top: 3,
            bottom: 3,
        };
        let mut state = State::new();
        let msg = Msg(vec![
            vec!["hello world"].try_into().unwrap(),
            vec!["ok"].try_into().unwrap(),
            Line::default(),
        ]);
        state.insert(&msg);
        let drawing = padder
            .draw(&state, Dimensions::new(10, 8), DrawMode::Normal)
            .unwrap();
        let expected = vec![
            // 5 rows of padding at the top
            vec![" ".repeat(5), " ".repeat(5)].try_into().unwrap(),
            vec![" ".repeat(5), " ".repeat(5)].try_into().unwrap(),
            vec![" ".repeat(5), " ".repeat(5)].try_into().unwrap(),
            // 2 rows of content, padded on left and right
            vec![" ".repeat(5).as_ref(), "he", &" ".repeat(3)]
                .try_into()
                .unwrap(),
            vec![" ".repeat(5).as_ref(), "ok", &" ".repeat(3)]
                .try_into()
                .unwrap(),
            vec![" ".repeat(5), " ".repeat(5)].try_into().unwrap(),
            vec![" ".repeat(5), " ".repeat(5)].try_into().unwrap(),
            vec![" ".repeat(5), " ".repeat(5)].try_into().unwrap(),
        ];

        assert_eq!(drawing, expected);
    }