40 lines
1.0 KiB
HTML
40 lines
1.0 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
|
|
<html>
|
|
<head>
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
</head>
|
|
<body>
|
|
<script>
|
|
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');
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|