Made improvements to unit test website.
This commit is contained in:
parent
6a1ccc09cf
commit
3439af1d6a
10 changed files with 257 additions and 55 deletions
134
utils/tests/htdocs/js/autohide.js
Normal file
134
utils/tests/htdocs/js/autohide.js
Normal file
|
@ -0,0 +1,134 @@
|
|||
/**
|
||||
* Use to make long text to have short description and then on mouse over
|
||||
* show whole text over the page
|
||||
**/
|
||||
|
||||
var next_id = 1;
|
||||
|
||||
function make_hide_text(text, length, split_from_space, take_en)
|
||||
{
|
||||
var id = next_id++;
|
||||
var short_text;
|
||||
var split_text = text.split(' ');
|
||||
if (split_from_space)
|
||||
{
|
||||
short_text = "";
|
||||
|
||||
var i = 0;
|
||||
|
||||
while(i < split_text.length && short_text.length + split_text[i].length < length)
|
||||
{
|
||||
if (i>0)
|
||||
short_text += ' ';
|
||||
short_text += split_text[i];
|
||||
++i;
|
||||
}
|
||||
short_text = document.createTextNode(short_text);
|
||||
} else {
|
||||
var start=0;
|
||||
if (take_end)
|
||||
{
|
||||
start = text.length - length;
|
||||
if (start < 0)
|
||||
start =0;
|
||||
}
|
||||
short_text = document.createTextNode(text.substr(start,length));
|
||||
}
|
||||
text = text.split("\n");
|
||||
split_text = new Array();
|
||||
while(true)
|
||||
{
|
||||
split_text.push(document.createTextNode(text.shift()));
|
||||
if (text.length)
|
||||
{
|
||||
split_text.push(document.createElement('BR'));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Create short text element
|
||||
var new_elem = document.createElement('DIV');
|
||||
new_elem.id='autohide_' + id;
|
||||
new_elem.className="autohide";
|
||||
|
||||
// create full text element
|
||||
var elem_over = new_elem.cloneNode(true);
|
||||
elem_over.id='autohide_over_' + id;
|
||||
elem_over.onmouseout=autohide_mouseout;
|
||||
elem_over.style.visibility = 'hidden';
|
||||
for(var i = 0; i < split_text.length; ++i)
|
||||
{
|
||||
elem_over.appendChild(split_text[i]);
|
||||
}
|
||||
var target = document.getElementById('autohide');
|
||||
|
||||
// Fill short text element
|
||||
new_elem.appendChild(short_text);
|
||||
new_elem.onmouseover=autohide_mouseover;
|
||||
|
||||
// add elements to document
|
||||
target.parentNode.replaceChild(new_elem, target);
|
||||
new_elem.parentNode.appendChild(elem_over);
|
||||
// Make over element apear in same place
|
||||
elem_over.className="autohide_over";
|
||||
}
|
||||
|
||||
function getYpos(element)
|
||||
{
|
||||
if (!element.offsetParent)
|
||||
return element.offsetTop;
|
||||
else
|
||||
return element.offsetTop + getYpos(element.offsetParent);
|
||||
}
|
||||
|
||||
function getXpos(element)
|
||||
{
|
||||
if (!element.offsetParent)
|
||||
return element.offsetLeft;
|
||||
else
|
||||
return element.offsetLeft + getXpos(element.offsetParent);
|
||||
}
|
||||
|
||||
function autohide_mouseover(e)
|
||||
{
|
||||
var targ;
|
||||
if(!e) e = window.event;
|
||||
if (e.target) targ = e.target;
|
||||
else if (e.srcElement) targ = e.srcElement;
|
||||
if (targ.nodeType == 3) // defeat Safari bug
|
||||
targ = targ.parentNode;
|
||||
|
||||
|
||||
var over_id = new String(targ.id).replace('hide','hide_over');
|
||||
var over_elem = document.getElementById(over_id);
|
||||
over_elem.style.visibility='visible';
|
||||
var y_pos = getYpos(targ);
|
||||
var x_pos = getXpos(targ);
|
||||
var y_pos2 = y_pos + targ.scrollHeight;
|
||||
var x_pos2 = x_pos + targ.scrollWidth;
|
||||
y_pos = (y_pos+y_pos2)/2;
|
||||
x_pos = (x_pos+x_pos2)/2;
|
||||
|
||||
y_pos = y_pos - over_elem.scrollHeight/2;
|
||||
x_pos = x_pos - over_elem.scrollWidth/2;
|
||||
|
||||
over_elem.style.top = y_pos + 'px';
|
||||
over_elem.style.left = x_pos + 'px';
|
||||
targ.style.visibility='hidden';
|
||||
}
|
||||
|
||||
function autohide_mouseout(e)
|
||||
{
|
||||
var targ;
|
||||
if(!e) e = window.event;
|
||||
if (e.target) targ = e.target;
|
||||
else if (e.srcElement) targ = e.srcElement;
|
||||
if (targ.nodeType == 3) // defeat Safari bug
|
||||
targ = targ.parentNode;
|
||||
|
||||
targ.style.visibility='hidden';
|
||||
var orig_id = new String(targ.id).replace('_over','');
|
||||
var orig = document.getElementById(orig_id);
|
||||
// orig.onmouseover=autohide_mouseover;
|
||||
orig.style.visibility='visible';
|
||||
}
|
|
@ -1,6 +1,49 @@
|
|||
div.menu {
|
||||
float: left;
|
||||
position:absolute;
|
||||
margin-left: 3em;
|
||||
width: 7em;
|
||||
border: 1px solid #AAAAAA;
|
||||
};
|
||||
}
|
||||
|
||||
.unit_test h3 {
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
table.build {
|
||||
margin: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.build td {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.build .passed {
|
||||
color: #00FF00;
|
||||
}
|
||||
|
||||
.build .failed {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
|
||||
div.autohide_over {
|
||||
position: absolute;
|
||||
background:#FFFBF0 none repeat scroll 0 0;
|
||||
border: 1px solid #AAAAAA;
|
||||
padding: 0.5em;
|
||||
max-width: 30em;
|
||||
}
|
||||
|
||||
table.test_error {
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
}
|
||||
|
||||
.test_error .Error {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.test_error .Warning {
|
||||
color: #FF00FF;
|
||||
}
|
||||
|
|
|
@ -202,18 +202,21 @@ class Build {
|
|||
$build_result = '';
|
||||
if ($this->status == self::S_GOOD)
|
||||
{
|
||||
$build_result = $this->result->getResult();
|
||||
$build_result = "Build successed.";
|
||||
} else {
|
||||
$build_result = nl2br("Compilation failed:\n" . $this->error_msg);
|
||||
$build_result = "Build failed:\n" . $this->error_msg;
|
||||
}
|
||||
$build_result = str_replace("\n"," \\n",$build_result);
|
||||
|
||||
return array('build_result' => $build_result,
|
||||
'build_time' => $this->time,
|
||||
'build_error_msg' => $this->error_msg,
|
||||
'build_svn_rev' => $this->svn_version,
|
||||
'result_passed' => $this->result->getAssertionsPassed(),
|
||||
'result_failed' => $this->result->getAssertionsFailed(),
|
||||
'errors' => $this->getErrorStatistics());
|
||||
return array('build' => array('result' => $build_result,
|
||||
'time' => $this->time,
|
||||
'style' => ($this->status == self::S_GOOD?"passed":"failed"),
|
||||
'result_style' => $this->result->getResult(),
|
||||
'error_msg' => $this->error_msg,
|
||||
'svn_rev' => $this->svn_version,
|
||||
'result_passed' => $this->result->getAssertionsPassed(),
|
||||
'result_failed' => $this->result->getAssertionsFailed(),
|
||||
'errors' => $this->getErrorStatistics()));
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -20,7 +20,9 @@ class SVNUpdater {
|
|||
while(!$success && $tries--)
|
||||
{
|
||||
$svnlog = shell_exec('svn up 2>&1');
|
||||
echo $svnlog;
|
||||
global $db;
|
||||
if ($db->debug)
|
||||
echo $svnlog;
|
||||
$success = preg_match('/At revision ([0-9]*)\./m', $svnlog, $m);
|
||||
if (!$success)
|
||||
sleep(5);
|
||||
|
|
|
@ -10,6 +10,7 @@ class TestRunner {
|
|||
$binary_name = $build->getTestName();
|
||||
if ($binary_name === false)
|
||||
{
|
||||
trigger_error("No executeable name for tests");
|
||||
return;
|
||||
}
|
||||
$test_output = '<UnitTest>'.shell_exec("./$binary_name --log_format=XML --report_format=XML 2>&1").'</UnitTest>';
|
||||
|
@ -30,7 +31,8 @@ class TestRunner {
|
|||
|| !isset($xml->TestLog[0]) )
|
||||
{
|
||||
global $db;
|
||||
echo $test_output;
|
||||
if ($db->debug)
|
||||
echo $test_output;
|
||||
$db->FailTrans();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ class WesnothSmarty extends Smarty {
|
|||
$this->compile_dir = $work_dir . '/templates_c';
|
||||
$this->cache_dir = $work_dir . '/cache';
|
||||
$this->config_dir = $work_dir . '/configs';
|
||||
$this->plugins_dir[] = $work_dir . '/plugins';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
23
utils/tests/smarty_workdir/plugins/modifier.autohide.php
Normal file
23
utils/tests/smarty_workdir/plugins/modifier.autohide.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
function smarty_modifier_autohide($text, $min_length_to_hide, $split_from_space, $take_end = false)
|
||||
{
|
||||
if (mb_strlen($text) > $min_length_to_hide)
|
||||
{
|
||||
$split_from_space = $split_from_space?"true":"false";
|
||||
$take_end = $take_end?"true":"false";
|
||||
return "<div id='autohide'></div><script type='text/javascript'>
|
||||
/*<![CDATA[*/
|
||||
var text = '$text';
|
||||
var length = $min_length_to_hide;
|
||||
var split_from_space = $split_from_space;
|
||||
var take_end = $take_end;
|
||||
make_hide_text(text, length, split_from_space, take_end);
|
||||
/*]]>*/
|
||||
</script>";
|
||||
} else {
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -5,29 +5,17 @@
|
|||
|
||||
<div id="footer">
|
||||
<div id="note">
|
||||
<p><a href="http://www.wesnoth.org/wiki/Site_Map">Site map</a></p>
|
||||
<p><a href="http://www.wesnoth.org/wiki/Wesnoth:Copyrights">Copyright</a> © 2003-2008 The Battle for Wesnoth</p>
|
||||
<p><a href="http://wesnoth.wesnoth.org/wiki/Site_Map">Site map</a></p>
|
||||
<p><a href="http://wesnoth.wesnoth.org/wiki/Wesnoth:Copyrights">Copyright</a> © 2003-2008 The Battle for Wesnoth</p>
|
||||
<p>Supported by <a href="http://www.jexiste.fr/">Jexiste</a>.</p>
|
||||
|
||||
<p>Hosted by <a href="http://www.humhost.com"><img src="http://wesnoth.org/humhost-small2.gif" alt="Humhost web hosting" /></a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div> <!-- main -->
|
||||
|
||||
</div> <!-- global -->
|
||||
|
||||
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
_uacct = "UA-1872754-3";
|
||||
var tracker = _gat._getTracker(_uacct);
|
||||
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
urchinTracker();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
|
|
@ -9,11 +9,12 @@
|
|||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/xhtml; charset=utf-8" />
|
||||
<link rel="shortcut icon" type="image/png" href="http://www.wesnoth.org/mw/skins/glamdrol/ico.png" />
|
||||
<style type="text/css">@import url('http://www.wesnoth.org/mw/skins/glamdrol/main.css');</style>
|
||||
<style type="text/css">@import url('http://www.wesnoth.org/mw/skins/glamdrol/home.css');</style>
|
||||
<link rel="shortcut icon" type="image/png" href="http://wesnoth.wesnoth.org/mw/skins/glamdrol/ico.png" />
|
||||
<style type="text/css">@import url('http://wesnoth.wesnoth.org/mw/skins/glamdrol/main.css');</style>
|
||||
<style type="text/css">@import url('http://wesnoth.wesnoth.org/mw/skins/glamdrol/home.css');</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="styles/unit_test.css" />
|
||||
<style type="text/css">@import url('styles/unit_test.css');</style>
|
||||
<script src="js/autohide.js" type="text/javascript"></script>
|
||||
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title="news" href="http://feed43.com/wesnoth.xml" />
|
||||
|
@ -26,25 +27,24 @@
|
|||
|
||||
<div id="header">
|
||||
<div id="logo">
|
||||
<a href="home"><img alt="Wesnoth logo" src="http://www.wesnoth.org/mw/skins/glamdrol/wesnoth-logo.jpg" /></a>
|
||||
<a href="home"><img alt="Wesnoth logo" src="http://wesnoth.wesnoth.org/mw/skins/glamdrol/wesnoth-logo.jpg" /></a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="nav">
|
||||
<ul>
|
||||
<li><a href="http://www.wesnoth.org/">Home</a></li>
|
||||
<li><a href="http://www.wesnoth.org/wiki/Play">Play</a></li>
|
||||
<li><a href="http://www.wesnoth.org/wiki/Create">Create</a></li>
|
||||
<li><a href="http://www.wesnoth.org/forum/">Forums</a></li>
|
||||
<li><a href="http://wesnoth.wesnoth.org/">Home</a></li>
|
||||
<li><a href="http://wesnoth.wesnoth.org/wiki/Play">Play</a></li>
|
||||
<li><a href="http://wesnoth.wesnoth.org/wiki/Create">Create</a></li>
|
||||
<li><a href="http://wesnoth.wesnoth.org/forum/">Forums</a></li>
|
||||
|
||||
<li><a href="http://www.wesnoth.org/wiki/Support">Support</a></li>
|
||||
<li><a href="http://www.wesnoth.org/wiki/Project">Project</a></li>
|
||||
<li><a href="http://www.wesnoth.org/wiki/Credits">Credits</a></li>
|
||||
<li><a href="http://wesnoth.wesnoth.org/wiki/Support">Support</a></li>
|
||||
<li><a href="http://wesnoth.wesnoth.org/wiki/Project">Project</a></li>
|
||||
<li><a href="http://wesnoth.wesnoth.org/wiki/Credits">Credits</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
<div id="menu" class="menu">
|
||||
<table class="menu">
|
||||
<tr><td><a href="index.php">Status</a></td></tr>
|
||||
|
@ -52,3 +52,4 @@
|
|||
<tr><td><a href="index.php">Test Graphs</a></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="main" class="unit_test">
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
<table class="build_{$build_result}" border="1">
|
||||
<h3>The status from the latest build</h3>
|
||||
<table class="build" border="1">
|
||||
<tr>
|
||||
<th>The latest unit test build</th>
|
||||
<th>{$build_time|date_format:"%H:%M %b %e, %Y"}</th>
|
||||
<th>r{$build_svn_rev}</th>
|
||||
<th>{$build_result}</th>
|
||||
<th>{$result_passed}/{$result_passed+$result_failed}</th>
|
||||
<th>Time</th>
|
||||
<th>Revision</th>
|
||||
<th>Error message</th>
|
||||
<th>Passed/Total</th>
|
||||
</tr><tr>
|
||||
<td class="time">{$build.time|date_format:"%H:%M %b %e, %Y"}</td>
|
||||
<td class="revision {$build.style}">r{$build.svn_rev}</td>
|
||||
<td class="message">{$build.result|autohide:20:true}</td>
|
||||
<td class="testresult {$build.result_style}">{$build.result_passed}/{$build.result_passed+$build.result_failed}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
<br/>
|
||||
<h3>Errors in unit test in the latest build</h3>
|
||||
<table class="test_error" border="1">
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
|
@ -16,16 +21,16 @@
|
|||
<th>Last rev</th>
|
||||
<th>File</th>
|
||||
<th>Line</th>
|
||||
<th style="width:300">Message</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
{foreach from=$errors item=err}
|
||||
{foreach from=$build.errors item=err}
|
||||
<tr>
|
||||
<td>{$err.error_type}</td>
|
||||
<td>r{$err.start_version}</td>
|
||||
<td>r{$err.end_version}</td>
|
||||
<td>{$err.file}</td>
|
||||
<td class="{$err.error_type}">{$err.error_type}</td>
|
||||
<td class="{$err.error_type}">r{$err.start_version}</td>
|
||||
<td class="{$err.error_type}">r{$err.end_version}</td>
|
||||
<td>{$err.file|autohide:30:false:true}</td>
|
||||
<td>{$err.line}</td>
|
||||
<td>{$err.error_msg}</td>
|
||||
<td>{$err.error_msg|autohide:40:true}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
|
|
Loading…
Add table
Reference in a new issue