Title: [288745] trunk/LayoutTests
Revision
288745
Author
[email protected]
Date
2022-01-28 10:09:24 -0800 (Fri, 28 Jan 2022)

Log Message

Add copy-to-clipboard button for fuzzy matching meta tag
https://bugs.webkit.org/show_bug.cgi?id=235665

Reviewed by Darin Adler.

* fast/harness/image-diff-template.html: Add button which cycles through different versions of
the fuzzy match string to allow for both absolute values and a range. Add a button that copies
that text and inserts into meta tag string prior to copying to clipboard.
* fast/harness/image-diff-template-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288744 => 288745)


--- trunk/LayoutTests/ChangeLog	2022-01-28 17:37:43 UTC (rev 288744)
+++ trunk/LayoutTests/ChangeLog	2022-01-28 18:09:24 UTC (rev 288745)
@@ -1,3 +1,15 @@
+2022-01-28  Jon Lee  <[email protected]>
+
+        Add copy-to-clipboard button for fuzzy matching meta tag
+        https://bugs.webkit.org/show_bug.cgi?id=235665
+
+        Reviewed by Darin Adler.
+
+        * fast/harness/image-diff-template.html: Add button which cycles through different versions of
+        the fuzzy match string to allow for both absolute values and a range. Add a button that copies
+        that text and inserts into meta tag string prior to copying to clipboard.
+        * fast/harness/image-diff-template-expected.txt:
+
 2022-01-28  Antoine Quint  <[email protected]>
 
         [WPT] Remove outdated Web Animations expectations

Modified: trunk/LayoutTests/fast/harness/image-diff-template-expected.txt (288744 => 288745)


--- trunk/LayoutTests/fast/harness/image-diff-template-expected.txt	2022-01-28 17:37:43 UTC (rev 288744)
+++ trunk/LayoutTests/fast/harness/image-diff-template-expected.txt	2022-01-28 18:09:24 UTC (rev 288745)
@@ -1,5 +1,7 @@
+CONSOLE MESSAGE: ReferenceError: Can't find variable: __FUZZY_DATA__
 Pixel difference:	__PIXEL_DIFF__
-Fuzzy match:	__FUZZY_DATA__
+Fuzzy match:	Click to toggle between ranges and values
+	
 Expected Image	Actual Image	Diff Image
 Animate:	Expected	Actual	Diff
 Loading...

Modified: trunk/LayoutTests/fast/harness/image-diff-template.html (288744 => 288745)


--- trunk/LayoutTests/fast/harness/image-diff-template.html	2022-01-28 17:37:43 UTC (rev 288744)
+++ trunk/LayoutTests/fast/harness/image-diff-template.html	2022-01-28 18:09:24 UTC (rev 288745)
@@ -65,7 +65,8 @@
     </tr>
     <tr class="pixel-diff __HIDE_FUZZY_CLASS__">
         <td>Fuzzy match:</td>
-        <td>__FUZZY_DATA__</td>
+        <td><span>Click to toggle between ranges and values</span><br/><input type="button" id="fuzzy-match-data" _onclick_="toggleFuzzyMatchString()"</td>
+        <td id="fuzzy-match-form" colspan=2><input type="button" value="Copy to clipboard as <meta> tag" _onclick_="copyToClipboardFuzzyMetaTag()" /></td>
     </tr>
     <tr>
         <td></td>
@@ -199,6 +200,30 @@
 
     showImage(data[order[currIndex]]);
 }
+
+function copyToClipboardFuzzyMetaTag() {
+    var metaTag = `<meta name="fuzzy" content="${document.getElementById("fuzzy-match-data").value}" />`;
+    navigator.clipboard.writeText(metaTag);
+
+    document.getElementById("fuzzy-match-form").append("Copied! ");
+}
+
+__FUZZY_DATA__;
+bitMaskForWhetherToUseRanges = -1;
+function toggleFuzzyMatchString() {
+    bitMaskForWhetherToUseRanges = (bitMaskForWhetherToUseRanges + 1) % 4;
+    var fuzzyMatchString = "maxDifference=";
+    if (bitMaskForWhetherToUseRanges & 0x2)
+        fuzzyMatchString += "0-";
+    fuzzyMatchString += `${maxDifference}; totalPixels=`;
+    if (bitMaskForWhetherToUseRanges & 0x1)
+        fuzzyMatchString += "0-";
+    fuzzyMatchString += totalPixels;
+
+    document.getElementById("fuzzy-match-data").value = fuzzyMatchString;
+}
+toggleFuzzyMatchString();
+
 </script>
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to