summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-webkitLineDash.js
blob: c2d778a4b206b23d02cac9d7f5cf6148af236e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
description("Basic test for webkitLineDash and webkitLineDashOffset");

var canvas = document.createElement('canvas');
document.body.appendChild(canvas);
canvas.setAttribute('width', '700');
canvas.setAttribute('height', '700');
var ctx = canvas.getContext('2d');

// Verify default values.
shouldBe('ctx.webkitLineDashOffset', '0');

// Set dash-style.
ctx.webkitLineDash = [15, 10];
ctx.webkitLineDashOffset = 5;
ctx.strokeRect (10,10,100,100);

// Verify dash and offset.
var lineDash;
lineDash = ctx.webkitLineDash;
shouldBe('lineDash[0]', '15');
shouldBe('lineDash[1]', '10');
shouldBe('ctx.webkitLineDashOffset', '5');

// Verify that line dash offset persists after
// clearRect (which causes a save/restore of the context
// state to the stack).
ctx.clearRect(0, 0, 700, 700);
shouldBe('ctx.webkitLineDashOffset', '5');