[ros-diffs] [cfinck] 437: - Show the total sum of all executed and failed tests also in the Compare dialog, so that it's included in the comparison to the next result - Shorten some variable names for consistence

cfinck at svn.reactos.org cfinck at svn.reactos.org
Fri Jun 19 01:07:43 CEST 2009


Author: cfinck
Date: Fri Jun 19 03:07:42 2009
New Revision: 437

URL: http://svn.reactos.org/svn/reactos?rev=437&view=rev
Log:
- Show the total sum of all executed and failed tests also in the Compare dialog, so that it's included in the comparison to the next result
- Shorten some variable names for consistence

Modified:
    branches/danny-web/www/www.reactos.org/testman/compare.php
    branches/danny-web/www/www.reactos.org/testman/css/compare.css
    branches/danny-web/www/www.reactos.org/testman/js/compare.js.php
    branches/danny-web/www/www.reactos.org/testman/lang/de.inc.php
    branches/danny-web/www/www.reactos.org/testman/lang/en.inc.php
    branches/danny-web/www/www.reactos.org/testman/lang/pl.inc.php

Modified: branches/danny-web/www/www.reactos.org/testman/compare.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/testman/compare.php?rev=437&r1=436&r2=437&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/testman/compare.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/testman/compare.php [iso-8859-1] Fri Jun 19 03:07:42 2009
@@ -18,18 +18,21 @@
 	require_once("lang/$lang.inc.php");
 	
 	
-	function GetDifference(&$current_result_row, &$prev_result_row, $subject)
+	function GetDifference(&$current_row, &$prev_row, $subject)
 	{
 		// Return   ("" is not possible because of IE...) if
-		//  - we have nothing to compare
+		//  - we have no previous array to compare with
+		//  - we have both arrays, but not the values for both of them
 		//  - both values are identical
-		if(!$prev_result_row["id"] ||
-		   $current_result_row[$subject] == $prev_result_row[$subject])
+		if(!$prev_row ||
+		   !array_key_exists($subject, $current_row) ||
+		   !array_key_exists($subject, $prev_row) ||
+		   $current_row[$subject] == $prev_row[$subject])
 		{
 			return " ";
 		}
 		
-		$diff = $current_result_row[$subject] - $prev_result_row[$subject];
+		$diff = $current_row[$subject] - $prev_row[$subject];
 		
 		if($diff > 0)
 			return "(+$diff)";
@@ -131,6 +134,57 @@
 	$suite_ids = $stmt->fetchAll(PDO::FETCH_COLUMN);
 	$suite_idlist = implode(",", $suite_ids);
 	
+	// Add the table and fill in the table head part
+	echo '<table id="comparetable" class="datatable" cellspacing="0" cellpadding="0">';
+	echo '<thead><tr class="head">';
+	printf('<th class="TestSuite">%s</th>', $testman_langres["testsuite"]);
+	
+	$stmt = $dbh->prepare(
+		"SELECT UNIX_TIMESTAMP(r.timestamp) timestamp, a.name, r.revision, r.platform " .
+		"FROM " . DB_TESTMAN . ".winetest_runs r " .
+		"JOIN " . DB_ROSCMS . ".roscms_accounts a ON r.user_id = a.id " .
+		"WHERE r.id = :id"
+	);
+	
+	for($i = 0; $i < count($id_array); $i++)
+	{
+		$stmt->bindParam(":id", $id_array[$i]);
+		$stmt->execute() or die("Query failed #2");
+		$row = $stmt->fetch(PDO::FETCH_ASSOC);
+		
+		echo '<th onmousedown="ResultHead_OnMouseDown(this)">';
+		printf($testman_langres["resulthead"], $row["revision"], GetDateString($row["timestamp"]), $row["name"], GetPlatformString($row["platform"]));
+		echo '</th>';
+	}
+	
+	echo '</tr></thead>';
+	echo '<tbody>';
+	
+	// Get the total numbers
+	echo   '<tr class="even">';
+	printf('<td id="totals" onmouseover="Cell_OnMouseOver(this)" onmouseout="Cell_OnMouseOut(this)">%s</td>', $testman_langres["totals"]);
+	
+	$stmt = $dbh->prepare("SELECT r.count, r.failures FROM " . DB_TESTMAN . ".winetest_runs r WHERE r.id = :id");
+	$prev_row = null;
+	
+	for($i = 0; $i < count($id_array); $i++)
+	{
+		$stmt->bindParam(":id", $id_array[$i]);
+		$stmt->execute() or die("Query failed #3");
+		$row = $stmt->fetch(PDO::FETCH_ASSOC);
+		
+		echo '<td onmouseover="Cell_OnMouseOver(this)" onmouseout="Cell_OnMouseOut(this)">';
+		printf('<div title="%s" class="box totaltests totals">%s <span class="diff">%s</span></div>', $testman_langres["totaltests"], $row["count"], GetDifference($row, $prev_row, "count"));
+		printf('<div title="%s" class="box %s_failedtests totals">%d <span class="diff">%s</span></div>', $testman_langres["failedtests"], ($row["failures"] > 0 ? 'real' : 'zero'), $row["failures"], GetDifference($row, $prev_row, "failures"));
+		echo '</td>';
+		
+		$prev_row = $row;
+	}
+	
+	// Add an empty separation row
+	echo '</tr>';
+	echo '<tr class="separator"></tr>';
+	
 	// Get the test results for each column
 	$result_stmt = array();
 	
@@ -144,36 +198,8 @@
 			"ORDER BY s.module, s.test"
 		);
 		$result_stmt[$i]->bindParam(":testid", $id_array[$i]);
-		$result_stmt[$i]->execute() or die("Query failed #2 for statement $i");
-	}
-	
-	echo '<table id="comparetable" class="datatable" cellspacing="0" cellpadding="0">';
-	echo '<thead><tr class="head">';
-	printf('<th class="TestSuite">%s</th>', $testman_langres["testsuite"]);
-	
-	$stmt = $dbh->prepare(
-		"SELECT UNIX_TIMESTAMP(r.timestamp) timestamp, a.name, r.revision, r.platform " .
-		"FROM " . DB_TESTMAN . ".winetest_runs r " .
-		"JOIN " . DB_ROSCMS . ".roscms_accounts a ON r.user_id = a.id " .
-		"WHERE r.id = :id"
-	);
-	
-	for($i = 0; $i < count($id_array); $i++)
-	{
-		$stmt->bindParam(":id", $id_array[$i]);
-		$stmt->execute() or die("Query failed #3");
-		$row = $stmt->fetch(PDO::FETCH_ASSOC);
-		
-		echo '<th onmousedown="ResultHead_OnMouseDown(this)">';
-		printf($testman_langres["resulthead"], $row["revision"], GetDateString($row["timestamp"]), $row["name"], GetPlatformString($row["platform"]));
-		echo '</th>';
-	}
-	
-	echo '</tr></thead>';
-	echo '<tbody>';
-	
-	$oddeven = false;
-	$unchanged = array();
+		$result_stmt[$i]->execute() or die("Query failed #4 for statement $i");
+	}
 	
 	// Get all test suites for which we have at least one result in our ID list
 	$stmt = $dbh->query(
@@ -182,7 +208,10 @@
 		"JOIN " . DB_TESTMAN . ".winetest_results e ON e.suite_id = s.id " .
 		"WHERE test_id IN (" . $_GET["ids"] . ") " .
 		"ORDER BY s.module ASC, s.test ASC"
-	) or die("Query failed #3");
+	) or die("Query failed #5");
+	
+	$oddeven = true;
+	$unchanged = array();
 	
 	while($suites_row = $stmt->fetch(PDO::FETCH_ASSOC))
 	{
@@ -190,32 +219,32 @@
 		printf('<td onmouseover="Cell_OnMouseOver(this)" onmouseout="Cell_OnMouseOut(this)">%s:%s</td>', $suites_row["module"], $suites_row["test"]);
 		
 		$changed = false;
-		$prev_result_row = null;
+		$prev_row = null;
 		$temp_totaltests = -1;
 		$temp_failedtests = -1;
 		$temp_skippedtests = -1;
 		
 		for($i = 0; $i < count($result_stmt); $i++)
 		{
-			$result_row = $result_stmt[$i]->fetch(PDO::FETCH_ASSOC);
+			$row = $result_stmt[$i]->fetch(PDO::FETCH_ASSOC);
 			
 			echo '<td onmouseover="Cell_OnMouseOver(this)" onmouseout="Cell_OnMouseOut(this)"';
 			
-			if($result_row["id"])
-				printf(' class="clickable" onclick="Result_OnClick(%d)"', $result_row["id"]);
+			if($row["id"])
+				printf(' class="clickable" onclick="Result_OnClick(%d)"', $row["id"]);
 			
 			echo '>';
 			
 			// Check whether there are any changes within the test results of several runs
-			CheckIfChanged($changed, $temp_totaltests, $result_row["count"]);
-			CheckIfChanged($changed, $temp_failedtests, $result_row["failures"]);
-			CheckIfChanged($changed, $temp_skippedtests, $result_row["skipped"]);
-			
-			if($result_row["id"])
+			CheckIfChanged($changed, $temp_totaltests, $row["count"]);
+			CheckIfChanged($changed, $temp_failedtests, $row["failures"]);
+			CheckIfChanged($changed, $temp_skippedtests, $row["skipped"]);
+			
+			if($row["id"])
 			{
-				printf('<div title="%s" class="box totaltests">%s <span class="diff">%s</span></div>', $testman_langres["totaltests"], GetTotalTestsString($result_row), GetDifference($result_row, $prev_result_row, "count"));
-				printf('<div title="%s" class="box %s_failedtests">%d <span class="diff">%s</span></div>', $testman_langres["failedtests"], (($result_row["failures"] > 0 || $result_row["status"] != "ok") ? 'real' : 'zero'), $result_row["failures"], GetDifference($result_row, $prev_result_row, "failures"));
-				printf('<div title="%s" class="box skippedtests">%d <span class="diff">%s</span></div>', $testman_langres["skippedtests"], $result_row["skipped"], GetDifference($result_row, $prev_result_row, "skipped"));
+				printf('<div title="%s" class="box totaltests">%s <span class="diff">%s</span></div>', $testman_langres["totaltests"], GetTotalTestsString($row), GetDifference($row, $prev_row, "count"));
+				printf('<div title="%s" class="box %s_failedtests">%d <span class="diff">%s</span></div>', $testman_langres["failedtests"], (($row["failures"] > 0 || $row["status"] != "ok") ? 'real' : 'zero'), $row["failures"], GetDifference($row, $prev_row, "failures"));
+				printf('<div title="%s" class="box skippedtests">%d <span class="diff">%s</span></div>', $testman_langres["skippedtests"], $row["skipped"], GetDifference($row, $prev_row, "skipped"));
 			}
 			else
 			{
@@ -225,7 +254,7 @@
 			
 			echo '</td>';
 			
-			$prev_result_row = $result_row;
+			$prev_row = $row;
 		}
 		
 		echo '</tr>';
@@ -242,10 +271,7 @@
 	echo "<script type=\"text/javascript\">\n";
 	echo "//<![CDATA[\n";
 	echo "var UnchangedRows = Array(";
-	
-	// Cut the last comma from the string
 	echo implode(",", $unchanged);
-	
 	echo ");\n";
 	echo "//]]>\n";
 	echo "</script>";

Modified: branches/danny-web/www/www.reactos.org/testman/css/compare.css
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/testman/css/compare.css?rev=437&r1=436&r2=437&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/testman/css/compare.css [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/testman/css/compare.css [iso-8859-1] Fri Jun 19 03:07:42 2009
@@ -80,6 +80,10 @@
 	width: 200px;
 }
 
+#comparetable td#totals {
+	font-weight: bold;
+}
+
 #comparetable td, #comparetable td div.box {
 	border-right: solid 1px #BBBBBB;
 	border-bottom: solid 1px #BBBBBB;
@@ -103,3 +107,11 @@
 	font-weight: bold;
 	width: 130px;
 }
+
+#comparetable td div.totals {
+	width: 163.5px;
+}
+
+#comparetable tr.separator {
+	height: 10px;
+}

Modified: branches/danny-web/www/www.reactos.org/testman/js/compare.js.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/testman/js/compare.js.php?rev=437&r1=436&r2=437&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/testman/js/compare.js.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/testman/js/compare.js.php [iso-8859-1] Fri Jun 19 03:07:42 2009
@@ -80,6 +80,10 @@
 		// Remove all difference data in this case as there is no previous element
 		for(var i = 0; i < trs.length; i++)
 		{
+			// Ignore empty rows (like separator rows)
+			if(!trs[i].childNodes.length)
+				continue;
+			
 			var divs = trs[i].childNodes[Index].getElementsByTagName("div");
 			
 			for(var j = 0; j < divs.length; j++)
@@ -95,6 +99,10 @@
 	// No, then add the difference data accordingly
 	for(var i = 0; i < trs.length; i++)
 	{
+		// Ignore empty rows (like separator rows)
+		if(!trs[i].childNodes.length)
+			continue;
+		
 		// We can only add difference data if the current table and the previous one contain result data
 		if(trs[i].childNodes[Index].firstChild.nodeName != "DIV" || trs[i].childNodes[Index - 1].firstChild.nodeName != "DIV")
 			continue;
@@ -262,7 +270,8 @@
 			var tbody_trs = document.getElementById("comparetable").childNodes[1].childNodes;
 			
 			for(var i = 0; i < tbody_trs.length; i++)
-				SwapElements(tbody_trs[i].childNodes[DragColumnIndex], tbody_trs[i].childNodes[SwapColumnIndex]);
+				if(tbody_trs[i].childNodes.length)
+					SwapElements(tbody_trs[i].childNodes[DragColumnIndex], tbody_trs[i].childNodes[SwapColumnIndex]);
 			
 			AddDifferenceForColumn(DragColumn);
 			AddDifferenceForColumn(SwapColumn);

Modified: branches/danny-web/www/www.reactos.org/testman/lang/de.inc.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/testman/lang/de.inc.php?rev=437&r1=436&r2=437&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/testman/lang/de.inc.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/testman/lang/de.inc.php [iso-8859-1] Fri Jun 19 03:07:42 2009
@@ -40,14 +40,15 @@
 		"showchanged" => "Nur geänderte Ergebnisse anzeigen",
 		
 		"legend" => "Legende",
-		"totaltests" => "Alle Tests",
+		"totaltests" => "Ausgeführte Tests",
 		"failedtests" => "Fehlgeschlagene Tests",
 		"skippedtests" => "Ãœbersprungene Tests",
 		"difference" => "Unterschied zum vorherigen Ergebnis",
 		
 		"testsuite" => "Test Suite",
 		"resulthead" => "Revision %d<br />am %s<br />von %s<br />unter %s",
-		
+		"totals" => "Gesamtzahlen",
+
 		// Result Details page
 		"detail_title" => "Ergebnis-Details",
 		

Modified: branches/danny-web/www/www.reactos.org/testman/lang/en.inc.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/testman/lang/en.inc.php?rev=437&r1=436&r2=437&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/testman/lang/en.inc.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/testman/lang/en.inc.php [iso-8859-1] Fri Jun 19 03:07:42 2009
@@ -47,7 +47,8 @@
 		
 		"testsuite" => "Test Suite",
 		"resulthead" => "Revision %d<br />at %s<br />by %s<br />under %s",
-		
+		"totals" => "Totals",
+
 		// Result Details page
 		"detail_title" => "Result Details",
 		

Modified: branches/danny-web/www/www.reactos.org/testman/lang/pl.inc.php
URL: http://svn.reactos.org/svn/reactos/branches/danny-web/www/www.reactos.org/testman/lang/pl.inc.php?rev=437&r1=436&r2=437&view=diff
==============================================================================
--- branches/danny-web/www/www.reactos.org/testman/lang/pl.inc.php [iso-8859-1] (original)
+++ branches/danny-web/www/www.reactos.org/testman/lang/pl.inc.php [iso-8859-1] Fri Jun 19 03:07:42 2009
@@ -48,6 +48,7 @@
 		
 		"testsuite" => "Zestaw testów",
 		"resulthead" => "Rewizja %d<br />dnia %s<br />przez %s<br /> na %s",
+		"totals" => "ŁÄ
cznie",
 		
 		// Result Details page
 		"detail_title" => "Szczegóły wyniku",



More information about the Ros-diffs mailing list