From: Ben Pfaff Date: Thu, 10 Apr 2025 16:28:29 +0000 (-0700) Subject: corner labels really work X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33048a6a981f47ef6893cbcb80acc18861ca4555;p=pspp corner labels really work --- diff --git a/rust/pspp/src/output/pivot/output.rs b/rust/pspp/src/output/pivot/output.rs index 297bf1a077..ce2d32c372 100644 --- a/rust/pspp/src/output/pivot/output.rs +++ b/rust/pspp/src/output/pivot/output.rs @@ -198,7 +198,8 @@ impl PivotTable { // Insert corner text, but only if there's a stub and only if row labels // are not in the corner. - if (self.corner_text.is_some() || self.look.row_label_position == LabelPosition::Corner) + if self.corner_text.is_some() + && self.look.row_label_position == LabelPosition::Nested && stub.x() > 0 && stub.y() > 0 { @@ -496,8 +497,6 @@ impl<'a> Heading<'a> { } if dimension_label_position == LabelPosition::Corner { - dbg!(v_ofs..v_ofs + 1, 0..h_ofs); - dbg!(&self.dimension.root); table.put( Rect2::new(v_ofs..v_ofs + 1, 0..h_ofs), CellInner { @@ -506,7 +505,6 @@ impl<'a> Heading<'a> { value: self.dimension.root.name.clone(), }, ); - dbg!(&table); } } } diff --git a/rust/pspp/src/output/pivot/test.rs b/rust/pspp/src/output/pivot/test.rs index 0225f484dc..1e61180102 100644 --- a/rust/pspp/src/output/pivot/test.rs +++ b/rust/pspp/src/output/pivot/test.rs @@ -49,7 +49,19 @@ Columns #[test] fn d1_r() { - print!("{}", d1("Rows", Axis3::Y)); + assert_eq!( + d1("Rows", Axis3::Y).to_string(), + "\ +Rows +╭──┬─╮ +│a │ │ +├──┼─┤ +│a1│0│ +│a2│1│ +│a3│2│ +╰──┴─╯ +" + ); } fn test_look() -> Arc {