|
4 | 4 |
|
5 | 5 |
|
6 | 6 | def test_create_visualization(server): |
7 | | - server.call("create_visualization", []) |
| 7 | + server.call("create_visualization") |
8 | 8 | abs_path = os.path.join(images_dir_path, "create_visualization.jpeg") |
9 | 9 | assert server.compare_image(3, abs_path) == True |
10 | 10 |
|
11 | 11 |
|
12 | | -# def test_reset_camera(server): |
13 | | -# server.call("reset_camera", [{}]) |
14 | | -# abs_path = os.path.join(images_dir_path, "reset_camera.jpeg") |
15 | | -# assert server.compare_image(2, abs_path) == True |
| 12 | +def test_reset_camera(server): |
| 13 | + server.call("reset_camera") |
| 14 | + abs_path = os.path.join(images_dir_path, "reset_camera.jpeg") |
| 15 | + assert server.compare_image(3, abs_path) == True |
| 16 | + |
| 17 | + |
| 18 | +def test_create_object_pipeline(server): |
| 19 | + server.call("create_object_pipeline", [{"id": "123456", "file_name": "hat.vtp"}]) |
| 20 | + abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
| 21 | + assert server.compare_image(3, abs_path) == True |
| 22 | + |
| 23 | + |
| 24 | +def test_delete_object_pipeline(server): |
| 25 | + server.call("create_object_pipeline", [{"id": "123456789", "file_name": "hat.vtp"}]) |
| 26 | + abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
| 27 | + assert server.compare_image(3, abs_path) == True |
| 28 | + |
| 29 | + server.call("delete_object_pipeline", [{"id": "123456789"}]) |
| 30 | + abs_path = os.path.join(images_dir_path, "delete_object_pipeline.jpeg") |
| 31 | + assert server.compare_image(3, abs_path) == True |
| 32 | + |
| 33 | + |
| 34 | +def test_toggle_object_visibility(server): |
| 35 | + server.call("create_object_pipeline", [{"id": "123456789", "file_name": "hat.vtp"}]) |
| 36 | + abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
| 37 | + assert server.compare_image(3, abs_path) == True |
| 38 | + |
| 39 | + server.call("toggle_object_visibility", [{"id": "123456789", "is_visible": False}]) |
| 40 | + abs_path = os.path.join(images_dir_path, "toggle_object_visibility_1.jpeg") |
| 41 | + assert server.compare_image(3, abs_path) == True |
| 42 | + |
| 43 | + server.call("toggle_object_visibility", [{"id": "123456789", "is_visible": True}]) |
| 44 | + abs_path = os.path.join(images_dir_path, "toggle_object_visibility_2.jpeg") |
| 45 | + assert server.compare_image(3, abs_path) == True |
| 46 | + |
| 47 | + |
| 48 | +def test_apply_textures(server): |
16 | 49 |
|
17 | | - |
18 | | -# def test_create_object_pipeline(server): |
19 | | -# server.call("create_object_pipeline", [{"id": "123456", "file_name": "hat.vtp"}]) |
20 | | -# abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
21 | | -# assert server.compare_image(3, abs_path) == True |
22 | | - |
23 | | - |
24 | | -# def test_delete_object_pipeline(server): |
25 | | -# server.call("create_object_pipeline", [{"id": "123456789", "file_name": "hat.vtp"}]) |
26 | | -# abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
27 | | -# assert server.compare_image(3, abs_path) == True |
28 | | - |
29 | | -# server.call("delete_object_pipeline", [{"id": "123456789"}]) |
30 | | -# abs_path = os.path.join(images_dir_path, "delete_object_pipeline.jpeg") |
31 | | -# assert server.compare_image(3, abs_path) == True |
32 | | - |
33 | | - |
34 | | -# def test_toggle_object_visibility(server): |
35 | | -# server.call("create_object_pipeline", [{"id": "123456789", "file_name": "hat.vtp"}]) |
36 | | -# abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
37 | | -# assert server.compare_image(3, abs_path) == True |
38 | | - |
39 | | -# server.call("toggle_object_visibility", [{"id": "123456789", "is_visible": False}]) |
40 | | -# abs_path = os.path.join(images_dir_path, "toggle_object_visibility_1.jpeg") |
41 | | -# assert server.compare_image(3, abs_path) == True |
42 | | - |
43 | | -# server.call("toggle_object_visibility", [{"id": "123456789", "is_visible": True}]) |
44 | | -# abs_path = os.path.join(images_dir_path, "toggle_object_visibility_2.jpeg") |
45 | | -# assert server.compare_image(3, abs_path) == True |
46 | | - |
47 | | - |
48 | | -# def test_apply_textures(server): |
49 | | - |
50 | | -# server.call( |
51 | | -# "create_object_pipeline", |
52 | | -# [{"id": "123456789", "file_name": "hat.vtp"}], |
53 | | -# ) |
54 | | -# abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
55 | | -# assert server.compare_image(3, abs_path) == True |
56 | | - |
57 | | -# server.call( |
58 | | -# "apply_textures", |
59 | | -# [ |
60 | | -# { |
61 | | -# "id": "123456789", |
62 | | -# "textures": [ |
63 | | -# { |
64 | | -# "texture_name": "lambert2SG", |
65 | | -# "texture_file_name": "hat_lambert2SG.vti", |
66 | | -# } |
67 | | -# ], |
68 | | -# } |
69 | | -# ], |
70 | | -# ) |
71 | | -# abs_path = os.path.join(images_dir_path, "apply_textures.jpeg") |
72 | | -# assert server.compare_image(3, abs_path) == True |
73 | | - |
74 | | - |
75 | | -# def test_get_point_position(server): |
76 | | - |
77 | | -# server.call( |
78 | | -# "create_object_pipeline", |
79 | | -# [{"id": "123456789", "file_name": "hat.vtp"}], |
80 | | -# ) |
81 | | -# abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
82 | | -# assert server.compare_image(3, abs_path) == True |
83 | | - |
84 | | -# server.call("get_point_position", [{"x": 0, "y": 0}]) |
85 | | -# response = server.get_response() |
86 | | -# assert "x" in response["result"] |
87 | | -# assert "y" in response["result"] |
88 | | -# assert "z" in response["result"] |
89 | | -# x = response["result"]["x"] |
90 | | -# y = response["result"]["y"] |
91 | | -# z = response["result"]["z"] |
92 | | -# assert type(x) is float |
93 | | -# assert type(y) is float |
94 | | -# assert type(z) is float |
95 | | - |
96 | | - |
97 | | -# def test_toggle_edge_visibility(server): |
98 | | - |
99 | | -# server.call( |
100 | | -# "create_object_pipeline", |
101 | | -# [{"id": "123456789", "file_name": "hat.vtp"}], |
102 | | -# ) |
103 | | -# abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
104 | | -# assert server.compare_image(3, abs_path) == True |
105 | | - |
106 | | -# server.call("toggle_edge_visibility", [{"id": "123456789", "visibility": True}]) |
107 | | -# abs_path = os.path.join(images_dir_path, "toggle_edge_visibility.jpeg") |
108 | | -# assert server.compare_image(3, abs_path) == True |
109 | | - |
110 | | - |
111 | | -# def test_set_color(server): |
112 | | - |
113 | | -# server.call( |
114 | | -# "create_object_pipeline", |
115 | | -# [{"id": "123456789", "file_name": "hat.vtp"}], |
116 | | -# ) |
117 | | -# abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
118 | | -# assert server.compare_image(3, abs_path) == True |
119 | | - |
120 | | -# server.call("set_color", [{"id": "123456789", "red": 50, "green": 2, "blue": 250}]) |
121 | | -# abs_path = os.path.join(images_dir_path, "set_color.jpeg") |
122 | | -# assert server.compare_image(3, abs_path) == True |
| 50 | + server.call( |
| 51 | + "create_object_pipeline", |
| 52 | + [{"id": "123456789", "file_name": "hat.vtp"}], |
| 53 | + ) |
| 54 | + abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
| 55 | + assert server.compare_image(3, abs_path) == True |
| 56 | + |
| 57 | + server.call( |
| 58 | + "apply_textures", |
| 59 | + [ |
| 60 | + { |
| 61 | + "id": "123456789", |
| 62 | + "textures": [ |
| 63 | + { |
| 64 | + "texture_name": "lambert2SG", |
| 65 | + "texture_file_name": "hat_lambert2SG.vti", |
| 66 | + } |
| 67 | + ], |
| 68 | + } |
| 69 | + ], |
| 70 | + ) |
| 71 | + abs_path = os.path.join(images_dir_path, "apply_textures.jpeg") |
| 72 | + assert server.compare_image(3, abs_path) == True |
| 73 | + |
| 74 | + |
| 75 | +def test_get_point_position(server): |
| 76 | + |
| 77 | + server.call( |
| 78 | + "create_object_pipeline", |
| 79 | + [{"id": "123456789", "file_name": "hat.vtp"}], |
| 80 | + ) |
| 81 | + abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
| 82 | + assert server.compare_image(3, abs_path) == True |
| 83 | + |
| 84 | + server.call("get_point_position", [{"x": 0, "y": 0}]) |
| 85 | + response = server.get_response() |
| 86 | + assert "x" in response["result"] |
| 87 | + assert "y" in response["result"] |
| 88 | + assert "z" in response["result"] |
| 89 | + x = response["result"]["x"] |
| 90 | + y = response["result"]["y"] |
| 91 | + z = response["result"]["z"] |
| 92 | + assert type(x) is float |
| 93 | + assert type(y) is float |
| 94 | + assert type(z) is float |
| 95 | + |
| 96 | + |
| 97 | +def test_toggle_edge_visibility(server): |
| 98 | + |
| 99 | + server.call( |
| 100 | + "create_object_pipeline", |
| 101 | + [{"id": "123456789", "file_name": "hat.vtp"}], |
| 102 | + ) |
| 103 | + abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
| 104 | + assert server.compare_image(3, abs_path) == True |
| 105 | + |
| 106 | + server.call("toggle_edge_visibility", [{"id": "123456789", "visibility": True}]) |
| 107 | + abs_path = os.path.join(images_dir_path, "toggle_edge_visibility.jpeg") |
| 108 | + assert server.compare_image(3, abs_path) == True |
| 109 | + |
| 110 | + |
| 111 | +def test_set_color(server): |
| 112 | + |
| 113 | + server.call( |
| 114 | + "create_object_pipeline", |
| 115 | + [{"id": "123456789", "file_name": "hat.vtp"}], |
| 116 | + ) |
| 117 | + abs_path = os.path.join(images_dir_path, "create_object_pipeline.jpeg") |
| 118 | + assert server.compare_image(3, abs_path) == True |
| 119 | + |
| 120 | + server.call("set_color", [{"id": "123456789", "red": 50, "green": 2, "blue": 250}]) |
| 121 | + abs_path = os.path.join(images_dir_path, "set_color.jpeg") |
| 122 | + assert server.compare_image(3, abs_path) == True |
0 commit comments