fn test_equal()

in src/components/splitting.rs [258:313]


        fn test_equal() {
            let splitter = make_splitter(SplitKind::Equal, Direction::Horizontal);
            let mut state = State::new();

            // left rows all the same length
            let mut left_msg = vec![
                vec!["test"].try_into().unwrap(),
                vec!["ok", "so"].try_into().unwrap(),
                vec!["sync"].try_into().unwrap(),
            ];
            let right_msg = vec![
                vec!["xx"].try_into().unwrap(),
                vec!["yyy"].try_into().unwrap(),
                vec!["z"].try_into().unwrap(),
            ];
            let horizontal = vec![
                vec!["test", &" ".repeat(6), "xx", &" ".repeat(8)]
                    .try_into()
                    .unwrap(),
                vec!["ok", "so", &" ".repeat(6), "yyy", &" ".repeat(7)]
                    .try_into()
                    .unwrap(),
                vec!["sync", &" ".repeat(6), "z", &" ".repeat(9)]
                    .try_into()
                    .unwrap(),
            ];

            let msg1 = Echo1(left_msg.clone());
            let msg2 = Echo2(right_msg);
            state.insert(&msg1);
            state.insert(&msg2);

            let output = splitter
                .draw(&state, Dimensions::new(20, 20), DrawMode::Normal)
                .unwrap();
            assert_eq!(output, horizontal);

            // uneven left row
            left_msg[0] = vec!["hello worl"].try_into().unwrap();
            let horizontal = vec![
                vec!["hello worl", "xx", &" ".repeat(8)].try_into().unwrap(),
                vec!["ok", "so", &" ".repeat(6), "yyy", &" ".repeat(7)]
                    .try_into()
                    .unwrap(),
                vec!["sync", &" ".repeat(6), "z", &" ".repeat(9)]
                    .try_into()
                    .unwrap(),
            ];
            let msg1 = Echo1(left_msg);
            state.insert(&msg1);

            let output = splitter
                .draw(&state, Dimensions::new(20, 20), DrawMode::Normal)
                .unwrap();
            assert_eq!(output, horizontal);
        }