forked from PencilCode/jquery-turtle
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfill.html
More file actions
110 lines (106 loc) · 2.25 KB
/
fill.html
File metadata and controls
110 lines (106 loc) · 2.25 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<script src="lib/qunit.js"></script>
<link href="lib/qunit.css" rel="stylesheet">
<script src="lib/jquery.js"></script>
<script src="../jquery-turtle.js"></script>
<body>
<div id="qunit" style="opacity:.2"></div>
<script>
eval($.turtle());
module("Fill test.");
asyncTest("Check both forms of fill.", function() {
var phantom = /PhantomJS/.test(navigator.userAgent);
speed(100);
pen(path);
for (var j= 0; j < 4; ++j) {
fd(100);
rt(90);
}
var style = {
strokeStyle: blue,
fillStyle: pink,
lineWidth: 30,
lineCap: 'butt',
lineJoin: 'bevel',
lineDash: '50 50',
lineDashOffset: 25,
}
if (phantom) {
// Phantom hangs on lineDash.
delete style.lineDash;
delete style.lineDashOffset;
}
fill(style);
jumpto(-50, 50);
lt(360, 50);
fill(green);
done(function() {
speed(Infinity);
jumpto(-50, 0);
ok(!touches(green));
jumpto(-50, 50);
ok(touches(green));
ok(touches(transparent));
jumpto(-100, 50);
ok(touches(green));
ok(!touches(transparent));
jumpto(-150, 50);
ok(touches(green));
ok(touches(transparent));
home();
ok(touches(blue));
ok(!touches(pink));
ok(!touches(transparent));
jumpto(0, 100);
ok(touches(blue));
ok(!touches(pink));
ok(!touches(transparent));
jumpto(100, 100);
ok(touches(blue));
ok(!touches(pink));
ok(!touches(transparent));
jumpto(100, 0);
ok(touches(blue));
ok(!touches(pink));
ok(!touches(transparent));
jumpto(-15, -15);
ok(!touches(blue));
ok(!touches(pink));
ok(touches(transparent));
jumpto(115, -15);
ok(!touches(blue));
ok(!touches(pink));
ok(touches(transparent));
jumpto(115, 115);
ok(!touches(blue));
ok(!touches(pink));
ok(touches(transparent));
jumpto(-15, 115);
ok(!touches(blue));
ok(!touches(pink));
ok(touches(transparent));
if (!phantom) {
jumpto(0, 50);
ok(!touches(blue));
ok(touches(pink));
ok(touches(transparent));
jumpto(50, 0);
ok(!touches(blue));
ok(touches(pink));
ok(touches(transparent));
jumpto(100, 50);
ok(!touches(blue));
ok(touches(pink));
ok(touches(transparent));
jumpto(50, 100);
ok(!touches(blue));
ok(touches(pink));
ok(touches(transparent));
}
jumpto(50, 50);
ok(!touches(blue));
ok(touches(pink));
ok(!touches(transparent));
start();
});
});
</script>