mirror of
https://github.com/servo/servo.git
synced 2025-07-10 17:03:40 +01:00
43 lines
1.7 KiB
HTML
43 lines
1.7 KiB
HTML
<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, 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();
|
|
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);
|
|
}
|
|
|
|
function runAllTests() {
|
|
for (var i = 0; i < testScenarios.length; i++)
|
|
runTestScenario(testScenarios[i]);
|
|
}
|
|
|
|
runAllTests();
|
|
</script>
|