| <!DOCTYPE html> <!-- webkit-test-runner [ SpatialPortalEnabled=true ModelElementEnabled=true ModelProcessEnabled=true allowTestOnlyIPC=true ] --> |
| <html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="../model-element/resources/model-utils.js"></script> |
| <script src="resources/spatial-portal-utils.js"></script> |
| <style> |
| .portal { spatial: portal; width: 40cm; height: 20cm; } |
| </style> |
| <body> |
| <script> |
| 'use strict'; |
| |
| internals.disableModelLoadDelaysForTesting(); |
| |
| const centeredCube = "2x2x2-center.usdz"; |
| |
| promise_test(async t => { |
| const staticPortal = createPortal(t); |
| const staticModel = appendModel(staticPortal, centeredCube); |
| |
| const orbitPortal = createPortal(t, { portalAction: "orbit" }); |
| const orbitModel = appendModel(orbitPortal, centeredCube); |
| |
| await staticModel.ready; |
| await orbitModel.ready; |
| |
| const boxFit = await waitForPortalTransform(staticPortal, portalTransformIsResolved, "portal-action: none"); |
| const sphereFit = await waitForPortalTransform(orbitPortal, portalTransformIsResolved, "portal-action: orbit"); |
| |
| assert_true(sphereFit.m11 < boxFit.m11, `orbit fits the bounding sphere (${sphereFit.m11} < ${boxFit.m11})`); |
| }, `portal-action: orbit fits the portal's content to its bounding sphere`); |
| |
| </script> |
| </body> |
| </html> |