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
diff --git a/tools/skdiff_main.cpp b/tools/skdiff_main.cpp
index 61fd83b..cf83be8 100644
--- a/tools/skdiff_main.cpp
+++ b/tools/skdiff_main.cpp
@@ -931,6 +931,7 @@
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_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 @@
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 @@
}
}
- 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 + ' ';\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 @@
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 @@
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();
}