Title: [222685] trunk/LayoutTests
Revision
222685
Author
wenson_hs...@apple.com
Date
2017-09-30 16:33:09 -0700 (Sat, 30 Sep 2017)

Log Message

Add a layout test test that exercises setData and getData for non-normalized types
https://bugs.webkit.org/show_bug.cgi?id=177707

Reviewed by Darin Adler.

We have test coverage for getData and setData with non-normalized types on some of our bots where custom
pasteboard data is enabled by default, but this is not the case in EWS. This patch adds a copy and paste test
that exercises this codepath across all Cocoa platforms.

* editing/pasteboard/data-transfer-get-data-non-normalized-types-expected.txt: Added.
* editing/pasteboard/data-transfer-get-data-non-normalized-types.html: Added.
* platform/ios-simulator-wk1/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (222684 => 222685)


--- trunk/LayoutTests/ChangeLog	2017-09-30 22:50:16 UTC (rev 222684)
+++ trunk/LayoutTests/ChangeLog	2017-09-30 23:33:09 UTC (rev 222685)
@@ -1,3 +1,18 @@
+2017-09-30  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Add a layout test test that exercises setData and getData for non-normalized types
+        https://bugs.webkit.org/show_bug.cgi?id=177707
+
+        Reviewed by Darin Adler.
+
+        We have test coverage for getData and setData with non-normalized types on some of our bots where custom
+        pasteboard data is enabled by default, but this is not the case in EWS. This patch adds a copy and paste test
+        that exercises this codepath across all Cocoa platforms.
+
+        * editing/pasteboard/data-transfer-get-data-non-normalized-types-expected.txt: Added.
+        * editing/pasteboard/data-transfer-get-data-non-normalized-types.html: Added.
+        * platform/ios-simulator-wk1/TestExpectations:
+
 2017-09-30  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Unreviewed. Upgrade webkitgtk-test-fonts to version 0.0.7.

Added: trunk/LayoutTests/editing/pasteboard/data-transfer-get-data-non-normalized-types-expected.txt (0 => 222685)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-get-data-non-normalized-types-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-get-data-non-normalized-types-expected.txt	2017-09-30 23:33:09 UTC (rev 222685)
@@ -0,0 +1,12 @@
+Rich text
+{
+    "text/plain;": "",
+    "text/uri-list;": "http://www.apple.com/",
+    "text/html;": "<b style='color: green'></b>"
+}
+{
+    "Text": "",
+    "URL": "http://www.apple.com/",
+    "text/html;charset=utf-8": "<b style='color: green'></b>"
+}
+

Added: trunk/LayoutTests/editing/pasteboard/data-transfer-get-data-non-normalized-types.html (0 => 222685)


--- trunk/LayoutTests/editing/pasteboard/data-transfer-get-data-non-normalized-types.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/data-transfer-get-data-non-normalized-types.html	2017-09-30 23:33:09 UTC (rev 222685)
@@ -0,0 +1,87 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<html>
+<style>
+html, body {
+    margin: 0;
+    font-family: -apple-system;
+}
+
+#source, #destination {
+    width: 100%;
+    margin: 0;
+}
+
+#destination {
+    height: 1024px;
+}
+
+#source {
+    font-size: 150px;
+    white-space: nowrap;
+    height: 200px;
+}
+</style>
+<body>
+    <div id="source">Rich text</div>
+    <div id="destination" contenteditable></div>
+    <pre id="output"></pre>
+</body>
+<script>
+
+function handleCopy1(event) {
+    event.clipboardData.setData("Text", "");
+    event.clipboardData.setData("URL", "http://www.apple.com/");
+    event.clipboardData.setData("text/html;charset=utf-8", "<b style='color: green'></b>");
+    event.preventDefault();
+}
+
+function handleCopy2(event) {
+    event.clipboardData.setData("text/plain;", "");
+    event.clipboardData.setData("text/uri-list;", "http://www.apple.com/");
+    event.clipboardData.setData("text/html;", "<b style='color: green'></b>");
+    event.preventDefault();
+}
+
+function handlePaste1(event) {
+    output.textContent += JSON.stringify({
+        "text/plain;": event.clipboardData.getData("text/plain;"),
+        "text/uri-list;": event.clipboardData.getData("text/uri-list;"),
+        "text/html;": event.clipboardData.getData("text/html;")
+    }, null, "    ") + "\n";
+    event.preventDefault();
+}
+
+function handlePaste2(event) {
+    output.textContent += JSON.stringify({
+        "Text": event.clipboardData.getData("Text"),
+        "URL": event.clipboardData.getData("URL"),
+        "text/html;charset=utf-8": event.clipboardData.getData("text/html;charset=utf-8")
+    }, null, "    ") + "\n"
+    event.preventDefault();
+}
+
+getSelection().setBaseAndExtent(source, 0, source, 1);
+source.addEventListener("copy", handleCopy1);
+destination.addEventListener("paste", handlePaste1);
+
+if (window.testRunner && window.internals) {
+    internals.settings.setCustomPasteboardDataEnabled(true);
+    testRunner.dumpAsText();
+    testRunner.execCommand("Copy");
+    destination.focus();
+    testRunner.execCommand("Paste");
+    destination.blur();
+
+    source.removeEventListener("copy", handleCopy1);
+    source.addEventListener("copy", handleCopy2);
+    destination.removeEventListener("paste", handlePaste1);
+    destination.addEventListener("paste", handlePaste2);
+
+    getSelection().setBaseAndExtent(source, 0, source, 1);
+    testRunner.execCommand("Copy");
+    destination.focus();
+    testRunner.execCommand("Paste");
+}
+</script>
+</html>

Modified: trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations (222684 => 222685)


--- trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations	2017-09-30 22:50:16 UTC (rev 222684)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations	2017-09-30 23:33:09 UTC (rev 222685)
@@ -10,3 +10,4 @@
 editing/pasteboard/data-transfer-get-data-on-paste-custom.html [ Pass ]
 editing/pasteboard/data-transfer-get-data-on-paste-plain-text.html [ Pass ]
 editing/pasteboard/data-transfer-get-data-on-paste-rich-text.html [ Pass ]
+editing/pasteboard/data-transfer-get-data-non-normalized-types.html [ Pass ]
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to