Skip to content

Commit 3241977

Browse files
committed
test(mesh-filters): add test_slice_mesh.py
1 parent aa820ea commit 3241977

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed
Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,39 @@
1-
# Generated file. To retain edits, remove this comment.
1+
from pathlib import Path
2+
3+
from itkwasm_mesh_io import read_mesh
4+
from itkwasm_compare_meshes import compare_meshes
25

36
from itkwasm_mesh_filters_wasi import slice_mesh
47

5-
from .common import test_input_path, test_output_path
8+
from .common import test_baseline_path
69

710
def test_slice_mesh():
8-
pass
11+
input_mesh_path = test_baseline_path / "suzanne-repair.off"
12+
input_mesh = read_mesh(input_mesh_path)
13+
14+
planes = [
15+
{
16+
"origin": [0.0, 0.0, 0.0],
17+
"normal": [0.0, 0.0, 1.0],
18+
},
19+
{
20+
"origin": [0.0, 0.0, 1.0],
21+
"normal": [0.0, 0.0, 1.0],
22+
},
23+
{
24+
"origin": [0.0, 0.0, 2.0],
25+
"normal": [0.0, 0.0, 1.0],
26+
},
27+
]
28+
29+
polylines = slice_mesh(input_mesh, planes)
30+
31+
assert polylines
32+
33+
# baseline_mesh_path = test_baseline_path / "suzanne-slice.iwm.cbor"
34+
# baseline_mesh = read_mesh(baseline_mesh_path)
35+
36+
# TODO: uncomment after mesh type is supported?
37+
# comparison = compare_meshes(polylines, baseline_meshes=[baseline_mesh])
38+
39+
# assert comparison[0]['almostEqual']

0 commit comments

Comments
 (0)