-
Notifications
You must be signed in to change notification settings - Fork 0
/
materials_screenshot_results.html
80 lines (73 loc) · 2.38 KB
/
materials_screenshot_results.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
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Doc Screenshot Results</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="http://huddle.github.io/Resemble.js/resemble.js" charset="utf-8"></script>
<style>
img {
padding-left: 50px;
display: inline-block;
vertical-alignment: middle;
height: 262px;
width: 420px;
}
.test_screenshot {
width: 50%;
float: left;
}
.expected_screenshot {
width: 50%;
float: right;
}
.title {
text-align: center;
margin: 5px 0 5px 0;
}
.result_container {
border-style: solid;
border-width: 1px;
border-color: darkblue;
background-color: orange;
/*margin: 2px;*/
}
.screenshots {
padding: 10px;
height: 300px;
}
</style>
</head>
<body>
<h2>Materials Screenshots</h2>
<div class = "container">
</div>
<script>
$(function () {
var $container = $('.container');
var $result, $resultInner;
var $container_result;
var $screenshots;
var screenshot_dir = './test_screenshots/';
var expected_screenshot_dir = './expected_screenshots/';
var file_extension = '.png';
var i;
var resembleControl;
$.ajax({
url: screenshot_dir,
success: function (data) {
//list all .png files in the page
$(data).find("a").attr("href", function (i, val) {
if (val.match(/\.(jpe?g|png|gif)$/)) {
$result = $('<div class="result_container">').appendTo($container);
$result.append("<div class='title'>"+val+"</div>");
resembleControl = resemble(expected_screenshot_dir +val).compareTo(screenshot_dir + val).onComplete(function(data){});
$screenshots = $result.append("<div class = 'screenshots'><div class='test_screenshot'><img src='" + screenshot_dir + val + "'></div><div class='expected_screenshot'><img src='"+expected_screenshot_dir +val+"'</div></div>");
}
});
}
});
})
</script>
</body>
</html>