test: Torsion joint covered

This commit is contained in:
Leni Aniva 2024-07-06 23:53:57 -07:00
parent 800b658410
commit dc6e2a8933
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
1 changed files with 13 additions and 12 deletions

View File

@ -23,26 +23,27 @@ class TestJoints(unittest.TestCase):
def test_joints_comma_assembly(self): def test_joints_comma_assembly(self):
joints.comma_assembly() joints.comma_assembly()
def test_torsion_joint(self): def torsion_joint_case(self, joint: joints.TorsionJoint, slot: int):
j = joints.TorsionJoint()
assembly = j.rider_track_assembly()
bbox = assembly.toCompound().BoundingBox()
self.assertAlmostEqual(bbox.zlen, j.total_height)
def torsion_joint_collision_case(self, joint: joints.TorsionJoint, slot: int):
assembly = joint.rider_track_assembly(slot) assembly = joint.rider_track_assembly(slot)
bbox = assembly.toCompound().BoundingBox() bbox = assembly.toCompound().BoundingBox()
self.assertAlmostEqual(bbox.zlen, joint.total_height) self.assertAlmostEqual(bbox.zlen, joint.total_height)
self.assertEqual(pairwise_intersection(assembly), []) self.assertEqual(pairwise_intersection(assembly), [])
def test_torsion_joint_collision(self): def test_torsion_joint(self):
j = joints.TorsionJoint() j = joints.TorsionJoint()
for slot in range(j.rider_n_slots): for slot in range(j.rider_n_slots):
with self.subTest(slot=slot): with self.subTest(slot=slot):
self.torsion_joint_collision_case(j, slot) self.torsion_joint_case(j, slot)
def test_torsion_joint_collision_right_handed(self): def test_torsion_joint_right_handed(self):
j = joints.TorsionJoint(right_handed=True) j = joints.TorsionJoint(right_handed=True)
self.torsion_joint_collision_case(j, 1) self.torsion_joint_case(j, 1)
def test_torsion_joint_covered(self):
j = joints.TorsionJoint(
spring_hole_cover_track=True,
spring_hole_cover_rider=True,
)
self.torsion_joint_case(j, 1)
class TestHandle(unittest.TestCase): class TestHandle(unittest.TestCase):
@ -63,7 +64,7 @@ class TestMetricThreads(unittest.TestCase):
def test_major_radius(self): def test_major_radius(self):
major = 3.0 major = 3.0
t = metric_threads.external_metric_thread(major, 0.5, 4.0, z_start= -0.85, top_lead_in=True) t = metric_threads.external_metric_thread(major, 0.5, 4.0, z_start=-0.85, top_lead_in=True)
bbox = t.val().BoundingBox() bbox = t.val().BoundingBox()
self.assertAlmostEqual(bbox.xlen, major, places=3) self.assertAlmostEqual(bbox.xlen, major, places=3)
self.assertAlmostEqual(bbox.ylen, major, places=3) self.assertAlmostEqual(bbox.ylen, major, places=3)