-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add 3d transform tests to offscreen canvas
Bug: 1140535 Change-Id: I62d979b9786ccc38232c862f82441521904abbcf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2898320 Commit-Queue: Aaron Krajeski <[email protected]> Reviewed-by: Yi Xu <[email protected]> Cr-Commit-Position: refs/heads/master@{#884001} NOKEYCHECK=True GitOrigin-RevId: 78c5db488044fdd8c671fa951847c6af5a01c061
- Loading branch information
1 parent
91d357f
commit c1683b1
Showing
25 changed files
with
846 additions
and
13 deletions.
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
...mations/2d.transformation.rotate3d.X.html → ...mations/2d.transformation.rotate3d.x.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...mations/2d.transformation.rotate3d.Y.html → ...mations/2d.transformation.rotate3d.y.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...mations/2d.transformation.rotate3d.Z.html → ...mations/2d.transformation.rotate3d.z.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...sts/external/wpt/html/canvas/offscreen/transformations/2d.transformation.perspective.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>OffscreenCanvas test: 2d.transformation.perspective</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/html/canvas/resources/canvas-tests.js"></script> | ||
|
||
<h1>2d.transformation.perspective</h1> | ||
<p class="desc">perspective() results in the correct transformation matrix</p> | ||
|
||
|
||
<script> | ||
var t = async_test("perspective() results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
const length = 100; | ||
ctx.perspective(length); | ||
const domMatrix = new DOMMatrix(); | ||
domMatrix.m34 = -1/length; | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()); | ||
ctx.rotateAxis(1, 2, 3, 4); | ||
domMatrix.rotateAxisAngleSelf(1, 2, 3, rad2deg(4)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()); | ||
t.done(); | ||
|
||
}); | ||
</script> |
30 changes: 30 additions & 0 deletions
30
...xternal/wpt/html/canvas/offscreen/transformations/2d.transformation.perspective.worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. | ||
// OffscreenCanvas test in a worker:2d.transformation.perspective | ||
// Description:perspective() results in the correct transformation matrix | ||
// Note: | ||
|
||
importScripts("/resources/testharness.js"); | ||
importScripts("/html/canvas/resources/canvas-tests.js"); | ||
|
||
var t = async_test("perspective() results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
const length = 100; | ||
ctx.perspective(length); | ||
const domMatrix = new DOMMatrix(); | ||
domMatrix.m34 = -1/length; | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()); | ||
ctx.rotateAxis(1, 2, 3, 4); | ||
domMatrix.rotateAxisAngleSelf(1, 2, 3, rad2deg(4)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()); | ||
t.done(); | ||
|
||
}); | ||
done(); |
37 changes: 37 additions & 0 deletions
37
..._tests/external/wpt/html/canvas/offscreen/transformations/2d.transformation.rotate3d.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>OffscreenCanvas test: 2d.transformation.rotate3d</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/html/canvas/resources/canvas-tests.js"></script> | ||
|
||
<h1>2d.transformation.rotate3d</h1> | ||
<p class="desc">rotate3d() results in the correct transformation matrix</p> | ||
|
||
|
||
<script> | ||
var t = async_test("rotate3d() results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
// angles are in radians, test something that is not a multiple of pi | ||
const angleX = 2; | ||
const angleY = 3; | ||
const angleZ = 4; | ||
const domMatrix = new DOMMatrix(); | ||
ctx.rotate3d(angleX, angleY, angleZ); | ||
domMatrix.rotateSelf(rad2deg(angleX), rad2deg(angleY), rad2deg(angleZ)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()); | ||
ctx.rotate3d(angleX, angleY, angleZ); | ||
domMatrix.rotateSelf(rad2deg(angleX), rad2deg(angleY), rad2deg(angleZ)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()); | ||
t.done(); | ||
|
||
}); | ||
</script> |
33 changes: 33 additions & 0 deletions
33
...s/external/wpt/html/canvas/offscreen/transformations/2d.transformation.rotate3d.worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. | ||
// OffscreenCanvas test in a worker:2d.transformation.rotate3d | ||
// Description:rotate3d() results in the correct transformation matrix | ||
// Note: | ||
|
||
importScripts("/resources/testharness.js"); | ||
importScripts("/html/canvas/resources/canvas-tests.js"); | ||
|
||
var t = async_test("rotate3d() results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
// angles are in radians, test something that is not a multiple of pi | ||
const angleX = 2; | ||
const angleY = 3; | ||
const angleZ = 4; | ||
const domMatrix = new DOMMatrix(); | ||
ctx.rotate3d(angleX, angleY, angleZ); | ||
domMatrix.rotateSelf(rad2deg(angleX), rad2deg(angleY), rad2deg(angleZ)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()); | ||
ctx.rotate3d(angleX, angleY, angleZ); | ||
domMatrix.rotateSelf(rad2deg(angleX), rad2deg(angleY), rad2deg(angleZ)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()); | ||
t.done(); | ||
|
||
}); | ||
done(); |
35 changes: 35 additions & 0 deletions
35
...ests/external/wpt/html/canvas/offscreen/transformations/2d.transformation.rotate3d.x.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>OffscreenCanvas test: 2d.transformation.rotate3d.x</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/html/canvas/resources/canvas-tests.js"></script> | ||
|
||
<h1>2d.transformation.rotate3d.x</h1> | ||
<p class="desc">rotate3d() around the x axis results in the correct transformation matrix</p> | ||
|
||
|
||
<script> | ||
var t = async_test("rotate3d() around the x axis results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
// angles are in radians, test something that is not a multiple of pi | ||
const angle = 2; | ||
const domMatrix = new DOMMatrix(); | ||
ctx.rotate3d(angle, 0, 0); | ||
domMatrix.rotateAxisAngleSelf(1, 0, 0, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
ctx.rotate3d(angle, 0, 0); | ||
domMatrix.rotateAxisAngleSelf(1, 0, 0, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
t.done(); | ||
|
||
}); | ||
</script> |
31 changes: 31 additions & 0 deletions
31
...external/wpt/html/canvas/offscreen/transformations/2d.transformation.rotate3d.x.worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. | ||
// OffscreenCanvas test in a worker:2d.transformation.rotate3d.x | ||
// Description:rotate3d() around the x axis results in the correct transformation matrix | ||
// Note: | ||
|
||
importScripts("/resources/testharness.js"); | ||
importScripts("/html/canvas/resources/canvas-tests.js"); | ||
|
||
var t = async_test("rotate3d() around the x axis results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
// angles are in radians, test something that is not a multiple of pi | ||
const angle = 2; | ||
const domMatrix = new DOMMatrix(); | ||
ctx.rotate3d(angle, 0, 0); | ||
domMatrix.rotateAxisAngleSelf(1, 0, 0, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
ctx.rotate3d(angle, 0, 0); | ||
domMatrix.rotateAxisAngleSelf(1, 0, 0, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
t.done(); | ||
|
||
}); | ||
done(); |
35 changes: 35 additions & 0 deletions
35
...ests/external/wpt/html/canvas/offscreen/transformations/2d.transformation.rotate3d.y.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>OffscreenCanvas test: 2d.transformation.rotate3d.y</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/html/canvas/resources/canvas-tests.js"></script> | ||
|
||
<h1>2d.transformation.rotate3d.y</h1> | ||
<p class="desc">rotate3d() around the y axis results in the correct transformation matrix</p> | ||
|
||
|
||
<script> | ||
var t = async_test("rotate3d() around the y axis results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
// angles are in radians, test something that is not a multiple of pi | ||
const angle = 2; | ||
const domMatrix = new DOMMatrix(); | ||
ctx.rotate3d(0, angle, 0); | ||
domMatrix.rotateAxisAngleSelf(0, 1, 0, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
ctx.rotate3d(0, angle, 0); | ||
domMatrix.rotateAxisAngleSelf(0, 1, 0, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
t.done(); | ||
|
||
}); | ||
</script> |
31 changes: 31 additions & 0 deletions
31
...external/wpt/html/canvas/offscreen/transformations/2d.transformation.rotate3d.y.worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. | ||
// OffscreenCanvas test in a worker:2d.transformation.rotate3d.y | ||
// Description:rotate3d() around the y axis results in the correct transformation matrix | ||
// Note: | ||
|
||
importScripts("/resources/testharness.js"); | ||
importScripts("/html/canvas/resources/canvas-tests.js"); | ||
|
||
var t = async_test("rotate3d() around the y axis results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
// angles are in radians, test something that is not a multiple of pi | ||
const angle = 2; | ||
const domMatrix = new DOMMatrix(); | ||
ctx.rotate3d(0, angle, 0); | ||
domMatrix.rotateAxisAngleSelf(0, 1, 0, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
ctx.rotate3d(0, angle, 0); | ||
domMatrix.rotateAxisAngleSelf(0, 1, 0, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
t.done(); | ||
|
||
}); | ||
done(); |
35 changes: 35 additions & 0 deletions
35
...ests/external/wpt/html/canvas/offscreen/transformations/2d.transformation.rotate3d.z.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> | ||
<title>OffscreenCanvas test: 2d.transformation.rotate3d.z</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/html/canvas/resources/canvas-tests.js"></script> | ||
|
||
<h1>2d.transformation.rotate3d.z</h1> | ||
<p class="desc">rotate3d() around the z axis results in the correct transformation matrix</p> | ||
|
||
|
||
<script> | ||
var t = async_test("rotate3d() around the z axis results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
// angles are in radians, test something that is not a multiple of pi | ||
const angle = 2; | ||
const domMatrix = new DOMMatrix(); | ||
ctx.rotate3d(0, 0, angle); | ||
domMatrix.rotateAxisAngleSelf(0, 0, 1, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
ctx.rotate3d(0, 0, angle); | ||
domMatrix.rotateAxisAngleSelf(0, 0, 1, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
t.done(); | ||
|
||
}); | ||
</script> |
31 changes: 31 additions & 0 deletions
31
...external/wpt/html/canvas/offscreen/transformations/2d.transformation.rotate3d.z.worker.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. | ||
// OffscreenCanvas test in a worker:2d.transformation.rotate3d.z | ||
// Description:rotate3d() around the z axis results in the correct transformation matrix | ||
// Note: | ||
|
||
importScripts("/resources/testharness.js"); | ||
importScripts("/html/canvas/resources/canvas-tests.js"); | ||
|
||
var t = async_test("rotate3d() around the z axis results in the correct transformation matrix"); | ||
var t_pass = t.done.bind(t); | ||
var t_fail = t.step_func(function(reason) { | ||
throw reason; | ||
}); | ||
t.step(function() { | ||
|
||
var offscreenCanvas = new OffscreenCanvas(100, 50); | ||
var ctx = offscreenCanvas.getContext('2d'); | ||
|
||
// angles are in radians, test something that is not a multiple of pi | ||
const angle = 2; | ||
const domMatrix = new DOMMatrix(); | ||
ctx.rotate3d(0, 0, angle); | ||
domMatrix.rotateAxisAngleSelf(0, 0, 1, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
ctx.rotate3d(0, 0, angle); | ||
domMatrix.rotateAxisAngleSelf(0, 0, 1, rad2deg(angle)); | ||
_assertMatricesApproxEqual(domMatrix, ctx.getTransform()) | ||
t.done(); | ||
|
||
}); | ||
done(); |
Oops, something went wrong.