Adding checkboxes to skdiff output so a user can select a subset of images to rebaseline.

BUG=745
Review URL: https://codereview.appspot.com/6497054

git-svn-id: http://skia.googlecode.com/svn/trunk@5360 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
jkleinert@google.com 2012-08-30 22:05:53 +00:00
parent d07cb0c037
commit ed01f12d13
2 changed files with 62 additions and 13 deletions

View File

@ -931,6 +931,7 @@ static void print_table_header (SkFILEWStream* stream,
bool doOutputDate=false) {
stream->writeText("<table>\n");
stream->writeText("<tr><th>");
stream->writeText("select image</th>\n<th>");
if (doOutputDate) {
SkTime::DateTime dt;
SkTime::GetDateTime(&dt);
@ -987,6 +988,13 @@ static void print_pixel_count (SkFILEWStream* stream,
*/
}
static void print_checkbox_cell (SkFILEWStream* stream,
const DiffRecord& diff) {
stream->writeText("<td><input type=\"checkbox\" name=\"");
stream->writeText(diff.fFilename.c_str());
stream->writeText("\" checked=\"yes\"></td>");
}
static void print_label_cell (SkFILEWStream* stream,
const DiffRecord& diff) {
char metricBuf [20];
@ -1067,6 +1075,7 @@ static void print_diff_with_missing_file(SkFILEWStream* stream,
DiffRecord& diff,
const SkString& relativePath) {
stream->writeText("<tr>\n");
print_checkbox_cell(stream, diff);
print_label_cell(stream, diff);
stream->writeText("<td>N/A</td>");
stream->writeText("<td>N/A</td>");
@ -1144,7 +1153,23 @@ static void print_diff_page (const int matchCount,
}
}
outputStream.writeText("<html>\n<body>\n");
outputStream.writeText(
"<html>\n<head>\n"
"<script src=\"https://ajax.googleapis.com/ajax/"
"libs/jquery/1.7.2/jquery.min.js\"></script>\n"
"<script type=\"text/javascript\">\n"
"function generateCheckedList() {\n"
"var boxes = $(\":checkbox:checked\");\n"
"var fileCmdLineString = '';\n"
"var fileMultiLineString = '';\n"
"for (var i = 0; i < boxes.length; i++) {\n"
"fileMultiLineString += boxes[i].name + '<br>';\n"
"fileCmdLineString += boxes[i].name + '&nbsp;';\n"
"}\n"
"$(\"#checkedList\").html(fileCmdLineString + "
"'<br><br>' + fileMultiLineString);\n"
"}\n"
"</script>\n</head>\n<body>\n");
print_table_header(&outputStream, matchCount, colorThreshold, differences,
baseDir, comparisonDir);
int i;
@ -1180,6 +1205,7 @@ static void print_diff_page (const int matchCount,
int height = compute_image_height(diff->fBaseHeight, diff->fBaseWidth);
outputStream.writeText("<tr>\n");
print_checkbox_cell(&outputStream, *diff);
print_label_cell(&outputStream, *diff);
print_image_cell(&outputStream,
filename_to_white_filename(diff->fFilename), height);
@ -1190,8 +1216,13 @@ static void print_diff_page (const int matchCount,
outputStream.writeText("</tr>\n");
outputStream.flush();
}
outputStream.writeText("</table>\n");
outputStream.writeText("</body>\n</html>\n");
outputStream.writeText(
"</table>\n"
"<input type=\"button\" "
"onclick=\"generateCheckedList()\" "
"value=\"Create Rebaseline List\">\n"
"<div id=\"checkedList\"></div>\n"
"</body>\n</html>\n");
outputStream.flush();
}

View File

@ -1,32 +1,50 @@
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
function generateCheckedList() {
var boxes = $(":checkbox:checked");
var fileCmdLineString = '';
var fileMultiLineString = '';
for (var i = 0; i < boxes.length; i++) {
fileMultiLineString += boxes[i].name + '<br>';
fileCmdLineString += boxes[i].name + '&nbsp;';
}
$("#checkedList").html(fileCmdLineString + '<br><br>' + fileMultiLineString);
}
</script>
</head>
<body>
<table>
<tr><th>3 of 12 images matched exactly.<br></th>
<tr><th>select image</th>
<th>3 of 12 images matched exactly.<br></th>
<th>every different pixel shown in white</th>
<th>color difference at each pixel</th>
<th>baseDir: tools/tests/skdiff/baseDir/</th>
<th>comparisonDir: tools/tests/skdiff/comparisonDir/</th>
</tr>
<tr>
<td><b>missing-files/missing-from-baseDir.png</b><br>Missing from baseDir</td><td>N/A</td><td>N/A</td><td>N/A</td><td><a href="../../../../../tools/tests/skdiff/comparisonDir/missing-files/missing-from-baseDir.png"><img src="../../../../../tools/tests/skdiff/comparisonDir/missing-files/missing-from-baseDir.png" height="240px"></a></td></tr>
<td><input type="checkbox" name="missing-files/missing-from-baseDir.png" checked="yes"></td><td><b>missing-files/missing-from-baseDir.png</b><br>Missing from baseDir</td><td>N/A</td><td>N/A</td><td>N/A</td><td><a href="../../../../../tools/tests/skdiff/comparisonDir/missing-files/missing-from-baseDir.png"><img src="../../../../../tools/tests/skdiff/comparisonDir/missing-files/missing-from-baseDir.png" height="240px"></a></td></tr>
<tr>
<td><b>missing-files/missing-from-baseDir.xyz</b><br>Missing from baseDir</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr>
<td><input type="checkbox" name="missing-files/missing-from-baseDir.xyz" checked="yes"></td><td><b>missing-files/missing-from-baseDir.xyz</b><br>Missing from baseDir</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr>
<tr>
<td><b>missing-files/missing-from-comparisonDir.png</b><br>Missing from comparisonDir</td><td>N/A</td><td>N/A</td><td><a href="../../../../../tools/tests/skdiff/baseDir/missing-files/missing-from-comparisonDir.png"><img src="../../../../../tools/tests/skdiff/baseDir/missing-files/missing-from-comparisonDir.png" height="240px"></a></td><td>N/A</td></tr>
<td><input type="checkbox" name="missing-files/missing-from-comparisonDir.png" checked="yes"></td><td><b>missing-files/missing-from-comparisonDir.png</b><br>Missing from comparisonDir</td><td>N/A</td><td>N/A</td><td><a href="../../../../../tools/tests/skdiff/baseDir/missing-files/missing-from-comparisonDir.png"><img src="../../../../../tools/tests/skdiff/baseDir/missing-files/missing-from-comparisonDir.png" height="240px"></a></td><td>N/A</td></tr>
<tr>
<td><b>missing-files/missing-from-comparisonDir.xyz</b><br>Missing from comparisonDir</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr>
<td><input type="checkbox" name="missing-files/missing-from-comparisonDir.xyz" checked="yes"></td><td><b>missing-files/missing-from-comparisonDir.xyz</b><br>Missing from comparisonDir</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr>
<tr>
<td><b>different-bits/different-bits-unknown-format.xyz</b><br>Files differ; unable to parse one or both files</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr>
<td><input type="checkbox" name="different-bits/different-bits-unknown-format.xyz" checked="yes"></td><td><b>different-bits/different-bits-unknown-format.xyz</b><br>Files differ; unable to parse one or both files</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr>
<tr>
<td><b>different-bits/slightly-different-sizes.png</b><br>Image sizes differ</td><td>N/A</td><td>N/A</td><td><a href="../../../../../tools/tests/skdiff/baseDir/different-bits/slightly-different-sizes.png"><img src="../../../../../tools/tests/skdiff/baseDir/different-bits/slightly-different-sizes.png" height="240px"></a></td><td><a href="../../../../../tools/tests/skdiff/comparisonDir/different-bits/slightly-different-sizes.png"><img src="../../../../../tools/tests/skdiff/comparisonDir/different-bits/slightly-different-sizes.png" height="240px"></a></td></tr>
<td><input type="checkbox" name="different-bits/slightly-different-sizes.png" checked="yes"></td><td><b>different-bits/slightly-different-sizes.png</b><br>Image sizes differ</td><td>N/A</td><td>N/A</td><td><a href="../../../../../tools/tests/skdiff/baseDir/different-bits/slightly-different-sizes.png"><img src="../../../../../tools/tests/skdiff/baseDir/different-bits/slightly-different-sizes.png" height="240px"></a></td><td><a href="../../../../../tools/tests/skdiff/comparisonDir/different-bits/slightly-different-sizes.png"><img src="../../../../../tools/tests/skdiff/comparisonDir/different-bits/slightly-different-sizes.png" height="240px"></a></td></tr>
<tr>
<td><b>different-bits/very-different-sizes.png</b><br>Image sizes differ</td><td>N/A</td><td>N/A</td><td><a href="../../../../../tools/tests/skdiff/baseDir/different-bits/very-different-sizes.png"><img src="../../../../../tools/tests/skdiff/baseDir/different-bits/very-different-sizes.png" height="240px"></a></td><td><a href="../../../../../tools/tests/skdiff/comparisonDir/different-bits/very-different-sizes.png"><img src="../../../../../tools/tests/skdiff/comparisonDir/different-bits/very-different-sizes.png" height="128px"></a></td></tr>
<td><input type="checkbox" name="different-bits/very-different-sizes.png" checked="yes"></td><td><b>different-bits/very-different-sizes.png</b><br>Image sizes differ</td><td>N/A</td><td>N/A</td><td><a href="../../../../../tools/tests/skdiff/baseDir/different-bits/very-different-sizes.png"><img src="../../../../../tools/tests/skdiff/baseDir/different-bits/very-different-sizes.png" height="240px"></a></td><td><a href="../../../../../tools/tests/skdiff/comparisonDir/different-bits/very-different-sizes.png"><img src="../../../../../tools/tests/skdiff/comparisonDir/different-bits/very-different-sizes.png" height="128px"></a></td></tr>
<tr>
<td><b>different-bits/very-different-pixels-same-size.png</b><br> 97.9926% of pixels differ
<td><input type="checkbox" name="different-bits/very-different-pixels-same-size.png" checked="yes"></td><td><b>different-bits/very-different-pixels-same-size.png</b><br> 97.9926% of pixels differ
( 42.8911% weighted)<br>Average color mismatch 89<br>Max color mismatch 239</td><td><a href="different-bits_very-different-pixels-same-size-white.png"><img src="different-bits_very-different-pixels-same-size-white.png" height="240px"></a></td><td><a href="different-bits_very-different-pixels-same-size-diff.png"><img src="different-bits_very-different-pixels-same-size-diff.png" height="240px"></a></td><td><a href="../../../../../tools/tests/skdiff/baseDir/different-bits/very-different-pixels-same-size.png"><img src="../../../../../tools/tests/skdiff/baseDir/different-bits/very-different-pixels-same-size.png" height="240px"></a></td><td><a href="../../../../../tools/tests/skdiff/comparisonDir/different-bits/very-different-pixels-same-size.png"><img src="../../../../../tools/tests/skdiff/comparisonDir/different-bits/very-different-pixels-same-size.png" height="240px"></a></td></tr>
<tr>
<td><b>different-bits/slightly-different-pixels-same-size.png</b><br> 0.6630% of pixels differ
<td><input type="checkbox" name="different-bits/slightly-different-pixels-same-size.png" checked="yes"></td><td><b>different-bits/slightly-different-pixels-same-size.png</b><br> 0.6630% of pixels differ
( 0.1904% weighted)<br>(2164 pixels)<br>Average color mismatch 0<br>Max color mismatch 213</td><td><a href="different-bits_slightly-different-pixels-same-size-white.png"><img src="different-bits_slightly-different-pixels-same-size-white.png" height="240px"></a></td><td><a href="different-bits_slightly-different-pixels-same-size-diff.png"><img src="different-bits_slightly-different-pixels-same-size-diff.png" height="240px"></a></td><td><a href="../../../../../tools/tests/skdiff/baseDir/different-bits/slightly-different-pixels-same-size.png"><img src="../../../../../tools/tests/skdiff/baseDir/different-bits/slightly-different-pixels-same-size.png" height="240px"></a></td><td><a href="../../../../../tools/tests/skdiff/comparisonDir/different-bits/slightly-different-pixels-same-size.png"><img src="../../../../../tools/tests/skdiff/comparisonDir/different-bits/slightly-different-pixels-same-size.png" height="240px"></a></td></tr>
</table>
<input type="button" onclick="generateCheckedList()" value="Create Rebaseline List">
<div id="checkedList"></div>
</body>
</html>