Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
rzulak committed May 1, 2020
1 parent c3beb64 commit fbdadae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/lib/ufe/testObject3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from ufeTestUtils import mayaUtils
from ufeTestUtils import usdUtils
from ufeTestUtils.testUtils import assertVectorAlmostEqual
from ufeTestUtils.testUtils import assertVectorAlmostEqual, assertVectorEqual

import ufe

Expand Down Expand Up @@ -100,6 +100,7 @@ def testBoundingBox(self):
proxyShapePathSegment = mayaUtils.createUfePathSegment(
proxyShapeMayaPath)

#######
# Create a UFE scene item from the sphere prim.
spherePathSegment = usdUtils.createUfePathSegment('/parent/sphere')
spherePath = ufe.Path([proxyShapePathSegment, spherePathSegment])
Expand All @@ -115,6 +116,24 @@ def testBoundingBox(self):
assertVectorAlmostEqual(self, ufeBBox.min.vector, [-1]*3)
assertVectorAlmostEqual(self, ufeBBox.max.vector, [1]*3)

#######
# Create a UFE scene item from the parent Xform of the sphere prim.
parentPathSegment = usdUtils.createUfePathSegment('/parent')
parentPath = ufe.Path([proxyShapePathSegment, parentPathSegment])
parentItem = ufe.Hierarchy.createItem(parentPath)

# Get its Object3d interface.
parentObject3d = ufe.Object3d.object3d(parentItem)

# Get its bounding box.
parentUFEBBox = parentObject3d.boundingBox()

# Compare it to sphere's extents.
assertVectorEqual(self, ufeBBox.min.vector, parentUFEBBox.min.vector)
assertVectorEqual(self, ufeBBox.max.vector, parentUFEBBox.max.vector)


#######
# Remove the test file.
os.remove(usdFilePath)

Expand Down
4 changes: 4 additions & 0 deletions test/lib/ufe/ufeTestUtils/testUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@
def assertVectorAlmostEqual(testCase, a, b, places=7):
for va, vb in zip(a, b):
testCase.assertAlmostEqual(va, vb, places)

def assertVectorEqual(testCase, a, b):
for va, vb in zip(a, b):
testCase.assertEqual(va, vb)

0 comments on commit fbdadae

Please sign in to comment.