|
|
|
@ -4,6 +4,10 @@ use kcl_lib::{
|
|
|
|
|
settings::types::UnitLength,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/// The minimum permissible difference between asserted twenty-twenty images.
|
|
|
|
|
/// i.e. how different the current model snapshot can be from the previous saved one.
|
|
|
|
|
const MIN_DIFF: f64 = 0.99;
|
|
|
|
|
|
|
|
|
|
// mod server;
|
|
|
|
|
|
|
|
|
|
async fn new_context(units: UnitLength) -> Result<ExecutorContext> {
|
|
|
|
@ -83,35 +87,35 @@ const part002 = startSketchOn(part001, here)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
|
async fn serial_test_riddle_small() {
|
|
|
|
|
let code = include_str!("inputs/riddle_small.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/riddle_small.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/riddle_small.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
|
async fn serial_test_lego() {
|
|
|
|
|
let code = include_str!("inputs/lego.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/lego.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/lego.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
|
async fn serial_test_pipe_as_arg() {
|
|
|
|
|
let code = include_str!("inputs/pipe_as_arg.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pipe_as_arg.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pipe_as_arg.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
|
async fn serial_test_pentagon_fillet_sugar() {
|
|
|
|
|
let code = include_str!("inputs/pentagon_fillet_sugar.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Cm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pentagon_fillet_sugar.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pentagon_fillet_sugar.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -139,14 +143,14 @@ const part002 = startSketchOn(part001, "start")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_start.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_start.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
|
async fn serial_test_mike_stress_lines() {
|
|
|
|
|
let code = include_str!("inputs/mike_stress_test.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/mike_stress_test.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/mike_stress_test.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -174,7 +178,7 @@ const part002 = startSketchOn(part001, "END")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_end.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_end.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -205,7 +209,7 @@ const part002 = startSketchOn(part001, "END")
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/sketch_on_face_end_negative_extrude.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -242,7 +246,7 @@ async fn serial_test_basic_fillet_cube_start() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/basic_fillet_cube_start.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/basic_fillet_cube_start.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -259,7 +263,7 @@ async fn serial_test_basic_fillet_cube_end() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/basic_fillet_cube_end.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/basic_fillet_cube_end.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -279,7 +283,7 @@ async fn serial_test_basic_fillet_cube_close_opposite() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/basic_fillet_cube_close_opposite.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -299,7 +303,7 @@ async fn serial_test_basic_fillet_cube_next_adjacent() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/basic_fillet_cube_next_adjacent.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -319,7 +323,7 @@ async fn serial_test_basic_fillet_cube_previous_adjacent() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/basic_fillet_cube_previous_adjacent.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -341,7 +345,7 @@ const fnBox = box(3, 6, 10)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/function_sketch.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/function_sketch.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -364,7 +368,7 @@ const thing = box([0,0], 3, 6, 10)"#;
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/function_sketch_with_position.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -382,7 +386,7 @@ async fn serial_test_execute_with_angled_line() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/angled_line.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/angled_line.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -408,7 +412,7 @@ const bracket = startSketchOn('XY')
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/parametric.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/parametric.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -442,7 +446,7 @@ const bracket = startSketchAt([0, 0])
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/parametric_with_tan_arc.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/parametric_with_tan_arc.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -470,7 +474,7 @@ async fn serial_test_execute_i_shape() {
|
|
|
|
|
let code = include_str!("inputs/i_shape.kcl");
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/i_shape.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/i_shape.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -479,7 +483,7 @@ async fn serial_test_execute_pipes_on_pipes() {
|
|
|
|
|
let code = include_str!("inputs/pipes_on_pipes.kcl");
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pipes_on_pipes.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pipes_on_pipes.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -487,7 +491,7 @@ async fn serial_test_execute_cylinder() {
|
|
|
|
|
let code = include_str!("inputs/cylinder.kcl");
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cylinder.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cylinder.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -495,7 +499,7 @@ async fn serial_test_execute_kittycad_svg() {
|
|
|
|
|
let code = include_str!("inputs/kittycad_svg.kcl");
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/kittycad_svg.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/kittycad_svg.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -523,7 +527,7 @@ const pt2 = b2.value[0]
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/member_expression_sketch_group.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -536,7 +540,7 @@ async fn serial_test_helix_defaults() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/helix_defaults.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/helix_defaults.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -551,7 +555,7 @@ async fn serial_test_helix_defaults_negative_extrude() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/helix_defaults_negative_extrude.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -564,7 +568,7 @@ async fn serial_test_helix_ccw() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/helix_ccw.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/helix_ccw.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -576,7 +580,7 @@ async fn serial_test_helix_with_length() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/helix_with_length.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/helix_with_length.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -591,7 +595,7 @@ async fn serial_test_dimensions_match() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/dimensions_match.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/dimensions_match.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -608,7 +612,7 @@ const body = startSketchOn('XY')
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/close_arc.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/close_arc.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -634,7 +638,7 @@ let thing = box(-12, -15, 10)
|
|
|
|
|
box(-20, -5, 10)"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/negative_args.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/negative_args.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -647,7 +651,7 @@ async fn serial_test_basic_tangential_arc() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/tangential_arc.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/tangential_arc.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -660,7 +664,11 @@ async fn serial_test_basic_tangential_arc_with_point() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_with_point.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/tangential_arc_with_point.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -673,7 +681,7 @@ async fn serial_test_basic_tangential_arc_to() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_to.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/tangential_arc_to.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -703,7 +711,7 @@ box(-20, -5, 10, 'xy')"#;
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/different_planes_same_drawing.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -762,7 +770,7 @@ const part004 = startSketchOn('YZ')
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/lots_of_planes.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/lots_of_planes.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -779,7 +787,7 @@ async fn serial_test_holes() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/holes.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/holes.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -798,7 +806,7 @@ async fn optional_params() {
|
|
|
|
|
const thing = other_circle([2, 2], 20)
|
|
|
|
|
"#;
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/optional_params.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/optional_params.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -834,7 +842,7 @@ const part = roundedRectangle([0, 0], 20, 20, 4)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/rounded_with_holes.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/rounded_with_holes.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -842,7 +850,7 @@ async fn serial_test_top_level_expression() {
|
|
|
|
|
let code = r#"startSketchOn('XY') |> circle([0,0], 22, %) |> extrude(14, %)"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/top_level_expression.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/top_level_expression.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -859,7 +867,7 @@ const part = startSketchOn('XY')
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/patterns_linear_basic_with_math.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -872,7 +880,7 @@ async fn serial_test_patterns_linear_basic() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/patterns_linear_basic.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/patterns_linear_basic.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -888,7 +896,7 @@ async fn serial_test_patterns_linear_basic_3d() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/patterns_linear_basic_3d.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/patterns_linear_basic_3d.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -903,7 +911,7 @@ async fn serial_test_patterns_linear_basic_negative_distance() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/patterns_linear_basic_negative_distance.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -919,7 +927,7 @@ async fn serial_test_patterns_linear_basic_negative_axis() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/patterns_linear_basic_negative_axis.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -941,7 +949,11 @@ const rectangle = startSketchOn('XY')
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/patterns_linear_basic_holes.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/patterns_linear_basic_holes.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -953,7 +965,11 @@ async fn serial_test_patterns_circular_basic_2d() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/patterns_circular_basic_2d.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/patterns_circular_basic_2d.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -969,7 +985,11 @@ async fn serial_test_patterns_circular_basic_3d() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/patterns_circular_basic_3d.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/patterns_circular_basic_3d.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -988,7 +1008,7 @@ async fn serial_test_patterns_circular_3d_tilted_axis() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/patterns_circular_3d_tilted_axis.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1009,7 +1029,7 @@ async fn serial_test_import_obj_with_mtl() {
|
|
|
|
|
let code = r#"const model = import("tests/executor/inputs/cube.obj")"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_obj_with_mtl.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_obj_with_mtl.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1017,7 +1037,11 @@ async fn serial_test_import_obj_with_mtl_units() {
|
|
|
|
|
let code = r#"const model = import("tests/executor/inputs/cube.obj", {type: "obj", units: "m"})"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_obj_with_mtl_units.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/import_obj_with_mtl_units.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1025,7 +1049,7 @@ async fn serial_test_import_gltf_with_bin() {
|
|
|
|
|
let code = r#"const model = import("tests/executor/inputs/cube.gltf")"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_gltf_with_bin.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_gltf_with_bin.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1033,7 +1057,7 @@ async fn serial_test_import_gltf_embedded() {
|
|
|
|
|
let code = r#"const model = import("tests/executor/inputs/cube-embedded.gltf")"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_gltf_embedded.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_gltf_embedded.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1041,7 +1065,7 @@ async fn serial_test_import_glb() {
|
|
|
|
|
let code = r#"const model = import("tests/executor/inputs/cube.glb")"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_glb.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_glb.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1049,7 +1073,7 @@ async fn serial_test_import_glb_no_assign() {
|
|
|
|
|
let code = r#"import("tests/executor/inputs/cube.glb")"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_glb_no_assign.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/import_glb_no_assign.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1082,7 +1106,7 @@ const myCube = cube([0,0], 10)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_mm.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_mm.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1103,7 +1127,7 @@ const myCube = cube([0,0], 10)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Cm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_cm.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_cm.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1124,7 +1148,7 @@ const myCube = cube([0,0], 10)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::M).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_m.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_m.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1145,7 +1169,7 @@ const myCube = cube([0,0], 10)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::In).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_in.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_in.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1166,7 +1190,7 @@ const myCube = cube([0,0], 10)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Ft).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_ft.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_ft.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1187,7 +1211,7 @@ const myCube = cube([0,0], 10)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Yd).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_yd.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/cube_yd.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1256,7 +1280,7 @@ const part003 = startSketchOn(part002, "end")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_of_face.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_of_face.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1301,7 +1325,7 @@ const part002 = startSketchOn(part001, "end")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_circle.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_circle.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1325,7 +1349,11 @@ const part002 = startSketchOn(part001, "end")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_circle_tagged.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/sketch_on_face_circle_tagged.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1391,7 +1419,7 @@ async fn serial_test_big_number_angle_to_match_length_x() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/big_number_angle_to_match_length_x.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1412,7 +1440,7 @@ async fn serial_test_big_number_angle_to_match_length_y() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/big_number_angle_to_match_length_y.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1433,7 +1461,7 @@ async fn serial_test_simple_revolve() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1453,7 +1481,7 @@ async fn serial_test_simple_revolve_uppercase() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_uppercase.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_uppercase.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1473,7 +1501,7 @@ async fn serial_test_simple_revolve_negative() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_negative.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_negative.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1543,7 +1571,11 @@ async fn serial_test_simple_revolve_custom_angle() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_custom_angle.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/simple_revolve_custom_angle.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1563,7 +1595,11 @@ async fn serial_test_simple_revolve_custom_axis() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_custom_axis.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/simple_revolve_custom_axis.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1587,7 +1623,7 @@ const sketch001 = startSketchOn(box, "end")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/revolve_on_edge.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/revolve_on_edge.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1638,7 +1674,11 @@ const sketch001 = startSketchOn(box, "END")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/revolve_on_face_circle_edge.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/revolve_on_face_circle_edge.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1660,7 +1700,7 @@ const sketch001 = startSketchOn(box, "END")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/revolve_on_face_circle.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/revolve_on_face_circle.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1686,7 +1726,7 @@ const sketch001 = startSketchOn(box, "end")
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/revolve_on_face.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/revolve_on_face.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1700,7 +1740,7 @@ async fn serial_test_basic_revolve_circle() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/basic_revolve_circle.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/basic_revolve_circle.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1727,7 +1767,11 @@ const part002 = startSketchOn(part001, 'end')
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/simple_revolve_sketch_on_edge.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/simple_revolve_sketch_on_edge.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1788,7 +1832,7 @@ const plumbus1 = make_circle(p, b,$arc_b, [0, 0], 2.5)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/plumbus_fillets.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/plumbus_fillets.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1826,7 +1870,11 @@ capScrew([0, 0.5, 0], 50, 37.5, 50, 25)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/member_expression_in_params.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/member_expression_in_params.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1944,7 +1992,7 @@ async fn serial_test_xz_plane() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/xz_plane.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/xz_plane.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1958,7 +2006,7 @@ async fn serial_test_neg_xz_plane() {
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/neg_xz_plane.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/neg_xz_plane.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -1985,7 +2033,11 @@ const pattn2 = patternLinear3d({
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/linear_pattern3d_a_pattern.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/linear_pattern3d_a_pattern.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -2008,7 +2060,11 @@ const pattn2 = patternCircular3d({axis: [0,0, 1], center: [-20, -20, -20], repet
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/circular_pattern3d_a_pattern.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/circular_pattern3d_a_pattern.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -2037,7 +2093,7 @@ extrude(10, sketch001)
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/array_of_sketches.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/array_of_sketches.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -2103,7 +2159,7 @@ const sketch001 = startSketchOn(bracket, 'seg01')
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/sketch_on_face_after_fillets_referencing_face.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2140,7 +2196,11 @@ const pattn1 = patternLinear3d({
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pattern3d_array_of_extrudes.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/pattern3d_array_of_extrudes.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -2191,7 +2251,7 @@ const baseExtrusion = extrude(width, sketch001)
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/fillets_referencing_other_fillets.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2243,7 +2303,7 @@ const baseExtrusion = extrude(width, sketch001)
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/chamfers_referencing_other_chamfers.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2302,7 +2362,7 @@ const pattn1 = patternLinear3d({
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/linear_pattern3d_filleted_sketch.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2333,7 +2393,7 @@ const pattn2 = patternCircular3d({axis: [0,0, 1], center: [-20, -20, -20], repet
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/circular_pattern3d_filleted_sketch.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2364,7 +2424,7 @@ const pattn2 = patternCircular3d({axis: [0,0, 1], center: [-20, -20, -20], repet
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/circular_pattern3d_chamfered_sketch.png",
|
|
|
|
|
&result,
|
|
|
|
|
1.0,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2429,7 +2489,11 @@ const sketch001 = startSketchOn(part001, 'chamfer1')
|
|
|
|
|
"#;
|
|
|
|
|
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/sketch_on_face_of_chamfer.png", &result, 1.0);
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/sketch_on_face_of_chamfer.png",
|
|
|
|
|
&result,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -2463,21 +2527,21 @@ let p = triangle(200)
|
|
|
|
|
async fn serial_test_global_tags() {
|
|
|
|
|
let code = include_str!("inputs/global-tags.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/global_tags.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/global_tags.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
|
async fn serial_test_pattern_vase() {
|
|
|
|
|
let code = include_str!("inputs/pattern_vase.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pattern_vase.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/pattern_vase.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
|
async fn serial_test_scoped_tags() {
|
|
|
|
|
let code = include_str!("inputs/scoped-tags.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/scoped_tags.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/scoped_tags.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[tokio::test(flavor = "multi_thread")]
|
|
|
|
@ -2487,7 +2551,7 @@ async fn serial_test_order_sketch_extrude_in_order() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/order-sketch-extrude-in-order.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2498,7 +2562,7 @@ async fn serial_test_order_sketch_extrude_out_of_order() {
|
|
|
|
|
twenty_twenty::assert_image(
|
|
|
|
|
"tests/executor/outputs/order-sketch-extrude-out-of-order.png",
|
|
|
|
|
&result,
|
|
|
|
|
0.999,
|
|
|
|
|
MIN_DIFF,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -2506,5 +2570,5 @@ async fn serial_test_order_sketch_extrude_out_of_order() {
|
|
|
|
|
async fn serial_test_extrude_custom_plane() {
|
|
|
|
|
let code = include_str!("inputs/extrude-custom-plane.kcl");
|
|
|
|
|
let result = execute_and_snapshot(code, UnitLength::Mm).await.unwrap();
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/extrude-custom-plane.png", &result, 0.999);
|
|
|
|
|
twenty_twenty::assert_image("tests/executor/outputs/extrude-custom-plane.png", &result, MIN_DIFF);
|
|
|
|
|
}
|
|
|
|
|