Skip to content

Commit 85b013f

Browse files
feat(Cells) mesh cells protocols
1 parent 07f7b0a commit 85b013f

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed
3.92 KB
Loading
2.58 KB
Loading
1.05 KB
Loading

tests/data/regular_grid_2d.vti

Lines changed: 13 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Standard library imports
2+
from typing import Callable
3+
4+
# Third party imports
5+
from opengeodeweb_viewer.rpc.mesh.mesh_protocols import VtkMeshView
6+
from opengeodeweb_viewer.rpc.mesh.cells.cells_protocols import VtkMeshCellsView
7+
8+
# Local application imports
9+
from tests.mesh.test_mesh_protocols import test_register_mesh
10+
from tests.conftest import ServerMonitor
11+
12+
# Local constants
13+
id = "regular_grid_2d"
14+
15+
def test_register(server: ServerMonitor, dataset_factory: Callable[..., str]) -> None:
16+
17+
dataset_factory(id=id, viewable_file=f"{id}.vti")
18+
19+
server.call(
20+
VtkMeshView.mesh_prefix + VtkMeshView.mesh_schemas_dict["register"]["rpc"],
21+
[{"id": id}],
22+
)
23+
assert server.compare_image("mesh/cells/register.jpeg") == True
24+
25+
def test_cells_color(
26+
server: ServerMonitor, dataset_factory: Callable[..., str]
27+
) -> None:
28+
29+
test_register(server, dataset_factory)
30+
31+
server.call(
32+
VtkMeshCellsView.mesh_cells_prefix
33+
+ VtkMeshCellsView.mesh_cells_schemas_dict["color"]["rpc"],
34+
[{"id": id, "color": {"r": 255, "g": 0, "b": 0}}],
35+
)
36+
assert server.compare_image("mesh/cells/color.jpeg") == True
37+
38+
39+
def test_cells_visibility(
40+
server: ServerMonitor, dataset_factory: Callable[..., str]
41+
) -> None:
42+
43+
test_register(server, dataset_factory)
44+
45+
server.call(
46+
VtkMeshCellsView.mesh_cells_prefix
47+
+ VtkMeshCellsView.mesh_cells_schemas_dict["visibility"]["rpc"],
48+
[{"id": id, "visibility": False}],
49+
)
50+
assert server.compare_image("mesh/cells/visibility.jpeg") == True

0 commit comments

Comments
 (0)