Skip to content

Commit

Permalink
test_direct_api.py -> add vector transform tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jdegenstein authored Jun 21, 2024
1 parent 52e33f9 commit 644edc9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_direct_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3623,6 +3623,26 @@ def test_hash(self):
self.assertEqual(len(vectors), 4)
self.assertEqual(len(unique_vectors), 3)

def test_vector_transform(self):
a = Vector(1, 2, 3)
pxy = Plane.XY
pxy_o1 = Plane.XY.offset(1)
self.assertEqual(a.transform(pxy.forward_transform, vec_dir=True), a)
self.assertEqual(
a.transform(pxy.forward_transform, vec_dir=False), a.normalized()
)
self.assertEqual(
a.transform(pxy_o1.forward_transform, vec_dir=True), Vector(1, 2, 2)
)
self.assertEqual(
a.transform(pxy_o1.forward_transform, vec_dir=False), a.normalized()
)
self.assertEqual(
a.transform(pxy_o1.reverse_transform, vec_dir=True), Vector(1, 2, 4)
)
self.assertEqual(
a.transform(pxy_o1.reverse_transform, vec_dir=False), a.normalized()
)

class TestVectorLike(DirectApiTestCase):
"""Test typedef"""
Expand Down

0 comments on commit 644edc9

Please sign in to comment.