Skip to content

Commit

Permalink
Bug 1517920 [wpt PR 14727] - Add WPTest for CanvasRenderingContext2D.…
Browse files Browse the repository at this point in the history
…getContextAttributes(), a=testonly

Automatic update from web-platform-tests
Add WPTest for CanvasRenderingContext2D.getContextAttributes()

This CL adds a new WPTest for CanvasRenderingContext2D's
getContextAttributes(), see the bug for context.

Test: this a test exercised by all bots.
Bug: 919116, whatwg/html#2563
Change-Id: If60be98e1b885e14b4851a9a74c07ec77e63229e
Reviewed-on: https://chromium-review.googlesource.com/c/1395882
Reviewed-by: Fernando Serboncini <fserbchromium.org>
Commit-Queue: Miguel Casas <mcasaschromium.org>
Cr-Commit-Position: refs/heads/master{#620426}

--

wpt-commits: 9f48727d558874b48f5ea2bc1037bdb975524e5d
wpt-pr: 14727

UltraBlame original commit: 08e997fb760131c426d41f3b3f3af9446ed559e0
  • Loading branch information
marco-c committed Oct 3, 2019
1 parent 934d4b7 commit eefaa30
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>

var testScenarios = [
{testDescription: "Test default context creation attributes",
canvasContextAttributes: {},
expectedContextAttributes: {alpha : true}},
{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}},
];

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);
}, testScenario.testDescription);
}

function runAllTests() {
for (var i = 0; i < testScenarios.length; i++)
runTestScenario(testScenarios[i]);
}

runAllTests();
</script>

0 comments on commit eefaa30

Please sign in to comment.