diff --git a/.github/workflows/nix-build.yml b/.github/workflows/nix-build.yml index 36088e338f..bd4c5f2b3f 100644 --- a/.github/workflows/nix-build.yml +++ b/.github/workflows/nix-build.yml @@ -24,5 +24,4 @@ jobs: - uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/flake-checker-action@main - - name: Run `nix build` - run: nix build --max-jobs auto --build-max-jobs auto --print-build-logs + - run: nix build diff --git a/frontends/rioterm/src/context/grid.rs b/frontends/rioterm/src/context/grid.rs index 4f5ff6cabc..9a45fb344c 100644 --- a/frontends/rioterm/src/context/grid.rs +++ b/frontends/rioterm/src/context/grid.rs @@ -969,182 +969,182 @@ pub mod test { use pretty_assertions::assert_eq; use rio_window::window::WindowId; - // #[test] - // fn test_single_context_respecting_margin_and_no_quad_creation() { - // let margin = Delta { - // x: 10., - // top_y: 20., - // bottom_y: 20., - // }; - - // let context_dimension = ContextDimension::build( - // 1200.0, - // 800.0, - // SugarDimensions { - // scale: 2., - // width: 18., - // height: 9., - // }, - // 1.0, - // Delta::::default(), - // ); - - // assert_eq!(context_dimension.columns, 66); - // assert_eq!(context_dimension.lines, 88); - // let rich_text_id = 0; - // let route_id = 0; - // let context = create_mock_context( - // VoidListener {}, - // WindowId::from(0), - // route_id, - // rich_text_id, - // context_dimension, - // ); - // let context_width = context.dimension.width; - // let context_height = context.dimension.height; - // let context_margin = context.dimension.margin; - // let grid = ContextGrid::::new(context, margin, [0., 0., 0., 0.]); - // // The first context should fill completely w/h grid - // assert_eq!(grid.width, context_width); - // assert_eq!(grid.height, context_height); - - // // Context margin should empty - // assert_eq!(Delta::::default(), context_margin); - // assert_eq!(grid.margin, margin); - - // assert_eq!( - // grid.objects(), - // vec![Object::RichText(RichText { - // id: rich_text_id, - // position: [10., 20.], - // })] - // ); - // } - #[test] - fn test_split_right() { + fn test_single_context_respecting_margin_and_no_quad_creation() { let margin = Delta { - x: 0., - top_y: 0., - bottom_y: 0., + x: 10., + top_y: 20., + bottom_y: 20., }; let context_dimension = ContextDimension::build( 1200.0, 800.0, SugarDimensions { - scale: 1., - width: 14., - height: 8., + scale: 2., + width: 18., + height: 9., }, 1.0, Delta::::default(), ); - assert_eq!(context_dimension.columns, 85); - assert_eq!(context_dimension.lines, 100); - - let (first_context, first_context_id) = { - let rich_text_id = 0; - let route_id = 0; - ( - create_mock_context( - VoidListener {}, - WindowId::from(0), - route_id, - rich_text_id, - context_dimension, - ), - rich_text_id, - ) - }; - - let (second_context, second_context_id) = { - let rich_text_id = 1; - let route_id = 0; - ( - create_mock_context( - VoidListener {}, - WindowId::from(0), - route_id, - rich_text_id, - context_dimension, - ), - rich_text_id, - ) - }; - - let mut grid = - ContextGrid::::new(first_context, margin, [1., 0., 0., 0.]); + assert_eq!(context_dimension.columns, 66); + assert_eq!(context_dimension.lines, 88); + let rich_text_id = 0; + let route_id = 0; + let context = create_mock_context( + VoidListener {}, + WindowId::from(0), + route_id, + rich_text_id, + context_dimension, + ); + let context_width = context.dimension.width; + let context_height = context.dimension.height; + let context_margin = context.dimension.margin; + let grid = ContextGrid::::new(context, margin, [0., 0., 0., 0.]); + // The first context should fill completely w/h grid + assert_eq!(grid.width, context_width); + assert_eq!(grid.height, context_height); + + // Context margin should empty + assert_eq!(Delta::::default(), context_margin); + assert_eq!(grid.margin, margin); assert_eq!( grid.objects(), vec![Object::RichText(RichText { - id: first_context_id, - position: [0., 0.], + id: rich_text_id, + position: [10., 20.], })] ); - grid.split_right(second_context); + } - assert_eq!( - grid.objects(), - vec![ - Object::RichText(RichText { - id: first_context_id, - position: [0.0, 0.0], - }), - create_border([1.0, 0.0, 0.0, 0.0], [0.0, 800.0], [598., 1.0]), - create_border([1.0, 0.0, 0.0, 0.0], [598.0, 0.0], [1.0, 800.0]), - Object::RichText(RichText { - id: second_context_id, - position: [600., 0.0] - }), - create_border([1.0, 0.0, 0.0, 0.0], [600.0, 800.0], [600.0, 1.0]), - create_border([1.0, 0.0, 0.0, 0.0], [1200.0, 0.0], [1.0, 800.0]), - ] - ); + // #[test] + // fn test_split_right() { + // let margin = Delta { + // x: 0., + // top_y: 0., + // bottom_y: 0., + // }; - let (third_context, third_context_id) = { - let rich_text_id = 2; - let route_id = 0; - ( - create_mock_context( - VoidListener {}, - WindowId::from(0), - route_id, - rich_text_id, - context_dimension, - ), - rich_text_id, - ) - }; + // let context_dimension = ContextDimension::build( + // 1200.0, + // 800.0, + // SugarDimensions { + // scale: 1., + // width: 14., + // height: 8., + // }, + // 1.0, + // Delta::::default(), + // ); - grid.split_right(third_context); + // assert_eq!(context_dimension.columns, 85); + // assert_eq!(context_dimension.lines, 100); - assert_eq!( - grid.objects(), - vec![ - Object::RichText(RichText { - id: first_context_id, - position: [0.0, 0.0], - }), - create_border([1.0, 0.0, 0.0, 0.0], [0.0, 800.0], [598., 1.0]), - create_border([1.0, 0.0, 0.0, 0.0], [598.0, 0.0], [1.0, 800.0]), - Object::RichText(RichText { - id: second_context_id, - position: [600.0, 0.0] - }), - create_border([1.0, 0.0, 0.0, 0.0], [600.0, 800.0], [298.0, 1.0]), - create_border([1.0, 0.0, 0.0, 0.0], [898.0, 0.0], [1.0, 800.0]), - Object::RichText(RichText { - id: third_context_id, - position: [900.0, 0.0] - }), - create_border([1.0, 0.0, 0.0, 0.0], [900.0, 800.0], [300.0, 1.0]), - create_border([1.0, 0.0, 0.0, 0.0], [1200.0, 0.0], [1.0, 800.0]), - ] - ); - } + // let (first_context, first_context_id) = { + // let rich_text_id = 0; + // let route_id = 0; + // ( + // create_mock_context( + // VoidListener {}, + // WindowId::from(0), + // route_id, + // rich_text_id, + // context_dimension, + // ), + // rich_text_id, + // ) + // }; + + // let (second_context, second_context_id) = { + // let rich_text_id = 1; + // let route_id = 0; + // ( + // create_mock_context( + // VoidListener {}, + // WindowId::from(0), + // route_id, + // rich_text_id, + // context_dimension, + // ), + // rich_text_id, + // ) + // }; + + // let mut grid = + // ContextGrid::::new(first_context, margin, [1., 0., 0., 0.]); + + // assert_eq!( + // grid.objects(), + // vec![Object::RichText(RichText { + // id: first_context_id, + // position: [0., 0.], + // })] + // ); + // grid.split_right(second_context); + + // assert_eq!( + // grid.objects(), + // vec![ + // Object::RichText(RichText { + // id: first_context_id, + // position: [0.0, 0.0], + // }), + // create_border([1.0, 0.0, 0.0, 0.0], [0.0, 800.0], [598., 1.0]), + // create_border([1.0, 0.0, 0.0, 0.0], [598.0, 0.0], [1.0, 800.0]), + // Object::RichText(RichText { + // id: second_context_id, + // position: [600., 0.0] + // }), + // create_border([1.0, 0.0, 0.0, 0.0], [600.0, 800.0], [600.0, 1.0]), + // create_border([1.0, 0.0, 0.0, 0.0], [1200.0, 0.0], [1.0, 800.0]), + // ] + // ); + + // let (third_context, third_context_id) = { + // let rich_text_id = 2; + // let route_id = 0; + // ( + // create_mock_context( + // VoidListener {}, + // WindowId::from(0), + // route_id, + // rich_text_id, + // context_dimension, + // ), + // rich_text_id, + // ) + // }; + + // grid.split_right(third_context); + + // assert_eq!( + // grid.objects(), + // vec![ + // Object::RichText(RichText { + // id: first_context_id, + // position: [0.0, 0.0], + // }), + // create_border([1.0, 0.0, 0.0, 0.0], [0.0, 800.0], [598., 1.0]), + // create_border([1.0, 0.0, 0.0, 0.0], [598.0, 0.0], [1.0, 800.0]), + // Object::RichText(RichText { + // id: second_context_id, + // position: [600.0, 0.0] + // }), + // create_border([1.0, 0.0, 0.0, 0.0], [600.0, 800.0], [298.0, 1.0]), + // create_border([1.0, 0.0, 0.0, 0.0], [898.0, 0.0], [1.0, 800.0]), + // Object::RichText(RichText { + // id: third_context_id, + // position: [900.0, 0.0] + // }), + // create_border([1.0, 0.0, 0.0, 0.0], [900.0, 800.0], [300.0, 1.0]), + // create_border([1.0, 0.0, 0.0, 0.0], [1200.0, 0.0], [1.0, 800.0]), + // ] + // ); + // } // #[test] // fn test_split_right_with_margin() {