blob: c99210a39e072fa17c002183762da7b2b83a5ec3 [file] [log] [blame]
<!DOCTYPE html><!-- webkit-test-runner [ ModelElementEnabled=true ] -->
<html>
<body>
<model id="model">
<source src="resources/heart.usdz">
</model>
<pre id="layers"></pre>
<script>
window.testRunner?.waitUntilDone();
window.testRunner?.dumpAsText();
const layers = document.getElementById("layers");
const source = document.querySelector("source");
const model = document.getElementById("model");
const modelDidLoadFirstSource = () => {
layers.textContent = "Before Changing Source:\n";
layers.textContent += window.internals?.platformLayerTreeAsText(model, window.internals.PLATFORM_LAYER_TREE_INCLUDE_MODELS) ?? "This test requires testRunner.";
model.addEventListener("load", event => {
layers.textContent += "After Changing Source:\n";
layers.textContent += window.internals?.platformLayerTreeAsText(model, window.internals.PLATFORM_LAYER_TREE_INCLUDE_MODELS) ?? "This test requires testRunner.";
window.testRunner?.notifyDone();
}, { once: true });
model.addEventListener("error", event => {
layers.textContent = `Failed. Second model did not load.`;
window.testRunner?.notifyDone();
}, { once: true });
source.src = "resources/cube.usdz";
}
if (model.complete)
modelDidLoadFirstSource();
else {
model.addEventListener("load", modelDidLoadFirstSource, { once: true });
model.addEventListener("error", event => {
layers.textContent = `Failed. First model did not load.`;
window.testRunner?.notifyDone();
}, { once: true });
}
</script>
</body>
</html>