corner labels really work
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 10 Apr 2025 16:28:29 +0000 (09:28 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 10 Apr 2025 16:28:29 +0000 (09:28 -0700)
rust/pspp/src/output/pivot/output.rs
rust/pspp/src/output/pivot/test.rs

index 297bf1a0776ba812c73f81246007bd297f33f602..ce2d32c37274d4a93f07fa51cac18dcbb550586f 100644 (file)
@@ -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);
         }
     }
 }
index 0225f484dc597ccecd9cdcf80f034b846d697665..1e61180102341a74931b6c52e2dd4df029618394 100644 (file)
@@ -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<Look> {