From: Ben Pfaff Date: Fri, 26 Dec 2025 16:48:47 +0000 (-0800) Subject: work X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5bf4114c4fdd0fbc24b34ab2efcd947a004ecea;p=pspp work --- diff --git a/rust/pspp/src/spv/read/legacy_xml.rs b/rust/pspp/src/spv/read/legacy_xml.rs index e0ff168b15..b25e469910 100644 --- a/rust/pspp/src/spv/read/legacy_xml.rs +++ b/rust/pspp/src/spv/read/legacy_xml.rs @@ -399,10 +399,11 @@ impl Visualization { dims: &mut Vec>, ) { 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); } diff --git a/rust/pspp/src/spv/read/tests.rs b/rust/pspp/src/spv/read/tests.rs index 96508810c9..a2b4cb3f2a 100644 --- a/rust/pspp/src/spv/read/tests.rs +++ b/rust/pspp/src/spv/read/tests.rs @@ -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 index 0000000000..52e1baf5fb --- /dev/null +++ b/rust/pspp/src/spv/testdata/legacy10.expected @@ -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 index 0000000000..92d2c8157f Binary files /dev/null and b/rust/pspp/src/spv/testdata/legacy10.spv differ