Merge pull request #1991 from storytold/fix/plot-range-contains

unbreak the Workspace gate: the xlsx fixture Result and the docx range-contains lint
This commit is contained in:
Dylan M. Taylor
2026-11-17 03:17:42 -05:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -212,7 +212,8 @@ fn title_left(c: &Chart, cat_on: bool, val_on: bool, area_w: f32) -> f32 {
fn flat_title_lines(c: &Chart, area_w: f32) -> Option<Vec<String>> {
let left = if c.horizontal { &c.cat } else { &c.val };
let r = left.title_rot?.rem_euclid(360.0);
if !(r < 1.0 || r > 359.0) {
// Only near-zero rotations fit the horizontal strip; non-finite rotations do not.
if !r.is_finite() || (1.0..=359.0).contains(&r) {
return None;
}
let width = if area_w.is_finite() { (area_w * 0.18).max(1.0) } else { 1.0 };
+5
View File
@@ -745,6 +745,11 @@ fn value_axis_title_turns_counter_clockwise_like_word() {
assert_eq!(angle(&line_with("", &title(r#"<a:bodyPr rot="5400000" vert="horz"/>"#))), Some(90.0));
// A horizontal title (`rot="0"`) stays horizontal: the plot makes room for it (see below).
assert_eq!(angle(&line_with("", &title(r#"<a:bodyPr rot="0" vert="horz"/>"#))), Some(0.0));
// The horizontal tolerance excludes both boundary angles and keeps equivalent full turns.
for (rot, expected) in [(30000, 0.0), (-30000, 0.0), (60000, -90.0), (-60000, -90.0), (10800000, -90.0), (21600000, 0.0)] {
let body = format!(r#"<a:bodyPr rot="{rot}" vert="horz"/>"#);
assert_eq!(angle(&line_with("", &title(&body))), Some(expected), "rotation {rot}");
}
// Hostile values stay finite.
let odd = angle(&line_with("", &title(r#"<a:bodyPr rot="99999999999999999999"/>"#)));
assert!(odd.is_some_and(f32::is_finite));