Skip to content

Commit

Permalink
Extend canvas getContextAttributes WPTest
Browse files Browse the repository at this point in the history
This CL extend the WPTest for Canvas getContextAttributes to include
the |desynchronized|.

This CL covers the flag WPT test extension mentioned in
whatwg/html#4360 (which addressed
whatwg/html#4087).

Bug: 944199, 945835
Change-Id: Ibb339c66014d7579023f75c7f2cef99e3f03d351
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1538491
Reviewed-by: Fernando Serboncini <fserb@chromium.org>
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#644332}
  • Loading branch information
yell0wd0g authored and Marcos Cáceres committed Jul 23, 2019
1 parent cf9d833 commit 548c7f3
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions 2dcontext/context-attributes/getContextAttributes.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,31 @@
var testScenarios = [
{testDescription: "Test default context creation attributes",
canvasContextAttributes: {},
expectedContextAttributes: {alpha : true}},
expectedContextAttributes: {alpha : true, desynchronized: false}},
{testDescription: "Test context creation attributes alpha: true",
canvasContextAttributes: {alpha: true},
expectedContextAttributes: {alpha : true}},
{testDescription: "Test context creation attributes alpha: false",
canvasContextAttributes: {alpha: false},
expectedContextAttributes: {alpha : false}},
{testDescription: "Test context creation attributes desynchronized: false",
canvasContextAttributes: {desynchronized: false},
expectedContextAttributes: {desynchronized : false}},
];

function runTestScenario(testScenario) {
var t = test(function() {
var canvas = document. createElement('canvas');
var ctx = canvas.getContext('2d', testScenario.canvasContextAttributes);
var contextAttributes = ctx.getContextAttributes();
assert_equals(contextAttributes.alpha,
testScenario.expectedContextAttributes.alpha);
if (testScenario.expectedContextAttributes.alpha !== undefined) {
assert_equals(contextAttributes.alpha,
testScenario.expectedContextAttributes.alpha);
}
if (testScenario.expectedContextAttributes.desynchronized !== undefined) {
assert_equals(contextAttributes.desynchronized,
testScenario.expectedContextAttributes.desynchronized);
}
}, testScenario.testDescription);
}

Expand Down

0 comments on commit 548c7f3

Please sign in to comment.