Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
// OffscreenCanvas test in a worker:2d.path.isPointInPath.nobitmap.transform
// Description:The transformation matrix mutators apply on a canvas with no bitmap
// Note:
importScripts("/resources/testharness.js");
importScripts("/html/canvas/resources/canvas-tests.js");
var t = async_test("The transformation matrix mutators apply on a canvas with no bitmap");
var t_pass = t.done.bind(t);
var t_fail = t.step_func(function(reason) {
throw reason;
});
t.step(function() {
var canvas = new OffscreenCanvas(0, 0);
var ctx = canvas.getContext('2d');
ctx.translate(50, 0);
ctx.rect(0, 0, 20, 20);
_assertSame(ctx.isPointInPath(60, 10), true, "ctx.isPointInPath(60, 10)", "true");
_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false");
ctx.resetTransform();
_assertSame(ctx.getTransform().e, 0, "ctx.getTransform().e", "0");
ctx.beginPath();
ctx.scale(2, 2);
ctx.rect(0, 0, 20, 20);
_assertSame(ctx.isPointInPath(30, 30), true, "ctx.isPointInPath(30, 30)", "true");
_assertSame(ctx.isPointInPath(50, 50), false, "ctx.isPointInPath(50, 50)", "false");
ctx.setTransform(1, 0, 0, 1, 0, 50);
_assertSame(ctx.getTransform().f, 50, "ctx.getTransform().f", "50");
ctx.beginPath();
ctx.rect(0, 0, 20, 20);
_assertSame(ctx.isPointInPath(10, 60), true, "ctx.isPointInPath(10, 60)", "true");
_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false");
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.transform(1, 0, 0, 1, 50, 0);
ctx.beginPath();
ctx.rect(0, 0, 20, 20);
_assertSame(ctx.isPointInPath(60, 10), true, "ctx.isPointInPath(60, 10)", "true");
_assertSame(ctx.isPointInPath(10, 10), false, "ctx.isPointInPath(10, 10)", "false");
ctx.setTransform(1, 0, 0, 1, 0, 0);
ctx.rotate(Math.PI / 2);
ctx.beginPath();
ctx.rect(10, 10, 20, 20);
_assertSame(ctx.isPointInPath(-20, 20), true, "ctx.isPointInPath(-20, 20)", "true");
_assertSame(ctx.isPointInPath(20, 20), false, "ctx.isPointInPath(20, 20)", "false");
t.done();
});
done();