Skip to content

Commit

Permalink
Add constraint tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vespakoen committed Jan 15, 2023
1 parent 6b82f10 commit 2420160
Show file tree
Hide file tree
Showing 20 changed files with 15 additions and 0 deletions.
Binary file added testing/constraints/angle.blend
Binary file not shown.
Binary file not shown.
Binary file added testing/constraints/coincident_point_line.blend
Binary file not shown.
Binary file added testing/constraints/diameter.blend
Binary file not shown.
Binary file added testing/constraints/distance_point_line.blend
Binary file not shown.
Binary file added testing/constraints/distance_point_point.blend
Binary file not shown.
Binary file added testing/constraints/equal_circle_arc.blend
Binary file not shown.
Binary file added testing/constraints/equal_line_2d.blend
Binary file not shown.
Binary file added testing/constraints/equal_line_arc.blend
Binary file not shown.
Binary file added testing/constraints/horizontal_line.blend
Binary file not shown.
Binary file added testing/constraints/horizontal_points.blend
Binary file not shown.
Binary file added testing/constraints/midpoint.blend
Binary file not shown.
Binary file added testing/constraints/parallel.blend
Binary file not shown.
Binary file added testing/constraints/perpendicular.blend
Binary file not shown.
Binary file added testing/constraints/ratio.blend
Binary file not shown.
Binary file added testing/constraints/tangent_arc_arc.blend
Binary file not shown.
Binary file added testing/constraints/tangent_arc_line.blend
Binary file not shown.
Binary file added testing/constraints/vertical_line.blend
Binary file not shown.
Binary file added testing/constraints/vertical_points.blend
Binary file not shown.
15 changes: 15 additions & 0 deletions testing/test_constraints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import glob
from pathlib import Path
from CAD_Sketcher.testing.utils import BgsTestCase

class TestConstraints(BgsTestCase):
def test_constraints(self):
import bpy
path = str(Path(__file__).parent.absolute() / "constraints" / "*.blend")
test_files = glob.glob(path)
for test_file in test_files:
with bpy.data.libraries.load(test_file) as (data_from, data_to):
for attr in dir(data_to):
setattr(data_to, attr, getattr(data_from, attr))
ok = self.context.scene.sketcher.solve(self.context)
self.assertTrue(ok)

0 comments on commit 2420160

Please sign in to comment.