mirror of
https://github.com/bherbruck/solidcraft.git
synced 2026-11-06 20:02:16 +00:00
fix(dxf): keep counter and copy tests compatible with strict Clippy
Use fresh local mutable counter values instead of mutable references to
constants. Enumerate the ten original copied shapes after asserting their
independent fixture count. Preserve all production code, numeric expected
values, refusals and the other tests. No lint suppression or ignored tests.
The prior 6b39ee36 attempt stopped at test-target Clippy, before native
test builds/runs and wasm. Both test-only hunks were independently reviewed;
normal formatting passed without changing bytes. New results are pending.
This commit is contained in:
@@ -277,10 +277,13 @@ mod tests {
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut bytes, &mut work).is_ok());
|
||||
assert_eq!((bytes, work), (MAX_DRAWING_BYTES, MAX_WORK));
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut bytes, &mut work).is_err());
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut MAX_DRAWING_BYTES, &mut 0).is_err());
|
||||
let mut full_bytes = MAX_DRAWING_BYTES;
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut full_bytes, &mut 0).is_err());
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut 0, &mut (MAX_WORK - 1)).is_err());
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut usize::MAX, &mut 0).is_err());
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut 0, &mut usize::MAX).is_err());
|
||||
let mut invalid_bytes = usize::MAX;
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut invalid_bytes, &mut 0).is_err());
|
||||
let mut invalid_work = usize::MAX;
|
||||
assert!(read_text_entity(&entity, 1.0, 1, 1, &mut 0, &mut invalid_work).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1079,6 +1079,7 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
let original: Vec<_> = source.entities().iter().map(|e| e.geometry().clone()).collect();
|
||||
assert_eq!(original.len(), 10);
|
||||
let copied = source.translated_scaled(Vec2::new(10.0, -5.0), 2.0).unwrap();
|
||||
let zero = copied.layer(copied.default_layer()).unwrap();
|
||||
assert_eq!((zero.name(), zero.color(), zero.linetype(), zero.weight()), ("0", 3, LineType::Hidden, Some(physical)));
|
||||
@@ -1103,10 +1104,10 @@ mod tests {
|
||||
assert!(!*closed);
|
||||
assert_eq!(vertices.iter().map(|v| v.at).collect::<Vec<_>>(), [Vec2::new(10.0, -5.0), Vec2::new(18.0, -5.0), Vec2::new(26.0, -5.0)]);
|
||||
assert_eq!(vertices.iter().map(|v| v.bulge.to_bits()).collect::<Vec<_>>(), [0.5f64.to_bits(), (-0.5f64).to_bits(), (-0.0f64).to_bits()]);
|
||||
for index in 0..10 {
|
||||
for (index, original_shape) in original.iter().enumerate() {
|
||||
assert_eq!(copied.effective_linetype(index).unwrap(), LineType::Hidden);
|
||||
assert_eq!(copied.effective_weight(index).unwrap(), if index == 9 { Weight::ByBlock } else { Weight::Explicit(physical) });
|
||||
assert_eq!(source.entities()[index].geometry(), &original[index]);
|
||||
assert_eq!(source.entities()[index].geometry(), original_shape);
|
||||
assert_eq!(source.entities()[index].layer(), old_zero);
|
||||
assert_eq!(source.entities()[index].weight(), Some(if index == 9 { Weight::ByBlock } else { Weight::ByLayer }));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user