blob: 7a4b48829e5aadc117aee0d54a880aa64436b6f8 [file] [edit]
<!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="../resources/ui-helper.js"></script>
<script src="resources/spatial-portal-utils.js"></script>
<style>
.portal { spatial: portal; width: 300px; height: 150px; }
</style>
<body>
<script>
'use strict';
window.internals?.disableModelLoadDelaysForTesting();
promise_test(async t => {
const portalA = createPortal(t);
const portalB = createPortal(t);
const staying = appendModel(portalA, "cube.usdz");
const moving = appendModel(portalA, "cube.usdz");
await Promise.all([staying.ready, moving.ready]);
assert_equals(internals.numberOfHostedModelsInSpatialPortal(portalA), 2, "portal A hosts both models");
portalB.appendChild(moving);
await UIHelper.ensureStablePresentationUpdate();
assert_equals(internals.numberOfHostedModelsInSpatialPortal(portalA), 1, "portal A still hosts the model that stayed");
assert_equals(internals.numberOfHostedModelsInSpatialPortal(portalB), 1, "portal B hosts the moved model");
}, "Moving one of two <model>s out of a spatial portal leaves its sibling hosted");
</script>
</body>
</html>