@@ -126,19 +126,19 @@ def test_enhanced_share_topology(modeler: Modeler):
126
126
127
127
def test_detect_logos (modeler : Modeler ):
128
128
"""Test logos are detected and deleted."""
129
- if BackendType .is_linux_service (modeler .client .backend_type ):
130
- # not yet available in Linux
131
- return
132
129
design = modeler .open_file (FILES_DIR / "partWithLogos.scdocx" )
133
130
component = [c for c in design .components if c .name == "Default" ][0 ]
134
131
body = [b for b in component .bodies if b .name == "Solid3" ][0 ]
135
132
assert len (body .faces ) == 189
136
133
result = modeler .prepare_tools .find_logos ()
137
- # no logos should be found is max height is not given
134
+ # no logos should be found if max height is not given
138
135
assert len (result .face_ids ) == 0
139
136
result = modeler .prepare_tools .find_logos (max_height = 0.005 )
140
137
assert len (result .face_ids ) == 147
141
138
success = modeler .prepare_tools .find_and_remove_logos (max_height = 0.005 )
139
+ # Skip the rest of the test if running on a Linux service backend
140
+ if BackendType .is_linux_service (modeler .client .backend_type ):
141
+ return
142
142
assert success is True
143
143
assert len (body .faces ) == 42
144
144
result = modeler .prepare_tools .find_and_remove_logos (None , min_height = 0.001 , max_height = 0.005 )
@@ -151,25 +151,34 @@ def test_detect_logos(modeler: Modeler):
151
151
152
152
def test_detect_and_fix_logo_as_problem_area (modeler : Modeler ):
153
153
"""Test logos are detected and deleted as problem area"""
154
- if BackendType .is_linux_service (modeler .client .backend_type ):
155
- # not yet available in Linux
156
- return
157
154
design = modeler .open_file (FILES_DIR / "partWithLogos.scdocx" )
158
- # Get the component named "Default"
159
155
component = [c for c in design .components if c .name == "Default" ][0 ]
160
- # test that no issue occurs when no logos are found on body named Solid1
161
- bodies = [b for b in component .bodies if b .name == "Solid1" ]
162
- result = modeler .prepare_tools .find_logos (bodies , max_height = 0.005 )
163
- assert len (result .face_ids ) == 0
164
- success = result .fix ()
165
- assert success is False
166
- # Remove logos from body named Solid3
167
- bodies = [b for b in component .bodies if b .name == "Solid3" ]
168
- result = modeler .prepare_tools .find_logos (bodies , max_height = 0.005 )
169
- assert len (result .face_ids ) == 147
170
- result .fix ()
171
- assert success is False
172
- assert len (design .components [0 ].bodies [2 ].faces ) == 42
156
+ body = [b for b in component .bodies if b .name == "Solid3" ][0 ]
157
+ # Initial face count
158
+ assert len (body .faces ) == 189
159
+ # Test finding logos without max height
160
+ result_no_max_height = modeler .prepare_tools .find_logos ()
161
+ assert len (result_no_max_height .face_ids ) == 0
162
+ # Test finding logos with max height
163
+ result_with_max_height = modeler .prepare_tools .find_logos (max_height = 0.005 )
164
+ assert len (result_with_max_height .face_ids ) == 147
165
+ # Skip fix-related assertions if running on a Linux service backend
166
+ if BackendType .is_linux_service (modeler .client .backend_type ):
167
+ return
168
+ # Test removing logos with max height
169
+ success_remove_logos = modeler .prepare_tools .find_and_remove_logos (max_height = 0.005 )
170
+ assert success_remove_logos is True
171
+ assert len (body .faces ) == 42
172
+ # Test removing logos with min and max height (no logos should be removed)
173
+ result_min_max_height = modeler .prepare_tools .find_and_remove_logos (
174
+ None , min_height = 0.001 , max_height = 0.005
175
+ )
176
+ assert result_min_max_height is False
177
+ # Test removing logos from specific bodies (no logos should be removed)
178
+ result_specific_bodies = modeler .prepare_tools .find_and_remove_logos (
179
+ design .components [0 ].bodies , min_height = 0.001 , max_height = 0.005
180
+ )
181
+ assert result_specific_bodies is False
173
182
174
183
175
184
def test_volume_extract_bad_faces (modeler : Modeler ):
0 commit comments