Merge #3228 into land/3228

This commit is contained in:
Tanish Manku
2026-11-20 05:02:49 -07:00
59 changed files with 191 additions and 109 deletions
Generated
+71 -88
View File
@@ -780,7 +780,7 @@ dependencies = [
"cadcraft-render",
"craft-dwg",
"craft-dxf",
"craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12)",
"craft-image-codecs",
"craft-pdf",
"craft-svg",
"image",
@@ -817,7 +817,7 @@ dependencies = [
"cadcraft-doc",
"cadcraft-fonts",
"cadcraft-geom",
"craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12)",
"craft-image-codecs",
"lyon_tessellation",
"rayon",
"serde_json",
@@ -836,7 +836,7 @@ dependencies = [
"cadcraft-io",
"cadcraft-render",
"chrono",
"craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12)",
"craft-image-codecs",
"craft-ui",
"craft-update",
"craft-window",
@@ -1180,22 +1180,30 @@ dependencies = [
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=0325b2d73676d736e94097dbcef01219cf25c7db#0325b2d73676d736e94097dbcef01219cf25c7db"
source = "git+https://github.com/storytold/craft-libs?rev=219c1d0b14177af6f291395d6587f61a5e09043a#219c1d0b14177af6f291395d6587f61a5e09043a"
[[package]]
name = "craft-codepage"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=219c1d0b14177af6f291395d6587f61a5e09043a#219c1d0b14177af6f291395d6587f61a5e09043a"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
[[package]]
name = "craft-dds"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"rayon",
]
[[package]]
name = "craft-docpath"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
[[package]]
name = "craft-dwg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=7bb6c90076a0177d01cc4c482e7fd8dc9f31a8bf#7bb6c90076a0177d01cc4c482e7fd8dc9f31a8bf"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"acadrust",
"log",
@@ -1216,22 +1224,26 @@ dependencies = [
[[package]]
name = "craft-font-catalog"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c07e38090879ffa994f893df9956c6d5b96c049c#c07e38090879ffa994f893df9956c6d5b96c049c"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"harfrust 0.13.3",
"kurbo",
"skrifa 0.47.0",
"thiserror 2.0.21",
"unicode-bidi",
"unicode-segmentation",
"windows-registry",
]
[[package]]
name = "craft-fonts-build"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
[[package]]
name = "craft-i18n"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"fixed_decimal",
"icu_decimal",
@@ -1254,35 +1266,12 @@ dependencies = [
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12#ae5020c1ed922cf7976a3a5545f05b07f466be12"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12)",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12)",
"crc32fast",
"exr",
"flate2",
"half",
"hayro-jpeg2000",
"image",
"image-webp",
"jpeg-encoder",
"png",
"rayon",
"serde_json",
"thiserror 2.0.21",
"tiff",
"zune-core",
"zune-jpeg",
"zune-jpegxl",
]
[[package]]
name = "craft-image-codecs"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52#c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52"
dependencies = [
"craft-jpeg 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52)",
"craft-metadata 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52)",
"craft-dds",
"craft-jpeg",
"craft-metadata",
"craft-tiff",
"crc32fast",
"exr",
"flate2",
@@ -1304,15 +1293,7 @@ dependencies = [
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12#ae5020c1ed922cf7976a3a5545f05b07f466be12"
dependencies = [
"thiserror 2.0.21",
]
[[package]]
name = "craft-jpeg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52#c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"thiserror 2.0.21",
]
@@ -1320,7 +1301,7 @@ dependencies = [
[[package]]
name = "craft-jsonrpc"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b6222158fbc2a628f27d2c1fff9f648cd194404c#b6222158fbc2a628f27d2c1fff9f648cd194404c"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"serde_json",
]
@@ -1328,7 +1309,7 @@ dependencies = [
[[package]]
name = "craft-mcp"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=b6222158fbc2a628f27d2c1fff9f648cd194404c#b6222158fbc2a628f27d2c1fff9f648cd194404c"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"craft-jsonrpc",
"serde_json",
@@ -1337,23 +1318,11 @@ dependencies = [
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12#ae5020c1ed922cf7976a3a5545f05b07f466be12"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"brotli-decompressor",
"chrono",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12)",
"quick-xml 0.41.0",
"serde",
]
[[package]]
name = "craft-metadata"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52#c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52"
dependencies = [
"brotli-decompressor",
"chrono",
"craft-tiff 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52)",
"craft-tiff",
"quick-xml 0.41.0",
"serde",
]
@@ -1361,17 +1330,17 @@ dependencies = [
[[package]]
name = "craft-mime"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=0325b2d73676d736e94097dbcef01219cf25c7db#0325b2d73676d736e94097dbcef01219cf25c7db"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"chrono",
"craft-codepage 0.1.0 (git+https://github.com/storytold/craft-libs?rev=0325b2d73676d736e94097dbcef01219cf25c7db)",
"craft-codepage 0.1.0 (git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc)",
"encoding_rs",
]
[[package]]
name = "craft-pdf"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"hayro-syntax",
"krilla",
@@ -1381,14 +1350,13 @@ dependencies = [
[[package]]
name = "craft-shx"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=2f2d1d84e3a36b3f93e81507aeff3f0da97a7162#2f2d1d84e3a36b3f93e81507aeff3f0da97a7162"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
[[package]]
name = "craft-svg"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52#c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"craft-image-codecs 0.1.0 (git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52)",
"craft-xml",
"flate2",
"kurbo",
@@ -1402,16 +1370,7 @@ dependencies = [
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=ae5020c1ed922cf7976a3a5545f05b07f466be12#ae5020c1ed922cf7976a3a5545f05b07f466be12"
dependencies = [
"serde",
"thiserror 2.0.21",
]
[[package]]
name = "craft-tiff"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52#c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"serde",
"thiserror 2.0.21",
@@ -1420,7 +1379,7 @@ dependencies = [
[[package]]
name = "craft-ui"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"craft-fonts-build",
"craft-i18n",
@@ -1441,7 +1400,7 @@ dependencies = [
[[package]]
name = "craft-update"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=e98299546f5c5c3c22388d16507f8b5e61a5f280#e98299546f5c5c3c22388d16507f8b5e61a5f280"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"chrono",
"dunce",
@@ -1468,7 +1427,7 @@ dependencies = [
[[package]]
name = "craft-web-api"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=fd5e2feff6ea25bed371a99cc732b3968d621505#fd5e2feff6ea25bed371a99cc732b3968d621505"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"js-sys",
"serde_json",
@@ -1479,7 +1438,7 @@ dependencies = [
[[package]]
name = "craft-web-host"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=fd5e2feff6ea25bed371a99cc732b3968d621505#fd5e2feff6ea25bed371a99cc732b3968d621505"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"wasm-bindgen",
"web-sys",
@@ -1488,7 +1447,7 @@ dependencies = [
[[package]]
name = "craft-window"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"egui",
"objc2 0.6.5",
@@ -1499,7 +1458,7 @@ dependencies = [
[[package]]
name = "craft-xml"
version = "0.1.0"
source = "git+https://github.com/storytold/craft-libs?rev=c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52#c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"quick-xml 0.41.0",
"serde",
@@ -2446,6 +2405,19 @@ dependencies = [
"smallvec",
]
[[package]]
name = "harfrust"
version = "0.13.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "948d0741125ba89cd3e1c23e5642415b6ade7e1d29d67ba25fb925b533e989d6"
dependencies = [
"bitflags 2.13.2",
"bytemuck",
"once_cell",
"read-fonts 0.43.3",
"smallvec",
]
[[package]]
name = "harfrust"
version = "0.14.0"
@@ -2505,7 +2477,7 @@ checksum = "9f4d0e94ddd48749f06bbe4e5389fb9799a0c45bcaf00495042076ef05e3241a"
[[package]]
name = "hayro-jbig2"
version = "0.3.0"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"hayro-ccitt",
]
@@ -2522,7 +2494,7 @@ dependencies = [
[[package]]
name = "hayro-syntax"
version = "0.7.2"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"hayro-jbig2",
"hayro-jpeg2000",
@@ -3022,7 +2994,7 @@ dependencies = [
[[package]]
name = "krilla"
version = "0.8.2"
source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0"
source = "git+https://github.com/storytold/craft-libs?rev=453b0da782ccef39be9a6dac8d27c80b553ef1cc#453b0da782ccef39be9a6dac8d27c80b553ef1cc"
dependencies = [
"base64 0.22.1",
"bumpalo",
@@ -4284,6 +4256,17 @@ dependencies = [
"once_cell",
]
[[package]]
name = "read-fonts"
version = "0.43.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "005c8acf251756c478b0bf402885bfd88a1476020c4c7e6060edc1aa68da38ea"
dependencies = [
"bytemuck",
"font-types 0.12.7",
"once_cell",
]
[[package]]
name = "read-fonts"
version = "0.44.0"
+16 -16
View File
@@ -15,10 +15,10 @@ repository = "https://github.com/storytold/cadcraft"
cadcraft-geom = { path = "crates/geom" }
# DXF tags: the shared reader and writer (moved from crates/dxf; craft-libs#791).
craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "219c1d0b14177af6f291395d6587f61a5e09043a" }
craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "7bb6c90076a0177d01cc4c482e7fd8dc9f31a8bf" }
craft-shx = { git = "https://github.com/storytold/craft-libs", rev = "2f2d1d84e3a36b3f93e81507aeff3f0da97a7162" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "ae5020c1ed922cf7976a3a5545f05b07f466be12" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "0325b2d73676d736e94097dbcef01219cf25c7db" }
craft-dwg = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
craft-shx = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
cadcraft-color = { path = "crates/color" }
cadcraft-doc = { path = "crates/doc" }
cadcraft-constraints = { path = "crates/constraints" }
@@ -28,17 +28,17 @@ cadcraft-io = { path = "crates/io" }
cadcraft-engine = { path = "crates/engine" }
cadcraft-ui-egui = { path = "crates/ui-egui" }
cadcraft-mcp = { path = "crates/mcp" }
craft-mcp = { git = "https://github.com/storytold/craft-libs", rev = "b6222158fbc2a628f27d2c1fff9f648cd194404c" }
craft-jsonrpc = { git = "https://github.com/storytold/craft-libs", rev = "b6222158fbc2a628f27d2c1fff9f648cd194404c" }
craft-mcp = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
craft-jsonrpc = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
# SVG/SVGZ import and export geometry (craft-libs#778).
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "c4c4547b7b0151e7c79ab50fa97cb64fbdff4e52" }
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
# Which paths stored in a drawing (xrefs, data links) may be opened.
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" }
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
# PDF writing (krilla) for plots, and reading them back in tests. The root patches below pin
# craft-pdf's patched backends to the same revision (Cargo ignores dependency-local patches).
craft-pdf = { version = "=0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", default-features = false }
craft-pdf = { version = "=0.1.0", git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", default-features = false }
# TrueType embedding-permission classification for plotted fonts (craft-libs#778).
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "c07e38090879ffa994f893df9956c6d5b96c049c", default-features = false }
craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", default-features = false }
clap = { version = "4", features = ["derive", "env"] }
clap_complete = "4.6.11"
clap_mangen = { version = "0.3.3", features = ["env"] }
@@ -70,8 +70,8 @@ encoding_rs = "0.8.35"
quick-xml = "0.42"
# ui
craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["serde"] }
craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] }
craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", features = ["serde"] }
craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", features = ["egui"] }
egui = { version = "0.37", default-features = false, features = ["default_fonts", "monochrome_emoji_fonts"] }
# Resizable table columns (About ▸ Contributors / Models); no image loaders.
egui_extras = { version = "0.37", default-features = false }
@@ -81,7 +81,7 @@ egui-wgpu = "0.37"
# Monotonic time on native and web (performance.now on wasm).
web-time = "1.1"
# craft-update: app-specific pretend versions apply to startup and manual checks.
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "e98299546f5c5c3c22388d16507f8b5e61a5f280", features = ["egui"] }
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", features = ["egui"] }
rfd = "0.17"
arboard = { version = "3.6", default-features = false }
@@ -113,9 +113,9 @@ debug = 0
# PDF backends for craft-pdf: pinned to the same reviewed craft-libs revision as craft-pdf itself
# (Cargo ignores dependency-local patches).
[patch.crates-io]
krilla = { version = "=0.8.2", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" }
krilla = { version = "=0.8.2", git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc" }
# Keep the complete egui family and native event bridge on reviewed fork commits.
ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }
+4 -2
View File
@@ -8,6 +8,7 @@ use cadcraft_io::dwg_worker;
#[test]
fn a_real_worker_reads_and_writes_and_its_death_is_an_error_here() {
let drawing = cadcraft_engine::sample::bracket();
dwg_worker::allow_in_process();
let in_process = cadcraft_io::write(&drawing, "a.dwg").unwrap();
dwg_worker::use_worker(env!("CARGO_BIN_EXE_cadcraft-cli").into(), vec![dwg_worker::WORKER_ARG.into()]);
@@ -34,7 +35,8 @@ fn a_real_worker_reads_and_writes_and_its_death_is_an_error_here() {
assert!(e.contains("worker stopped"), "{e}");
assert!(cadcraft_io::read(&written, "a.dwg").is_ok(), "the next file gets a new worker");
// No worker to start: the work happens here, as without one.
// A worker that cannot start is an error, even where in-process conversion is allowed.
dwg_worker::use_worker("no-such-program-here".into(), Vec::new());
assert!(cadcraft_io::read(&written, "a.dwg").is_ok());
let e = cadcraft_io::read(&written, "a.dwg").unwrap_err().to_string();
assert!(e.contains("could not start"), "{e}");
}
+1
View File
@@ -824,6 +824,7 @@ fn non_unicode_arguments() {
fn non_unicode_output_names() {
use std::ffi::OsString;
use std::os::unix::ffi::OsStringExt;
cadcraft_io::dwg_worker::allow_in_process();
let s = Scratch::new("nonunicode-out");
let latin1 = |ext: &str| {
let mut n = b"caf\xe9.".to_vec();
+1
View File
@@ -11,6 +11,7 @@ fn cli(args: &[&str]) -> Output {
/// A DWG of 200 lines, and a copy damaged so that the reader skips some of its records (found the
/// way the reader's own test finds one: flipping a few bytes at a time across the objects area).
fn dwg_and_damaged_copy() -> (Vec<u8>, Vec<u8>) {
cadcraft_io::dwg_worker::allow_in_process();
let mut dxf = String::from("0\nSECTION\n2\nENTITIES\n");
for i in 0..200 {
dxf += &format!("0\nLINE\n8\n0\n10\n{i}\n20\n0\n11\n{i}\n21\n10\n");
+2 -2
View File
@@ -21,8 +21,8 @@ cadcraft-io = { workspace = true }
cadcraft-fonts = { workspace = true }
# The host messages (storytold/craft-libs): one contract and one bridge for the web builds.
# The page command API (storytold/craft-libs#413): window.cadcraft over the control channel.
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "fd5e2feff6ea25bed371a99cc732b3968d621505", version = "0.1.0" }
craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "fd5e2feff6ea25bed371a99cc732b3968d621505", version = "0.1.0" }
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", version = "0.1.0" }
craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "453b0da782ccef39be9a6dac8d27c80b553ef1cc", version = "0.1.0" }
egui = { workspace = true }
log = { workspace = true }
serde_json = { workspace = true }
@@ -65,6 +65,7 @@ fn baseline(d: &Drawing, t: &Text) -> cadcraft_geom::Vec2 {
#[test]
fn all_attribute_value_paths_refresh_small_justified_export_changes() {
cadcraft_io::dwg_worker::allow_in_process();
for path in ["json", "interactive", "global-json", "global-interactive"] {
let (mut s, a, b) = fixture();
let before = attributes(s.doc().unwrap(), a);
@@ -147,6 +148,7 @@ fn equal_attribute_values_preserve_an_imported_font_baseline() {
/// Recomputing a justified baseline must not replace its independent insertion elevation.
#[test]
fn value_edits_preserve_distinct_insertion_and_alignment_elevations_on_export() {
cadcraft_io::dwg_worker::allow_in_process();
let (mut s, a, _) = fixture();
s.doc_mut()
.unwrap()
+2
View File
@@ -72,6 +72,7 @@ fn edit(drawing: Drawing, handle: Handle, points: &[Vec2], explicit: bool, index
}
fn check(format: &str, interactive: bool) {
cadcraft_io::dwg_worker::allow_in_process();
for explicit in [false, true] {
for reversed in [false, true] {
let (drawing, handle, points) = fixture(explicit, reversed);
@@ -166,6 +167,7 @@ fn polyline_closedness_is_not_inferred_from_coincident_endpoints() {
#[test]
fn coincident_endpoints_remain_separately_editable_after_save() {
cadcraft_io::dwg_worker::allow_in_process();
let original = [Vec2::ZERO, Vec2::new(8.0, 0.0), Vec2::new(8.0, 6.0), Vec2::new(0.0, 6.0)];
for explicit in [false, true] {
for interactive in [false, true] {
+1
View File
@@ -212,6 +212,7 @@ fn whole_drawings_are_told_from_cut_off_ones() {
/// in a 2018 and a 2000 file, it doesn't replace the good backup; whole, it does.
#[test]
fn a_dwg_cut_off_anywhere_keeps_the_good_backup() {
cadcraft_io::dwg_worker::allow_in_process();
let _saving = saving();
hooks();
for version in [2018, 2000] {
+1
View File
@@ -31,6 +31,7 @@ fn folder(tag: &str) -> TempDir {
}
fn save(d: &Drawing, path: &Path) {
cadcraft_io::dwg_worker::allow_in_process();
std::fs::write(path, cadcraft_io::write(d, path).unwrap()).unwrap();
}
+1 -1
View File
@@ -78,7 +78,7 @@ fn dwg_error(message: String) -> IoError {
/// How a program runs the DWG reader and writer in a child process (`craft_dwg::worker`).
pub mod dwg_worker {
pub use craft_dwg::{WORKER_ARG, serve_if_asked, use_own_worker};
pub use craft_dwg::{WORKER_ARG, allow_in_process, serve_if_asked, use_own_worker};
#[cfg(all(not(target_arch = "wasm32"), not(all(target_os = "freebsd", target_arch = "aarch64"))))]
pub use craft_dwg::{crash_worker_for_test, use_worker};
}
+5
View File
@@ -394,6 +394,7 @@ fn read_census_reports_entities_the_reader_left_out() {
#[test]
fn dxf_round_trip_of_plain_geometry_is_lossless() {
use corpus::{Format, round_trip};
crate::dwg_worker::allow_in_process();
let mut d = drawing();
// What the comparator should see in a round trip: the drawing as read from its own DXF.
d = crate::read(crate::write(&d, "a.dxf").unwrap().as_slice(), "a.dxf").unwrap();
@@ -417,6 +418,7 @@ fn dxf_round_trip_of_plain_geometry_is_lossless() {
#[test]
fn hostile_files_are_reported_not_crashed() {
use corpus::{CorpusOptions, check_bytes};
crate::dwg_worker::allow_in_process();
let opts = CorpusOptions::default();
for (bytes, name) in [
(&b""[..], "empty.dxf"),
@@ -438,6 +440,7 @@ fn hostile_files_are_reported_not_crashed() {
#[test]
fn report_renders_as_markdown_and_json() {
use corpus::{CorpusOptions, CorpusReport, check_bytes};
crate::dwg_worker::allow_in_process();
let d = drawing();
let dxf = crate::write(&d, "a.dxf").unwrap();
let opts = CorpusOptions::default();
@@ -498,6 +501,7 @@ fn corpus_round_trip_report() {
eprintln!("CADCRAFT_CORPUS_DIR is not set: corpus round trip skipped");
return;
};
crate::dwg_worker::allow_in_process();
let out = std::env::var_os("CADCRAFT_CORPUS_REPORT").map_or_else(|| dir.join("report"), std::path::PathBuf::from);
let files = corpus::corpus_files(&dir, std::slice::from_ref(&out));
let report = corpus::run(&dir, &files, &corpus::CorpusOptions::default(), &mut |i, n, rel| eprintln!("[{}/{n}] {rel}", i + 1));
@@ -516,6 +520,7 @@ fn corpus_round_trip_report() {
#[test]
fn types_the_dwg_writer_cannot_write_are_reported_lost() {
use corpus::{CorpusReport, FileReport, Format, round_trip};
crate::dwg_worker::allow_in_process();
let unknown = |t: &str, tags: Vec<RawTag>| EntityKind::Unknown(Unknown { dxf_type: t.into(), tags });
let mut d = Drawing::new_metric();
let widget = vec![tag(100, "AcDbEntity"), tag(100, "AcmeWidget"), tag(10, "1.0"), tag(20, "2.0"), tag(30, "0.0")];
+11
View File
@@ -778,6 +778,7 @@ fn plot_paper_groups(dxf: &str, layout: &str) -> (f64, f64, i64) {
#[test]
fn landscape_media_keeps_its_size_order_and_rotation() {
crate::dwg_worker::allow_in_process();
// A media defined wider than tall, as ZWCAD and AutoCAD name it (#1463).
let media = "ISO full bleed A3 (420.00 x 297.00 MM)";
for (landscape, rotation) in [(true, 0), (false, 1)] {
@@ -811,6 +812,7 @@ fn landscape_media_keeps_its_size_order_and_rotation() {
/// longer describe it and the size and rotation are derived again.
#[test]
fn a_files_own_paper_groups_are_written_back() {
crate::dwg_worker::allow_in_process();
let set = |dxf: &str, (w, h, r): (f64, f64, i64)| -> String {
let mut lines: Vec<String> = dxf.lines().map(String::from).collect();
let name = (0..lines.len() - 3)
@@ -1229,6 +1231,7 @@ fn viewport_freeze_edited_in_autocad_is_read_as_edited() {
#[test]
fn viewport_frozen_layers_survive_dwg() {
crate::dwg_worker::allow_in_process();
let (d, _) = frozen_vp_dxf();
let dwg = write(&d, "t.dwg").unwrap();
let back = read(&dwg, "t.dwg").unwrap();
@@ -1490,6 +1493,7 @@ fn ac1024_dwg(n: usize) -> Vec<u8> {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn ac1024_dwg_with_many_entities_opens() {
crate::dwg_worker::allow_in_process();
let n = 30_000;
let dwg = ac1024_dwg(n);
let dxf = craft_dwg::dwg_to_dxf(&dwg).unwrap();
@@ -1552,6 +1556,7 @@ fn shared_dwg_diagnostics_keep_cadcraft_vocabulary() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn damaged_dwg_opens_partially_and_says_what_it_left_out() {
crate::dwg_worker::allow_in_process();
let mut dxf = String::from("0\nSECTION\n2\nENTITIES\n");
for i in 0..200 {
dxf += &format!("0\nLINE\n8\n0\n10\n{i}\n20\n0\n11\n{i}\n21\n10\n");
@@ -1847,6 +1852,7 @@ fn constraints_and_parameters_roundtrip_exactly() {
#[test]
fn layer_states_roundtrip_next_to_constraints() {
crate::dwg_worker::allow_in_process();
let mut d = Drawing::new_imperial();
let (constraints, _) = parametric_sample(&mut d);
d.layers.push(Layer {
@@ -2105,6 +2111,7 @@ fn reads_utf8_and_code_page_text() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn dwg_roundtrip_keeps_non_ascii_text() {
crate::dwg_worker::allow_in_process();
let back = read(&write(&intl_sample(), "x.dwg").unwrap(), "x.dwg").unwrap();
assert_intl(&back);
}
@@ -2207,6 +2214,7 @@ fn extension_sample_roundtrips_and_can_be_exported() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn dwg_roundtrip_keeps_extension_data() {
crate::dwg_worker::allow_in_process();
let d = extension_sample();
let back = read(&write(&d, "x.dwg").unwrap(), "x.dwg").unwrap();
// The bridge loses DIMFXL and DIMJOGANG (0 and its 5° minimum come back).
@@ -2466,6 +2474,7 @@ fn gradient_falls_back_to_xdata_and_native_groups_win() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn gradient_hatch_roundtrips_through_dwg() {
crate::dwg_worker::allow_in_process();
let (d, gradients) = gradient_sample();
let back = read(&write(&d, "x.dwg").unwrap(), "x.dwg").unwrap();
let hs = hatches(&back);
@@ -3723,6 +3732,7 @@ fn proxies_keep_their_class_when_classes_are_rewritten() {
fn proxies_keep_their_class_in_dwg() {
use acadrust::entities::{EntityType, ExtendedEntityData};
use acadrust::objects::ObjectType;
crate::dwg_worker::allow_in_process();
let d = read(&proxy_file(), "p.dxf").unwrap();
for version in [Version::R2018, Version::R2013, Version::R2010, Version::R2004] {
let dwg = write_with(&d, "p.dwg", &SaveOptions { version: Some(version), binary: false }).unwrap();
@@ -3830,6 +3840,7 @@ fn a_binary_dxf_leaves_its_proxies_out_of_the_dwg() {
#[test]
fn non_unicode_names_pick_the_format_by_extension() {
use std::os::unix::ffi::OsStringExt as _;
crate::dwg_worker::allow_in_process();
let name = |ext: &str| std::path::PathBuf::from(std::ffi::OsString::from_vec([b"caf\xe9.".as_slice(), ext.as_bytes()].concat()));
assert!(is_image(name("png")) && !is_image(name("dxf")));
let d = sample();
@@ -279,6 +279,7 @@ fn angular_diameter_and_radius_dimensions_are_saved_with_dimassoc() {
/// reference in `dxf_read::dimassoc`, plus the curve start/end osnap semantics in `infer_snap`.
#[test]
fn standard_dimassoc_associates_in_dxf_and_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let c = case();
let plain = without_cadcraft_xdata(&write_dxf(&c.d));
+1
View File
@@ -38,6 +38,7 @@ fn dwg_active_layout(dwg: &[u8]) -> String {
#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))]
fn dwg(d: &Drawing) -> Vec<u8> {
cadcraft_io::dwg_worker::allow_in_process();
write_with(d, "case.dwg", &SaveOptions { version: Some(Version::R2018), binary: false }).unwrap()
}
@@ -200,6 +200,7 @@ fn acad(v: Version) -> acadrust::DxfVersion {
/// The DXF of `version` saved as a `target` DWG holds the render settings and the field that
/// acadrust's own DXF → DWG conversion keeps.
fn kept_objects_survive(version: &str, target: Version) {
cadcraft_io::dwg_worker::allow_in_process();
let dxf = synthetic(version);
let mut source = acadrust::DxfReader::from_reader(Cursor::new(dxf.clone().into_bytes())).unwrap().read().unwrap();
let as_read = kept(&source);
@@ -242,6 +243,7 @@ fn kept_objects_survive(version: &str, target: Version) {
/// value.
#[test]
fn kept_groups_keep_their_version_across_saves() {
cadcraft_io::dwg_worker::allow_in_process();
let dxf = synthetic("AC1032");
for (first, second) in [(Version::R2004, Version::R2004), (Version::R2010, Version::R2018), (Version::R2018, Version::R2018)] {
let mut source = acadrust::DxfReader::from_reader(Cursor::new(dxf.clone().into_bytes())).unwrap().read().unwrap();
@@ -293,6 +295,7 @@ fn a_2018_files_kept_objects_reach_a_2004_dwg() {
/// A drawing from an R2000 DXF (no newer groups to read differently) saves as before.
#[test]
fn an_r2000_files_drawing_still_saves_as_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let dxf = " 0\r\nSECTION\r\n 2\r\nHEADER\r\n 9\r\n$ACADVER\r\n 1\r\nAC1015\r\n 0\r\nENDSEC\r\n 0\r\nSECTION\r\n 2\r\nENTITIES\r\n 0\r\nLINE\r\n 8\r\n0\r\n 10\r\n0\r\n 20\r\n0\r\n 30\r\n0\r\n 11\r\n10\r\n 21\r\n5\r\n 31\r\n0\r\n 0\r\nENDSEC\r\n 0\r\nEOF\r\n";
let d = read(dxf.as_bytes(), "line.dxf").unwrap();
let dwg = write_with(&d, "line.dwg", &SaveOptions::default()).unwrap();
@@ -36,6 +36,7 @@ fn dwg_with_out_of_order_vertex_handles(version: DxfVersion) -> Vec<u8> {
/// order the reader produced them; panics if the drawing cannot be read or holds no 3D polyline,
/// since either would mean the test is no longer exercising vertex order.
fn polyline3d_points(dwg: &[u8]) -> Vec<Vec3> {
cadcraft_io::dwg_worker::allow_in_process();
let drawing = cadcraft_io::read(dwg, "x.dwg").expect("read the DWG");
let polyline = drawing.model.iter().find_map(|e| if let EntityKind::Polyline3d(p) = &e.kind { Some(p) } else { None });
polyline.expect("one 3D polyline").points.clone()
@@ -64,6 +64,7 @@ fn value<'a>(vars: &'a [(String, String)], name: &str) -> Option<&'a str> {
/// require it see the drawing's contents; the added objects must not break CADCraft's own read.
#[test]
fn an_ac1018_dwg_gets_the_variable_dictionary_autocad_always_writes() {
cadcraft_io::dwg_worker::allow_in_process();
let d = rectangle();
let dxf = write_with(&d, "rect.dxf", &SaveOptions { version: Some(Version::R2000), binary: false }).expect("write the DXF");
let text = String::from_utf8_lossy(&dxf).to_ascii_lowercase();
@@ -118,6 +119,7 @@ fn impossible_header_values_fall_back_to_the_defaults() {
/// without the dictionary, so no dictionary is injected and the existing output stays as it was.
#[test]
fn an_ac1032_dwg_stays_as_it_was() {
cadcraft_io::dwg_worker::allow_in_process();
// 2018 DWGs read fine in Aspire without the dictionary, so the latest format is unchanged.
let d = rectangle();
let dwg = write_with(&d, "rect.dwg", &SaveOptions { version: Some(Version::R2018), binary: false }).expect("write the DWG");
+2
View File
@@ -46,6 +46,7 @@ fn check(d: &Drawing) {
#[test]
#[cfg(not(all(target_os = "freebsd", target_arch = "aarch64")))]
fn table_cell_heights_keep_inheritance_through_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let bytes = cadcraft_io::write(&drawing(), "height.dwg").unwrap();
// A style record can be present for metadata without overriding its text height.
// Write that synthetic representation directly so no earlier DXF conversion can
@@ -79,6 +80,7 @@ use acadrust::entities::table::{CellContent, CellStyle, CellStylePropertyFlags};
/// 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<f64> {
cadcraft_io::dwg_worker::allow_in_process();
let bytes = cadcraft_io::write(&drawing(), "height.dwg").unwrap();
let mut doc = acadrust::DwgReader::from_stream(std::io::Cursor::new(bytes)).read().unwrap();
let table = doc
@@ -91,6 +91,7 @@ fn check(text: &str, label: &str) {
#[test]
fn an_object_held_by_a_kept_one_is_kept() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = read_dxf(source().as_bytes()).expect("read");
for generation in 1..=2 {
let text = write_dxf(&d);
@@ -108,6 +109,7 @@ fn an_object_held_by_a_kept_one_is_kept() {
/// Mutual hard owners must not erase the live path through a retained dictionary entry.
#[test]
fn cyclic_hard_owners_with_a_live_holder_stay_kept() {
cadcraft_io::dwg_worker::allow_in_process();
let groups = [
(0, "SECTION"),
(2, "OBJECTS"),
+3
View File
@@ -9,6 +9,7 @@ use cadcraft_geom::Vec3;
use cadcraft_io::{SaveOptions, Version, read, write_dxf, write_with};
fn dwg_roundtrip(d: &Drawing) -> Drawing {
cadcraft_io::dwg_worker::allow_in_process();
let dwg = write_with(d, "case.dwg", &SaveOptions { version: Some(Version::R2018), binary: false }).unwrap();
read(&dwg, "case.dwg").unwrap()
}
@@ -148,6 +149,7 @@ fn a_dimension_block_takes_the_style_colours() {
#[test]
fn a_rotated_linear_dimension_stores_its_projected_length() {
cadcraft_io::dwg_worker::allow_in_process();
let d = s25(
DimKind::Linear { rotation: std::f64::consts::FRAC_PI_2 },
Vec3::new(-5.0, 0.0, 0.0),
@@ -241,6 +243,7 @@ fn justified_text_made_here_writes_its_baseline_start_for_every_justification()
/// Group 42 of a dimension in the DXF AutoCAD reads from `d`'s DWG.
fn stored_measurement(d: &Drawing) -> f64 {
cadcraft_io::dwg_worker::allow_in_process();
let dwg = write_with(d, "case.dwg", &SaveOptions { version: Some(Version::R2018), binary: false }).unwrap();
let dxf = String::from_utf8(craft_dwg::dwg_to_dxf(&dwg).unwrap()).unwrap();
let t = tags(&dxf);
+3
View File
@@ -90,6 +90,7 @@ fn dxf_keeps_the_data_store_and_drops_records_of_deleted_entities() {
#[test]
fn dwg_keeps_the_solids_geometry() {
cadcraft_io::dwg_worker::allow_in_process();
let d = cadcraft_io::read_dxf(dxf().as_bytes()).unwrap();
let dwg = cadcraft_io::write(&d, "x.dwg").unwrap();
// The DWG read back (as the bridge's DXF) binds the same bytes to both solids.
@@ -134,6 +135,7 @@ fn sat_text_solids_are_left_out_of_dxf_2013_and_later() {
/// out the contents of xref blocks, which the DXF doesn't hold anyway (#2334).
#[test]
fn sat_text_solids_stay_in_dwg_2018_and_xref_contents_are_not_counted() {
cadcraft_io::dwg_worker::allow_in_process();
let sat = "0\nSECTION\n2\nHEADER\n9\n$ACADVER\n1\nAC1015\n0\nENDSEC\n0\nSECTION\n2\nENTITIES\n\
0\nREGION\n5\n2B\n100\nAcDbEntity\n8\n0\n100\nAcDbModelerGeometry\n70\n1\n1\n400 1 1 0\n3\nEnd-of-ACIS-data\n\
0\nLINE\n5\n2D\n8\n0\n10\n0\n20\n0\n11\n1\n21\n1\n0\nENDSEC\n0\nEOF\n";
@@ -202,6 +204,7 @@ fn a_data_store_record_stores_only_its_first_entity() {
/// note has to say (#2334).
#[test]
fn a_dwg_keeps_a_sat_text_region_only_before_2013() {
cadcraft_io::dwg_worker::allow_in_process();
let sat = "0\nSECTION\n2\nHEADER\n9\n$ACADVER\n1\nAC1015\n0\nENDSEC\n0\nSECTION\n2\nENTITIES\n\
0\nREGION\n5\n2B\n100\nAcDbEntity\n8\n0\n100\nAcDbModelerGeometry\n70\n1\n1\n400 1 1 0\n3\nEnd-of-ACIS-data\n0\nENDSEC\n0\nEOF\n";
let d = cadcraft_io::read_dxf(sat.as_bytes()).unwrap();
+1
View File
@@ -32,6 +32,7 @@ fn centred_attdef_point_near_the_alignment_point_is_kept() {
/// read from DXF and kept by a write as DXF and as DWG (both versions). The displayed text is the
/// tag whatever the prompt: with a prompt, an empty one (group 3 empty) and none (no group 3).
fn assert_kept(start: f64) {
cadcraft_io::dwg_worker::allow_in_process();
for prompt in ["3\nprompt\n", "3\n\n", ""] {
let dxf = format!(
"0\nSECTION\n2\nENTITIES\n0\nATTDEF\n8\n0\n10\n{start}\n20\n5.0\n40\n2.5\n1\n\n7\nSTANDARD\n72\n1\n11\n100.0\n21\n5.0\n{prompt}2\nLONGTAG\n70\n8\n0\nENDSEC\n0\nEOF\n"
+2
View File
@@ -77,6 +77,7 @@ fn pairs(bytes: &[u8]) -> Vec<(i32, String)> {
#[test]
fn modes_survive_dxf_and_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let d = drawing();
let want = (vec![ALL, AttribModes::default()], vec![LOCKED, AttribModes::default()]);
assert_eq!(modes(&d), want);
@@ -122,6 +123,7 @@ fn a_280_before_the_tag_is_the_version_not_lock_position() {
/// The Constant mode (flag 2) of an ATTRIB attached to an INSERT, not only of an ATTDEF (#2246).
#[test]
fn constant_attached_attrib_survives_dxf_and_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let d = drawing_c(true);
let constants = |d: &Drawing| -> Vec<bool> {
d.model
+1
View File
@@ -249,6 +249,7 @@ fn hostile_multibyte_never_panics() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn pre_2007_dwg_text_decodes_through_the_bridge() {
cadcraft_io::dwg_worker::allow_in_process();
let dxf = ascii_dxf("AC1015", "ANSI_1251", b"\xD1\xEB\xEE\xE9", b"\xC1\xEB\xEE\xEA", b"\xCF\xF0\xE8\xE2\xE5\xF2");
let dwg = craft_dwg::dxf_to_dwg(&dxf).unwrap();
let d = cadcraft_io::read(&dwg, "x.dwg").unwrap();
@@ -224,6 +224,7 @@ fn hostile_handle_seed_does_not_panic() {
#[test]
fn dwg_reopen_and_save_keeps_one_block_per_dimension() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_metric();
d.add(&Space::Model, Common::default(), EntityKind::Dimension(linear([0.0, 0.0], [10.0, 0.0], [5.0, 3.0]))).unwrap();
let mut bytes = cadcraft_io::write(&d, "a.dwg").unwrap();
@@ -241,6 +242,7 @@ fn dwg_reopen_and_save_keeps_one_block_per_dimension() {
#[test]
fn an_unedited_dimension_keeps_the_block_it_was_read_with() {
use cadcraft_doc::{Circle, Point};
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_metric();
// The block another program drew: geometry CADCraft never generates (a circle) and the
// definition point on Defpoints.
+1
View File
@@ -111,6 +111,7 @@ fn dwg_angular_block_text_keeps_the_decimal_separator() {
use acadrust::entities::EntityType;
use cadcraft_io::{SaveOptions, Version};
cadcraft_io::dwg_worker::allow_in_process();
for (separator_override, expected) in [(None, "39,4°"), (Some("."), "39.4°")] {
let dwg =
cadcraft_io::write_with(&angular_drawing(separator_override), "angle.dwg", &SaveOptions { version: Some(Version::R2018), binary: false })
+4
View File
@@ -54,6 +54,7 @@ fn header_settings_round_trip_through_dxf() {
#[test]
fn header_settings_round_trip_through_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let d = drawing();
let dwg = cadcraft_io::write(&d, "x.dwg").unwrap();
let r = cadcraft_io::read(&dwg, "x.dwg").unwrap();
@@ -65,6 +66,7 @@ fn header_settings_round_trip_through_dwg() {
/// table (#2332).
#[test]
fn plot_style_mode_round_trips() {
cadcraft_io::dwg_worker::allow_in_process();
let dxf = "0\nSECTION\n2\nHEADER\n9\n$ACADVER\n1\nAC1032\n9\n$PSTYLEMODE\n290\n0\n0\nENDSEC\n0\nEOF\n";
let d = cadcraft_io::read_dxf(dxf.as_bytes()).unwrap();
assert_eq!(d.header.i64("PSTYLEMODE", -1), 0, "read");
@@ -79,6 +81,7 @@ fn plot_style_mode_round_trips() {
/// handle to the layer, and the writer used the null handle, so the drawing came back on "0" (#2252).
#[test]
fn the_current_layer_round_trips_through_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
for name in ["Survey_B", "Survey_\u{c4}"] {
let mut d = Drawing::new_metric();
d.layers.push(cadcraft_doc::Layer::new(name));
@@ -95,6 +98,7 @@ fn the_current_layer_round_trips_through_dwg() {
/// layer, under the layer's own spelling, not on "0" (#2252).
#[test]
fn a_current_layer_in_other_case_resolves_to_the_layer() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_metric();
d.layers.push(cadcraft_doc::Layer::new("Survey_\u{c4}"));
d.header.set_str("CLAYER", "Survey_\u{e4}");
+1
View File
@@ -12,6 +12,7 @@ use cadcraft_io::{SaveOptions, Version, read, write_with};
#[test]
fn entities_of_a_second_layout_are_owned_by_its_block() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_metric();
let order = d.layouts.iter().map(|l| l.tab_order).max().unwrap_or(0) + 1;
d.layouts.push(Layout::new("SHEET_A", order));
@@ -6,6 +6,7 @@ use cadcraft_doc::*;
use cadcraft_geom::{Vec2, Vec3};
fn through_dwg(d: &Drawing) -> Drawing {
cadcraft_io::dwg_worker::allow_in_process();
let dwg = cadcraft_io::write(d, "x.dwg").unwrap();
cadcraft_io::read(&dwg, "x.dwg").unwrap()
}
@@ -62,6 +63,7 @@ fn viewport_ids(l: &Layout) -> Vec<u32> {
/// AutoCAD 2018 (R2000 DWG has neither), while the DXF the bridge reads stays R2000.
#[test]
fn dwg_keeps_true_colours_and_transparency() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_metric();
d.layers.push(Layer { name: "Fancy".into(), color: Color::True(Rgb(12, 200, 99)), ..Layer::default() });
let h = line(
+1
View File
@@ -12,6 +12,7 @@ fn office() -> Drawing {
#[test]
fn dwt_is_written_as_dwg_and_read_back() {
cadcraft_io::dwg_worker::allow_in_process();
let bytes = write(&office(), "office.dwt").unwrap();
assert!(bytes.starts_with(b"AC10"), "a template is DWG content");
let back = read(&bytes, "office.dwt").unwrap();
+2
View File
@@ -163,6 +163,7 @@ fn binary_is_for_dxf_only() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn dwg_at_every_version_reads_back() {
cadcraft_io::dwg_worker::allow_in_process();
let d = sample();
for v in Version::ALL {
let dwg = write_with(&d, "x.dwg", &opts(v, false)).unwrap();
@@ -186,6 +187,7 @@ fn dwg_at_every_version_reads_back() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn dwg_default_is_at_least_2004() {
cadcraft_io::dwg_worker::allow_in_process();
let from_r2000 = read(write_dxf(&sample()).as_bytes(), "x.dxf").unwrap();
assert_eq!(craft_dwg::version(&write(&from_r2000, "x.dwg").unwrap()).as_deref(), Some("AC1018"));
assert_eq!(craft_dwg::version(&write(&sample(), "x.dwg").unwrap()).as_deref(), Some("AC1032"));
+2
View File
@@ -73,6 +73,7 @@ fn a_dynamic_block_reads_its_parameters_and_actions() {
#[test]
fn a_saved_drawing_keeps_the_dynamic_block_as_read() {
cadcraft_io::dwg_worker::allow_in_process();
let d = read_dxf(dxf(&fixture()).as_bytes()).unwrap();
let before = dynamic_block(&d, "Door").unwrap();
let again = read_dxf(write_dxf(&d).as_bytes()).unwrap();
@@ -110,6 +111,7 @@ fn with_scale_action() -> String {
#[test]
fn a_scale_action_survives_a_dwg_save() {
use acadrust::objects::{DynamicBlockData, DynamicBlockObject, ObjectType};
cadcraft_io::dwg_worker::allow_in_process();
let d = read_dxf(dxf(&with_scale_action()).as_bytes()).unwrap();
let before = dynamic_block(&d, "Door").unwrap();
assert!(before.actions.iter().any(|a| a.node == 7 && matches!(a.kind, ActionKind::Scale)), "{:?}", before.actions);
@@ -26,6 +26,7 @@ fn square(size: f64) -> Vec<PolyVertex> {
#[test]
fn line_extrusion_roundtrips_with_world_endpoints() {
cadcraft_io::dwg_worker::allow_in_process();
// A LINE's endpoints are world coordinates whatever its extrusion, which only directs its
// thickness; a mirrored normal (0, 0, -1) must come back from DXF and DWG (#2241).
let mut d = Drawing::new_metric();
+1
View File
@@ -8,6 +8,7 @@ use cadcraft_geom::{Vec2, Vec3};
use cadcraft_io::{SaveOptions, Version};
fn save(d: &Drawing, name: &str, v: Version) -> Vec<u8> {
cadcraft_io::dwg_worker::allow_in_process();
cadcraft_io::write_with(d, name, &SaveOptions { version: Some(v), binary: false }).unwrap()
}
+1
View File
@@ -7,6 +7,7 @@ use cadcraft_geom::Vec3;
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn groups_survive_dwg_round_trip() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_imperial();
let mut line = |x: f64| {
d.add(&Space::Model, Common::default(), EntityKind::Line(Line { a: Vec3::new(x, 0.0, 0.0), b: Vec3::new(x, 10.0, 0.0) })).expect("line")
@@ -120,6 +120,7 @@ fn record(p: &[(i32, String)], kind: &str, h: Handle) -> Vec<(i32, String)> {
/// the fill along in AutoCAD (dynamic blocks).
#[test]
fn a_hatch_in_a_block_keeps_its_boundary_and_the_boundary_its_reactor() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_imperial();
let mut b = Block::new("Tag");
let outline = d.new_handle();
+1
View File
@@ -170,6 +170,7 @@ fn hostile_helix_does_not_panic() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn helix_survives_dwg_save_and_reopen() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_imperial();
let a = Helix {
center: Vec3::ZERO,
@@ -43,6 +43,7 @@ fn a_layout_keeps_its_limits_and_image_origin_through_dxf() {
#[test]
fn a_layout_keeps_its_limits_and_image_origin_through_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let dwg = write_with(&drawing(), "t.dwg", &SaveOptions { version: Some(Version::R2018), binary: false }).expect("DWG");
let back = read(&dwg, "t.dwg").expect("reopen");
assert_kept(&back, "DWG");
@@ -59,6 +59,7 @@ fn dxf_preserves_leader_vertex_elevations() -> TestResult {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn dwg_preserves_leader_vertex_elevations() -> TestResult {
cadcraft_io::dwg_worker::allow_in_process();
check_round_trips("leader.dwg", false)
}
+1
View File
@@ -41,6 +41,7 @@ fn counts(d: &Drawing) -> (usize, usize) {
#[test]
fn faces_made_while_reading_do_not_take_the_files_handles() {
cadcraft_io::dwg_worker::allow_in_process();
let d = cadcraft_io::read_dxf(dxf().as_bytes()).unwrap();
assert_eq!(counts(&d), (3, 3));
let handles: Vec<Handle> = d.model.iter().chain(d.block("MESH").unwrap().entities.iter()).map(|e| e.handle).collect();
+1
View File
@@ -255,6 +255,7 @@ fn hostile_multileaders_do_not_panic() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn multileader_through_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_metric();
d.text_styles.push(TextStyle { name: "Notes".into(), ..TextStyle::default() });
d.mleader_styles.push(MLeaderStyle { name: "Callout".into(), arrow_size: 0.3, ..MLeaderStyle::default() });
+1
View File
@@ -284,6 +284,7 @@ fn hostile_mline_does_not_panic() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn mline_survives_dwg_save_and_reopen() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = Drawing::new_imperial();
d.mline_styles.push(wall());
let mut m = MLine::new(&wall(), &[Vec2::new(0.0, 0.0), Vec2::new(8.0, 0.0), Vec2::new(8.0, 6.0)], false, MLineJust::Top, 1.5);
@@ -57,6 +57,7 @@ fn model_layout_plots_extents_fitted_and_layouts_their_sheet() {
#[test]
fn model_layout_plot_type_survives_the_dwg_bridge() {
cadcraft_io::dwg_worker::allow_in_process();
let dwg = cadcraft_io::write(&drawing(), "x.dwg").unwrap();
// What the DWG holds, as the bridge's own DXF.
let dxf = String::from_utf8_lossy(&craft_dwg::dwg_to_dxf(&dwg).unwrap()).to_string();
+2
View File
@@ -77,6 +77,7 @@ fn dxf_mtext_caret_spaces_round_trip() -> TestResult {
#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))]
#[test]
fn dwg_mtext_caret_spaces_round_trip() -> TestResult {
cadcraft_io::dwg_worker::allow_in_process();
let (original, expected) = drawing()?;
for version in Version::ALL {
let mut d = original.clone();
@@ -106,6 +107,7 @@ fn dwg_mtext_caret_spaces_round_trip() -> TestResult {
#[cfg(not(any(target_arch = "wasm32", all(target_os = "freebsd", target_arch = "aarch64"))))]
#[test]
fn bridge_caret_space_is_escaped_once_in_each_direction() -> TestResult {
cadcraft_io::dwg_worker::allow_in_process();
let (d, _) = drawing()?;
let dxf = cadcraft_io::write_dxf(&d);
assert!(dxf.contains(" 1\r\n^ C\r\n"), "literal caret plus authored space needs two wire spaces");
@@ -85,6 +85,7 @@ fn assert_kept(rec: &[(String, String)]) {
#[test]
fn dwg_keeps_ole_objects() {
cadcraft_io::dwg_worker::allow_in_process();
let d = cadcraft_io::read_dxf(dxf().as_bytes()).unwrap();
let ole = |d: &cadcraft_doc::Drawing| d.model.iter().filter(|e| matches!(&e.kind, EntityKind::Unknown(u) if u.dxf_type == "OLE2FRAME")).count();
assert_eq!(ole(&d), 1);
+2
View File
@@ -47,6 +47,7 @@ fn ole(d: &cadcraft_doc::Drawing) -> Option<cadcraft_doc::Unknown> {
#[test]
fn a_dwg_keeps_an_ole_frame_with_its_data_and_position() {
cadcraft_io::dwg_worker::allow_in_process();
let d = read_dxf(dxf().as_bytes()).unwrap();
assert!(ole(&d).is_some());
let want: String = blob().iter().map(|b| format!("{b:02X}")).collect();
@@ -65,6 +66,7 @@ fn a_dwg_keeps_an_ole_frame_with_its_data_and_position() {
/// and read-back (review on #2587).
#[test]
fn a_moved_ole_frame_keeps_its_position_in_a_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let mut d = read_dxf(dxf().as_bytes()).unwrap();
for h in d.model.handles() {
d.model.modify(h, |e| e.kind.transform(&cadcraft_geom::Mat3::translate(cadcraft_geom::Vec2::new(100.0, -50.0))));
@@ -195,6 +195,7 @@ fn image_without_definition_is_still_written() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn image_survives_dwg_save_and_reopen() {
cadcraft_io::dwg_worker::allow_in_process();
let d = cadcraft_io::read_dxf(foreign_dxf().as_bytes()).unwrap();
let [img] = images(&d).try_into().unwrap();
let dwg = cadcraft_io::write(&d, "x.dwg").unwrap();
+1
View File
@@ -49,6 +49,7 @@ fn polyface_mesh_is_read_as_one_object_with_its_hidden_edges() {
#[test]
fn polyface_mesh_round_trips_through_dxf_and_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let d = read_dxf(POLYFACE_DXF.as_bytes()).unwrap();
let text = write_dxf(&d);
assert!(text.contains("AcDbPolyFaceMesh") && text.contains("AcDbFaceRecord"));
+1
View File
@@ -35,6 +35,7 @@ fn style_files(dxf: &str) -> Vec<(String, String)> {
#[test]
fn styles_get_windows_fonts_and_reopen_with_their_own() {
cadcraft_io::dwg_worker::allow_in_process();
let d = drawing(true);
let dxf = write_dxf(&d);
let files = style_files(&dxf);
@@ -13,6 +13,7 @@ use std::io::Cursor;
#[test]
fn writer_populates_native_geometry_without_our_reader() {
cadcraft_io::dwg_worker::allow_in_process();
let source = cases::common_case("native-writer", Common::default());
for version in Version::ALL {
let bytes = write_with(&source.drawing, "memory.dwg", &SaveOptions { version: Some(version), binary: false }).unwrap();
@@ -37,6 +38,7 @@ fn writer_populates_native_geometry_without_our_reader() {
#[test]
#[ignore = "Confirmed native DWG mismatch: a pi/2 linetype rotation is stored as pi/2 degrees; DXF unit interpretation needs investigation"]
fn complex_linetype_rotation_is_correct_in_native_objects() {
cadcraft_io::dwg_worker::allow_in_process();
// Both document APIs specify radians. Do not infer correctness from a DXF round trip:
// reader and writer can share a unit error. Public DXF references disagree about LTYPE
// group 50, so this asserts the end-to-end native angle, not a guessed DXF encoding.
@@ -61,6 +63,7 @@ fn complex_linetype_rotation_is_correct_in_native_objects() {
#[test]
fn reader_accepts_native_fixtures_without_our_writer() {
cadcraft_io::dwg_worker::allow_in_process();
for version in [DxfVersion::AC1015, DxfVersion::AC1018, DxfVersion::AC1021, DxfVersion::AC1024, DxfVersion::AC1027, DxfVersion::AC1032] {
let mut native = CadDocument::with_version(version);
let handles = [
+1
View File
@@ -57,6 +57,7 @@ fn check_version_with(case: &str, original: &Drawing, expected: &Drawing, versio
}
fn check_version_using(case: &str, original: &Drawing, expected: &Drawing, version: Version, verify: impl Fn(&Drawing, &Drawing, &str)) {
cadcraft_io::dwg_worker::allow_in_process();
let options = SaveOptions { version: Some(version), binary: false };
let mut current = original.clone();
for pass in 1..=2 {
@@ -35,5 +35,6 @@ fn dxf_exhausted_handles_are_preserved_or_refused() {
#[test]
#[cfg(not(target_arch = "wasm32"))]
fn dwg_exhausted_handles_are_preserved_or_refused() {
cadcraft_io::dwg_worker::allow_in_process();
preserves_or_refuses("memory.dwg", false);
}
+1
View File
@@ -69,6 +69,7 @@ fn dxf_owner(bytes: &[u8]) {
}
pub(super) fn check(path: &str, version: Version, binary: bool) {
cadcraft_io::dwg_worker::allow_in_process();
let original = drawing();
let mut current = original.clone();
for pass in 1..=2 {
+1
View File
@@ -1000,6 +1000,7 @@ fn hostile_raw_data_never_panics() {
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn dwg_keeps_extension_dictionaries_xrecords_and_entity_xdata() {
cadcraft_io::dwg_worker::allow_in_process();
let via_dwg = |d: &Drawing| cadcraft_io::read(&cadcraft_io::write(d, "x.dwg").expect("write DWG"), "x.dwg").expect("read DWG");
let d = via_dwg(&via_dwg(&read_dxf(fixture().as_bytes()).expect("read fixture")));
let o = Out::new(&write_dxf(&d));
+1
View File
@@ -97,6 +97,7 @@ fn a_block_entity_left_out_of_the_table_sorts_by_its_own_handle() {
#[test]
fn the_block_draw_order_survives_dxf_and_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let d = cadcraft_io::read_dxf(block_dxf().as_bytes()).unwrap();
let dxf = cadcraft_io::read_dxf(cadcraft_io::write_dxf(&d).as_bytes()).unwrap();
assert_eq!(block_kinds(&dxf), ["wipeout", "circle", "hline", "vline"], "DXF");
@@ -75,6 +75,7 @@ fn all_strings(d: &Drawing) -> Vec<String> {
#[test]
fn carets_are_written_escaped_and_read_back() {
cadcraft_io::dwg_worker::allow_in_process();
let dxf = write_dxf(&drawing());
// `^J` stays two characters: a single-line string has no line feeds.
for escaped in ["10^ 2 m, A^ JB", "1^ 3", "Area in m^ 2", "<> x10^ 3"] {
+1
View File
@@ -68,6 +68,7 @@ fn same(a: &[Option<ClipBoundary>], b: &[Option<ClipBoundary>]) {
}
fn save(d: &Drawing, name: &str, version: Version) -> Vec<u8> {
cadcraft_io::dwg_worker::allow_in_process();
write_with(d, name, &SaveOptions { version: Some(version), ..Default::default() }).unwrap()
}
+7
View File
@@ -33,6 +33,7 @@ fn source_payload(version: DxfVersion, payload: ProxyPayload) -> Vec<u8> {
}
fn check(bytes: &[u8], name: &str) -> cadcraft_doc::Drawing {
cadcraft_io::dwg_worker::allow_in_process();
let drawing = cadcraft_io::read(bytes, name).unwrap();
assert_eq!(drawing.entity_count(), 2);
let line = drawing.model.iter().find(|e| matches!(e.kind, EntityKind::Line(_))).unwrap().handle;
@@ -117,6 +118,7 @@ fn duplicate_class_dxf() -> Vec<u8> {
#[test]
fn duplicate_names_keep_distinct_classes_for_entities_and_dictionary_objects() {
cadcraft_io::dwg_worker::allow_in_process();
let source = duplicate_class_dxf();
for binary in [false, true] {
let input = if binary { craft_dxf::write_binary(&craft_dxf::parse(&source).unwrap(), true) } else { source.clone() };
@@ -163,6 +165,7 @@ fn duplicate_names_keep_distinct_classes_for_entities_and_dictionary_objects() {
#[test]
fn zero_bit_opaque_entities_are_still_retained() {
cadcraft_io::dwg_worker::allow_in_process();
let source = source_payload(DxfVersion::AC1032, ProxyPayload::default());
let mut drawing = cadcraft_io::read(&source, "source.dwg").unwrap();
for name in ["copy.dxf", "copy.dwg", "again.dwg"] {
@@ -193,6 +196,7 @@ fn proxies_inside_block_definitions_survive_repeated_saves() {
#[test]
fn unused_malformed_classes_do_not_block_plain_geometry() {
cadcraft_io::dwg_worker::allow_in_process();
for (name, cpp, flags, count) in [("", "Unused", 0, 0), ("UNUSED", "", 0, 0), ("UNUSED", "Unused", 65536, 0), ("UNUSED", "Unused", 0, i64::MAX)] {
let dxf = format!(
"0\nSECTION\n2\nHEADER\n9\n$ACADVER\n1\nAC1032\n0\nENDSEC\n0\nSECTION\n2\nCLASSES\n0\nCLASS\n1\n{name}\n2\n{cpp}\n3\nSynthetic\n90\n{flags}\n91\n{count}\n281\n1\n0\nENDSEC\n0\nSECTION\n2\nENTITIES\n0\nLINE\n5\n10\n100\nAcDbEntity\n8\n0\n100\nAcDbLine\n10\n2\n20\n3\n11\n12\n21\n13\n0\nENDSEC\n0\nEOF\n"
@@ -210,6 +214,7 @@ fn unused_malformed_classes_do_not_block_plain_geometry() {
#[test]
fn proxy_spelling_is_preserved_in_dxf_and_normalized_only_for_dwg() {
cadcraft_io::dwg_worker::allow_in_process();
let source = String::from_utf8(duplicate_class_dxf()).unwrap();
for (entity, object) in [("acad_proxy_entity", "acad_proxy_object"), ("AcAd_PrOxY_EnTiTy", "AcAd_PrOxY_ObJeCt")] {
let dxf = source.replace("ACAD_PROXY_ENTITY", entity).replace("ACAD_PROXY_OBJECT", object);
@@ -236,6 +241,7 @@ fn proxy_spelling_is_preserved_in_dxf_and_normalized_only_for_dwg() {
/// Exercise the actual ASCII bridge, which writes Unicode as CIF escapes.
#[test]
fn unicode_class_identity_survives_the_ascii_bridge() {
cadcraft_io::dwg_worker::allow_in_process();
let mut tags = craft_dxf::parse(&duplicate_class_dxf()).unwrap();
for tag in &mut tags {
let text = tag.str();
@@ -271,6 +277,7 @@ fn unicode_class_identity_survives_the_ascii_bridge() {
/// A malformed unused class must not silently collapse two otherwise valid class identities.
#[test]
fn ambiguous_fallback_classes_are_reported_without_losing_plain_geometry() {
cadcraft_io::dwg_worker::allow_in_process();
for escaped in [false, true] {
let mut source = String::from_utf8(duplicate_class_dxf()).unwrap().replacen(
"0\nENDSEC\n0\nSECTION\n2\nENTITIES",