https://github.com/web-platform-tests/wpt
Revision aceba7094d3d8145b85544ecca7c44de5f4b4f3a authored by plehegar on 16 May 2018, 11:21:12 UTC, committed by plehegar on 16 May 2018, 11:21:12 UTC
1 parent 74acc7e
Raw File
Tip revision: aceba7094d3d8145b85544ecca7c44de5f4b4f3a authored by plehegar on 16 May 2018, 11:21:12 UTC
Fixed moderators
Tip revision: aceba70
parse-input-arguments-003.html
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="match" href="parse-input-arguments-ref.html">
<style>
.container {
  width: 100px;
  height: 100px;
}

#canvas-geometry {
  background-image: paint(geometry);
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/css-paint-tests.js"></script>
<body>
<div id="canvas-geometry" class="container"></div>

<script id="code" type="text/worklet">
var testsPassed = false;
try {
    registerPaint('foo2', class {
        static get inputArguments() {
            return ['<non-sense-type>'];
        }
    });
} catch(ex) {
    if (ex.name == "TypeError" && ex.message == "Failed to execute 'registerPaint' on 'PaintWorkletGlobalScope': Invalid argument types.")
        testsPassed = true;
}

registerPaint('geometry', class {
    paint(ctx, geom) {
        if (testsPassed)
            ctx.strokeStyle = 'green';
        else
            ctx.strokeStyle = 'red';
        ctx.lineWidth = 4;
        ctx.strokeRect(0, 0, geom.width, geom.height);
    }
});
</script>

<script>
    importPaintWorkletAndTerminateTestAfterAsyncPaint(document.getElementById('code').textContent);
</script>
</body>
</html>
back to top