work
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Dec 2025 16:48:47 +0000 (08:48 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 26 Dec 2025 16:48:47 +0000 (08:48 -0800)
rust/pspp/src/spv/read/legacy_xml.rs
rust/pspp/src/spv/read/tests.rs
rust/pspp/src/spv/testdata/legacy10.expected [new file with mode: 0644]
rust/pspp/src/spv/testdata/legacy10.spv [new file with mode: 0644]

index e0ff168b15d28e4ec02aabc4b43938d69476621b..b25e4699102abe9e2547d5bb1acd19ec73b4030e 100644 (file)
@@ -399,10 +399,11 @@ impl Visualization {
             dims: &mut Vec<Dim<'a>>,
         ) {
             let base_level = variables[0].1;
-            let (show_label, dim_cell, dim_font) = if let Ok(a) = Axis2::try_from(a)
+            let (show_label, dim_cell, dim_font, dim_label) = if let Ok(a) = Axis2::try_from(a)
                 && let Some(axis) = axes.get(&(base_level + variables.len()))
                 && let Some(label) = &axis.label
             {
+                dbg!(label);
                 let mut dimension_style = AreaStyle::default_for_area(Area::Labels(a));
                 let style = label.style.get(&styles);
                 let fg = style;
@@ -413,9 +414,10 @@ impl Visualization {
                         .then_some(dimension_style.cell_style),
                     Style::decode_font_style(fg, bg, &mut dimension_style.font_style)
                         .then_some(dimension_style.font_style),
+                    LabelFrame::decode_label(&[label], footnotes),
                 )
             } else {
-                (false, None, None)
+                (false, None, None, None)
             };
             if let Ok(a) = Axis2::try_from(a)
                 && let Some(axis) = axes.get(&(base_level + variables.len() - 1))
@@ -537,10 +539,13 @@ impl Visualization {
                 cats = next_cats;
             }
 
-            let mut dimension_label = variables[0]
-                .label
-                .as_ref()
-                .map_or_else(|| Value::new_empty(), |label| Value::new_user_text(label));
+            let mut dimension_label = if let Some(dim_label) = dim_label {
+                dim_label
+            } else if let Some(label) = &variables[0].label {
+                Value::new_user_text(label)
+            } else {
+                Value::new_empty()
+            };
             if let Some(dim_cell) = dim_cell {
                 dimension_label.set_cell_style(dim_cell);
             }
index 96508810c92f0af0fa3941894af075499da74c55..a2b4cb3f2a64d3d8047c26425636057b985753b6 100644 (file)
@@ -62,6 +62,12 @@ fn legacy9() {
     test_raw_spvfile("legacy9");
 }
 
+/// Checks for footnotes in dimension labels.
+#[test]
+fn legacy10() {
+    test_raw_spvfile("legacy10");
+}
+
 fn test_raw_spvfile(name: &str) {
     let input_filename = Path::new("src/spv/testdata")
         .join(name)
diff --git a/rust/pspp/src/spv/testdata/legacy10.expected b/rust/pspp/src/spv/testdata/legacy10.expected
new file mode 100644 (file)
index 0000000..52e1baf
--- /dev/null
@@ -0,0 +1,33 @@
+                          Contrast Results (K Matrix)
+                                                             Dependent Variable
+Variable Polynomial Contrast[a]                                     xxxxx
+───────────────────────────────────────────────────────────────────────────────
+Linear    Contrast Estimate                                                .147
+         ╶─────────────────────────────────────────────────────────────────────
+          Hypothesized Value                                                  0
+         ╶─────────────────────────────────────────────────────────────────────
+          Difference (Estimate - Hypothesized)                             .147
+         ╶─────────────────────────────────────────────────────────────────────
+          Std. Error                                                       .076
+         ╶─────────────────────────────────────────────────────────────────────
+          Sig.                                                             .062
+         ╶─────────────────────────────────────────────────────────────────────
+          95% Confidence Interval for Difference Lower Bound              -.008
+                                                ╶──────────────────────────────
+                                                 Upper Bound               .302
+───────────────────────────────────────────────────────────────────────────────
+Quadratic Contrast Estimate                                               -.033
+         ╶─────────────────────────────────────────────────────────────────────
+          Hypothesized Value                                                  0
+         ╶─────────────────────────────────────────────────────────────────────
+          Difference (Estimate - Hypothesized)                            -.033
+         ╶─────────────────────────────────────────────────────────────────────
+          Std. Error                                                       .076
+         ╶─────────────────────────────────────────────────────────────────────
+          Sig.                                                             .666
+         ╶─────────────────────────────────────────────────────────────────────
+          95% Confidence Interval for Difference Lower Bound              -.188
+                                                ╶──────────────────────────────
+                                                 Upper Bound               .122
+───────────────────────────────────────────────────────────────────────────────
+a. Metric = 1,000, 2,000, 3,000
diff --git a/rust/pspp/src/spv/testdata/legacy10.spv b/rust/pspp/src/spv/testdata/legacy10.spv
new file mode 100644 (file)
index 0000000..92d2c81
Binary files /dev/null and b/rust/pspp/src/spv/testdata/legacy10.spv differ