Update skpdiff to include a name with each file.
authordjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 16 Oct 2013 15:00:11 +0000 (15:00 +0000)
committerdjsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 16 Oct 2013 15:00:11 +0000 (15:00 +0000)
R=caryclark@google.com

Review URL: https://codereview.chromium.org/27512002

git-svn-id: http://skia.googlecode.com/svn/trunk@11808 2bbb7eff-a529-9590-31e7-b0007b416f81

tools/skpdiff/SkDiffContext.cpp
tools/skpdiff/viewer.html
tools/skpdiff/viewer_style.css

index f551ff350809c7fab0cb590c1c150ec304f5221c..88941cab0f2e207ca074e18f4f9259a6faabab01 100644 (file)
@@ -167,6 +167,20 @@ void SkDiffContext::outputRecords(SkWStream& stream, bool useJSONP) {
             SkString baselineAbsPath = get_absolute_path(currentRecord->fBaselinePath);
             SkString testAbsPath = get_absolute_path(currentRecord->fTestPath);
 
+            // strip off directory structure and find the common part of the filename
+            SkString baseName = SkOSPath::SkBasename(baselineAbsPath.c_str());
+            SkString testName = SkOSPath::SkBasename(testAbsPath.c_str());
+            for (size_t x = 0; x < baseName.size(); ++x) {
+                if (baseName[x] != testName[x]) {
+                    baseName.insertUnichar(x, '\n');
+                    break;
+                }
+            }
+
+            stream.writeText("            \"commonName\": \"");
+            stream.writeText(baseName.c_str());
+            stream.writeText("\",\n");
+
             stream.writeText("            \"baselinePath\": \"");
             stream.writeText(baselineAbsPath.c_str());
             stream.writeText("\",\n");
index f4b8fd7fc9b392dc79267e0ee2f1422d4d83b1ae..1d3793bbf5f6cfd6b347d5af674f3322ace36d72 100644 (file)
@@ -33,6 +33,7 @@
           <thead>
             <tr>
               <td ng-show="isDynamic">Rebaseline?</td>
+              <td>Name</td>
               <td>Expected Image</td>
               <td>Actual Image</td>
               <td>Results</td>
@@ -51,6 +52,7 @@
                        ng-click="selectedRebaseline($index, $event)"
                        ng-class="{lastselected: lastSelectedIndex == $index}" />
               </td>
+              <td class="common-name">{{ record.commonName }}</td>
               <td>
                 <swap-img left-src="{{ record.baselinePath }}"
                           right-src="{{ record.testPath }}"
index e172667061296b00a6f94893a1c0a23be968381c..1e4420fe850ca8dfc1622a1d9f8d136ec0663767 100644 (file)
@@ -5,7 +5,7 @@ body, img, div {
 }
 
 table {
-    width:100%;
+    width: auto;
     border-collapse: collapse;
     border-spacing: 0;
     padding: 8px;
@@ -13,7 +13,7 @@ table {
 
 td {
     border-top: 1px solid #DDD;
-    padding: 8px;
+    padding: 16px;
 }
 thead > tr > td {
     border: none;
@@ -73,6 +73,11 @@ input[type="checkbox"].lastselected {
     background: -webkit-linear-gradient(top, #96c56f 0%,#a9db80 100%);
 }
 
+.common-name {
+    vertical-align: top;
+}
+
+
 .gm-image {
     border: 1px dotted black;
 }