From ec09c87c43cafbc2628da004cc3c201aea021555 Mon Sep 17 00:00:00 2001 From: FredApps <153173854+FredApps@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:26:26 +0100 Subject: [PATCH] Keep DXF regressions enabled without the DWG bridge --- crates/io/tests/dwg_active_layout.rs | 13 ++++++++++--- crates/io/tests/dwg_table_cell_height.rs | 14 +++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/crates/io/tests/dwg_active_layout.rs b/crates/io/tests/dwg_active_layout.rs index fd7d594ed..f2da61dcc 100644 --- a/crates/io/tests/dwg_active_layout.rs +++ b/crates/io/tests/dwg_active_layout.rs @@ -2,13 +2,15 @@ //! the one written as `*Paper_Space` (the DWG header's paper space block), the others //! `*Paper_SpaceN`. Saving used to make the first tab the active one again. -#![cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] - +// The DWG bridge is unavailable on wasm and FreeBSD ARM64 (#2526); DXF still works. +#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] use std::io::Cursor; use cadcraft_doc::{Common, Drawing, EntityKind, Layout, Line, Space}; use cadcraft_geom::Vec3; -use cadcraft_io::{SaveOptions, Version, read, write_with}; +#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] +use cadcraft_io::Version; +use cadcraft_io::{SaveOptions, read, write_with}; fn three_sheets() -> Drawing { let mut d = Drawing::new_metric(); @@ -21,6 +23,7 @@ fn three_sheets() -> Drawing { } /// The layout the DWG marks active: the one whose block the header names as paper space. +#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] fn dwg_active_layout(dwg: &[u8]) -> String { let doc = acadrust::DwgReader::from_stream(Cursor::new(dwg.to_vec())).read().unwrap(); let ps = doc.header.paper_space_block_handle; @@ -33,11 +36,13 @@ fn dwg_active_layout(dwg: &[u8]) -> String { .unwrap() } +#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] fn dwg(d: &Drawing) -> Vec { write_with(d, "case.dwg", &SaveOptions { version: Some(Version::R2018), binary: false }).unwrap() } #[test] +#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] fn the_active_layout_stays_active_through_dwg_saves() { let mut d = three_sheets(); d.active_layout = Some("S2".into()); @@ -70,6 +75,7 @@ fn the_active_layout_survives_dxf_too() { } #[test] +#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] fn without_an_active_layout_the_first_tab_is_active() { let mut d = three_sheets(); d.active_layout = Some("gone".into()); @@ -77,6 +83,7 @@ fn without_an_active_layout_the_first_tab_is_active() { } #[test] +#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] fn the_active_layout_name_is_matched_ignoring_case() { let mut d = three_sheets(); d.active_layout = Some("s2".into()); diff --git a/crates/io/tests/dwg_table_cell_height.rs b/crates/io/tests/dwg_table_cell_height.rs index 6e077b870..e7f7ca79a 100644 --- a/crates/io/tests/dwg_table_cell_height.rs +++ b/crates/io/tests/dwg_table_cell_height.rs @@ -1,5 +1,7 @@ //! TABLE heights inherit from the table style unless the file records a cell override. -#![cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))] +#![cfg(not(target_arch = "wasm32"))] + +// FreeBSD ARM64 has no native DWG bridge (#2526), but the DXF regression still applies. use cadcraft_doc::{Common, Drawing, EntityKind, Space, Table, TableCell, TableStyle}; @@ -42,6 +44,7 @@ fn check(d: &Drawing) { } #[test] +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn table_cell_heights_keep_inheritance_through_dwg() { let bytes = cadcraft_io::write(&drawing(), "height.dwg").unwrap(); // A style record can be present for metadata without overriding its text height. @@ -68,11 +71,13 @@ fn table_cell_heights_keep_inheritance_through_dxf() { // ---- cells with their own style record (review on #2588) ---- +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] use acadrust::entities::table::{CellContent, CellStyle, CellStylePropertyFlags}; /// Write the drawing as a DWG, edit its first cell through acadrust (`edit`), write it again as a /// DWG (or, with `as_dxf`, as a DXF by acadrust's writer) and read it with CADCraft. Returns the first cell's /// text height override. +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn first_cell_height(as_dxf: bool, edit: impl FnOnce(&mut acadrust::entities::table::TableCell)) -> Option { let bytes = cadcraft_io::write(&drawing(), "height.dwg").unwrap(); let mut doc = acadrust::DwgReader::from_stream(std::io::Cursor::new(bytes)).read().unwrap(); @@ -100,6 +105,7 @@ fn first_cell_height(as_dxf: bool, edit: impl FnOnce(&mut acadrust::entities::ta .unwrap() } +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn styled(height: f64, flags: CellStylePropertyFlags) -> CellStyle { let mut s = CellStyle::new(); s.text_height = height; @@ -108,12 +114,14 @@ fn styled(height: f64, flags: CellStylePropertyFlags) -> CellStyle { } #[test] +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn a_cell_style_with_the_text_height_flag_keeps_its_height() { let h = first_cell_height(false, |c| c.style = Some(styled(0.5, CellStylePropertyFlags::TEXT_HEIGHT))); assert_eq!(h, Some(0.5)); } #[test] +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn content_with_format_override_bit_128_keeps_its_own_height() { // acadrust writes the content's height as group 144 and the style's as 140; they differ here // so the result shows which one CADCraft honoured. @@ -131,6 +139,7 @@ fn content_with_format_override_bit_128_keeps_its_own_height() { /// Only the first content's override stands for the cell: a later content's height must not /// replace the first content's inherited one (review on #2588). #[test] +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn a_later_contents_height_does_not_replace_the_first_contents() { let h = first_cell_height(false, |c| { c.style = Some(styled(0.18, CellStylePropertyFlags::NONE)); @@ -147,6 +156,7 @@ fn a_later_contents_height_does_not_replace_the_first_contents() { /// Bit 128 with an unusable content height copies nothing, so the writer's default style height /// is still cleared (review on #2588). #[test] +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn bit_128_with_an_invalid_height_still_clears_the_default() { for bad in [0.0, -1.0, f64::NAN] { let h = first_cell_height(false, |c| { @@ -162,12 +172,14 @@ fn bit_128_with_an_invalid_height_still_clears_the_default() { } #[test] +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn a_cell_with_no_style_record_inherits_the_table_style() { assert_eq!(first_cell_height(false, |c| c.style = None), None); } /// A style record with a height and neither override is not an override, through DWG. #[test] +#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))] fn a_style_height_without_an_override_is_cleared() { assert_eq!(first_cell_height(false, |c| c.style = Some(styled(0.18, CellStylePropertyFlags::NONE))), None); }