forked from PencilCode/jquery-turtle
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathimg.html
More file actions
43 lines (43 loc) · 1.02 KB
/
img.html
File metadata and controls
43 lines (43 loc) · 1.02 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
<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>
<style>
#qunit { position: absolute; opacity: 0.5; }
img { vertical-align: top; }
</style>
<body>
<img class="apple" src="http://pencilcode.net/img/apple">
<div id="qunit"></div>
<script>
eval($.turtle());
module("Image turtle test.");
asyncTest("Uses an IMG tag as a turtle.", function() {
speed(100);
var t = img('tree');
var m = $('img.apple');
t.pen(blue, 10);
t.bk(200);
m.pen(red, 10);
m.bk(300);
sync(t, m);
m.plan(function() {
var offset = $('body').offset();
moveto({
pageX: m.width() / 2 + offset.left,
pageY: m.height() / 2 + offset.top
});
plan(function() {
ok(touches(red));
moveto({
pageX: t.width() / 2 + m.width() + offset.left,
pageY: t.height() / 2 + offset.top + 200
});
plan(function() {
ok(touches(blue));
start();
});
});
});
});
</script>