-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdrawing_tests.html
75 lines (68 loc) · 2.78 KB
/
drawing_tests.html
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
<!DOCTYPE html>
<!-- Copyright 2017 Vincent Jacques <[email protected]> -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Drawing tests for DrawGrammar</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<style type="text/css">
canvas {
border: 1px solid black;
background-color: white;
}
.failure {
background-color: red;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3">
<form id="transformation_settings" style="display: none"></form>
<h1>Primary settings</h1>
<form id="primary_settings">
</form>
<h1>Secondary settings</h1>
<form id="secondary_settings">
</form>
</div>
<div class="col-sm-9">
<h1>Drawing tests</h1>
<div class="row" id="drawing_tests">
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g=" crossorigin="anonymous"></script>
<script src="_builds/4.07.1.DrawGrammar.dev_with_newest_versions/debug/default/src/draw_grammar_js.bc.js"></script>
<script src="docs/settings.js"></script>
<script>
function update() {
$("#drawing_tests").html("");
var transformation_settings = get_settings("#transformation_settings");
var primary_settings = get_settings("#primary_settings");
var secondary_settings = get_settings("#secondary_settings");
var test_html_template = '<div class="col-md-6 col-lg-4" id="{0}"><canvas class="img-fluid" width="50" height="50" /></div></div>';
for (var i = 1; i < drawing_tests.length; i++) {
var test = drawing_tests[i];
$("#drawing_tests").append(test_html_template.format(test.name));
var div = $(document.getElementById(test.name));
try {
test.draw_on_canvas(div.find("canvas").get(0), transformation_settings, primary_settings, secondary_settings);
} catch(err) {
div.append('<p class="failure">Exception: {0}</p>'.format(err))
}
}
}
$(document).ready(function() {
make_settings("#transformation_settings", DrawGrammar.transformation_settings_description);
make_settings("#primary_settings", DrawGrammar.primary_settings_description);
make_settings("#secondary_settings", DrawGrammar.secondary_settings_description);
update();
$("select").change(update);
})
</script>
</body>
</html>