https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 48a297bef34d2dea675d8df8c65f69f551405cb1 authored by Anne van Kesteren on 05 February 2018, 15:48:20 UTC
semicolons for everyone
Tip revision: 48a297b
2d.state.saverestore.shadowColor.worker.js
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.state.saverestore.shadowColor
// Description:save()/restore() works for shadowColor
// Note:

importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");

var t = async_test("save()/restore() works for shadowColor");
t.step(function() {

var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');

// Test that restore() undoes any modifications
var old = ctx.shadowColor;
ctx.save();
ctx.shadowColor = "#ff0000";
ctx.restore();
_assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old");

// Also test that save() doesn't modify the values
ctx.shadowColor = "#ff0000";
old = ctx.shadowColor;
    // we're not interested in failures caused by get(set(x)) != x (e.g.
    // from rounding), so compare against 'old' instead of against "#ff0000"
ctx.save();
_assertSame(ctx.shadowColor, old, "ctx.shadowColor", "old");
ctx.restore();

t.done();

});
done();
back to top