summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/offscreen/layers/2d.layer.invalid-calls.save-beginLayer-restore.worker.js
blob: 711280a6de4b806a25a2f98c59d1570a08bc26e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py.
// OffscreenCanvas test in a worker:2d.layer.invalid-calls.save-beginLayer-restore
// Description:Raises exception on save() + beginLayer() + restore().
// Note:

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

test(t => {
  var canvas = new OffscreenCanvas(100, 50);
  var ctx = canvas.getContext('2d');

  assert_throws_dom("INVALID_STATE_ERR", function() {
    ctx.save();
    ctx.beginLayer();
    ctx.restore();
  });
}, "Raises exception on save() + beginLayer() + restore().");
done();