From: Ben Pfaff Date: Wed, 24 Dec 2025 22:26:32 +0000 (-0800) Subject: work X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b816f1966f53e824de1d16905fca0cc282041824;p=pspp work --- diff --git a/rust/pspp/src/output/pivot.rs b/rust/pspp/src/output/pivot.rs index 679ae347e1..9b099e71d3 100644 --- a/rust/pspp/src/output/pivot.rs +++ b/rust/pspp/src/output/pivot.rs @@ -626,8 +626,14 @@ impl Dimension { /// Returns this dimension with [Dimension::hide_all_labels] set to true. pub fn with_all_labels_hidden(self) -> Self { + self.with_hide_all_labels(true) + } + + /// Returns this dimension with [Dimension::hide_all_labels] set to + /// `hide_all_labels`. + pub fn with_hide_all_labels(self, hide_all_labels: bool) -> Self { Self { - hide_all_labels: true, + hide_all_labels, ..self } } diff --git a/rust/pspp/src/spv/read/legacy_xml.rs b/rust/pspp/src/spv/read/legacy_xml.rs index 5b4a5473f7..428da5aebf 100644 --- a/rust/pspp/src/spv/read/legacy_xml.rs +++ b/rust/pspp/src/spv/read/legacy_xml.rs @@ -433,6 +433,15 @@ impl Visualization { } } + let hide_all_labels = if let Some(axis) = axes.get(&base_level) + && let Some(style) = axis.major_ticks.style.get(styles) + && style.visible == Some(false) + { + true + } else { + false + }; + let variables = variables .into_iter() .map(|(series, _level)| *series) @@ -522,7 +531,8 @@ impl Visualization { ) .with_multiple(cats.into_iter().map(|cb| cb.category)) .with_show_label(show_label), - ); + ) + .with_hide_all_labels(hide_all_labels); for variable in &variables { variable.dimension_index.set(Some(dims.len())); diff --git a/rust/pspp/src/spv/read/tests.rs b/rust/pspp/src/spv/read/tests.rs index bf12298010..cf51c110d1 100644 --- a/rust/pspp/src/spv/read/tests.rs +++ b/rust/pspp/src/spv/read/tests.rs @@ -49,6 +49,12 @@ fn legacy7() { test_raw_spvfile("legacy7"); } +/// Checks for `Dimension::hide_all_labels`. +#[test] +fn legacy8() { + test_raw_spvfile("legacy8"); +} + fn test_raw_spvfile(name: &str) { let input_filename = Path::new("src/spv/testdata") .join(name) diff --git a/rust/pspp/src/spv/testdata/legacy8.expected b/rust/pspp/src/spv/testdata/legacy8.expected new file mode 100644 index 0000000000..af8a9f6219 --- /dev/null +++ b/rust/pspp/src/spv/testdata/legacy8.expected @@ -0,0 +1,4 @@ + Warnings +╭──────────────────────────────────────────────╮ +│The Independent Samples table is not produced.│ +╰──────────────────────────────────────────────╯ diff --git a/rust/pspp/src/spv/testdata/legacy8.spv b/rust/pspp/src/spv/testdata/legacy8.spv new file mode 100644 index 0000000000..f8daabf41b Binary files /dev/null and b/rust/pspp/src/spv/testdata/legacy8.spv differ