[moulette] switched to boost::signals2
[ozulis.git] / reports / basic.js
blob418feef1fce43dc6f6db940382d22082ee24d66f
1 var divIdCount = 0;
3 function nextId()
5 return "div"+divIdCount++;
8 function displayTable(data)
10 var i = 0;
12 document.write('<script type="text/javascript" src="basic.js"></script>' +
13 '<link href="report.css" rel="stylesheet" type="text/css">');
14 document.write("<div class='test-suite'>");
15 for (i in data) {
16 displayTest(data[i]);
18 document.write("</div>");
21 function console2html(out)
23 out = out.replace(/\u001b\[m/g, "</font><font color='white'>");
24 out = out.replace(/\u001b\[0;30m/g, "</font><font color='black'>");
25 out = out.replace(/\u001b\[0;31m/g, "</font><font color='#cc6666'>");
26 out = out.replace(/\u001b\[0;32m/g, "</font><font color='#33cc66'>");
27 out = out.replace(/\u001b\[0;33m/g, "</font><font color='#cc9933'>");
28 out = out.replace(/\u001b\[0;34m/g, "</font><font color='#3366cc'>");
29 out = out.replace(/\u001b\[0;35m/g, "</font><font color='#cc33cc'>");
30 out = out.replace(/\u001b\[0;36m/g, "</font><font color='#33cccc'>");
31 out = out.replace(/\u001b\[0;37m/g, "</font><font color='#cccccc'>");
32 out = out.replace(/\u001b\[0;38m/g, "</font><font color='#666666'>");
33 out = out.replace(/\u001b\[1;30m/g, "</font><font color='black'>");
34 out = out.replace(/\u001b\[1;31m/g, "</font><font color='#ff6666'>");
35 out = out.replace(/\u001b\[1;32m/g, "</font><font color='#66ff66'>");
36 out = out.replace(/\u001b\[1;33m/g, "</font><font color='#ffff66'>");
37 out = out.replace(/\u001b\[1;34m/g, "</font><font color='#6699ff'>");
38 out = out.replace(/\u001b\[1;35m/g, "</font><font color='#ff66ff'>");
39 out = out.replace(/\u001b\[1;36m/g, "</font><font color='#33ffff'>");
40 out = out.replace(/\u001b\[1;37m/g, "</font><font color='white'>");
41 out = out.replace(/\u001b\[1;38m/g, "</font><font color='grey'>");
42 return "<font color='white'>"+out+"</font>";
45 function displayTest(test)
47 var detailsId = nextId();
48 var childsId = nextId();
50 document.write("<div class='test'>");
51 if (test.succeed)
52 document.write("<font color='green'>");
53 else
54 document.write("<font color='red'>");
55 document.write("<a onclick='changeDisplayState(\""+childsId+"\")' style='cursor:pointer;'>"+test.name+"</a></font> <a onclick='changeDisplayState(\""+
56 detailsId+"\")' style='cursor:pointer;'>details</a><br/>");
57 document.write("<div id='"+detailsId+"' style='display:none' ><table>");
58 var prop;
59 for (prop in test.details)
61 var x;
63 if (prop == "stderr" || prop == 'stdout')
64 x = "<td style='background-color:black'><pre>"+console2html(test.details[prop])+"</pre></td>";
65 else
66 x = "<td><pre>"+test.details[prop]+"</pre></td>";
67 document.write("<tr><td>"+prop+"</td>"+x+"</tr>");
69 document.write("</table></div>");
70 if (test.tests != null)
72 var i = 0;
74 document.write("<div class='test-suite' id='"+childsId+"' class='childdiv'");
75 if (test.succeed)
76 document.write(" style='display:none'");
77 document.write(">");
78 for (i in test.tests) {
79 displayTest(test.tests[i]);
81 document.write("</div>");
83 document.write('</div>');
86 function changeDisplayState(id)
88 var div=document.getElementById(id);
89 if (div.style.display == 'none' ||
90 div.style.display == '') {
91 div.style.display = 'block';
92 } else {
93 div.style.display = 'none';