Title: [220952] trunk/Tools
Revision
220952
Author
[email protected]
Date
2017-08-19 01:46:16 -0700 (Sat, 19 Aug 2017)

Log Message

[iOS WK2] Add a version of DataInteractionTests.ExternalSourceAttributedStringToContentEditable that doesn't hit a debug assertion
https://bugs.webkit.org/show_bug.cgi?id=175509
<rdar://problem/33728169>

Reviewed by Ryosuke Niwa.

Removes ExternalSourceAttributedStringToContentEditable and adds
ExternalSourceColoredAttributedStringToContentEditable, which tests dropping an attributed string with colored
text instead of a bold attributed string of system font. Due to a recent change in behavior in UIKit, the
original test (which this patch renames to ExternalSourceBoldSystemAttributedStringToContentEditable) hits a
debug assertion when dropping text of system bold font. Since the original intent of this test was to verify
that the attributed string UTI can be accepted in richly contenteditable areas, it suffices to check that some
other style attribute, such as color, carries over from the NSAttributedString to the DOM.

Also marks ExternalSourceBoldSystemAttributedStringToContentEditable as disabled for the time being.

* TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (220951 => 220952)


--- trunk/Tools/ChangeLog	2017-08-19 06:40:30 UTC (rev 220951)
+++ trunk/Tools/ChangeLog	2017-08-19 08:46:16 UTC (rev 220952)
@@ -1,3 +1,24 @@
+2017-08-19  Wenson Hsieh  <[email protected]>
+
+        [iOS WK2] Add a version of DataInteractionTests.ExternalSourceAttributedStringToContentEditable that doesn't hit a debug assertion
+        https://bugs.webkit.org/show_bug.cgi?id=175509
+        <rdar://problem/33728169>
+
+        Reviewed by Ryosuke Niwa.
+
+        Removes ExternalSourceAttributedStringToContentEditable and adds
+        ExternalSourceColoredAttributedStringToContentEditable, which tests dropping an attributed string with colored
+        text instead of a bold attributed string of system font. Due to a recent change in behavior in UIKit, the
+        original test (which this patch renames to ExternalSourceBoldSystemAttributedStringToContentEditable) hits a
+        debug assertion when dropping text of system bold font. Since the original intent of this test was to verify
+        that the attributed string UTI can be accepted in richly contenteditable areas, it suffices to check that some
+        other style attribute, such as color, carries over from the NSAttributedString to the DOM.
+
+        Also marks ExternalSourceBoldSystemAttributedStringToContentEditable as disabled for the time being.
+
+        * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+        (TestWebKitAPI::TEST):
+
 2017-08-18  Ryan Haddad  <[email protected]>
 
         Unreviewed, rolling out r220938.

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (220951 => 220952)


--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2017-08-19 06:40:30 UTC (rev 220951)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2017-08-19 08:46:16 UTC (rev 220952)
@@ -685,7 +685,7 @@
     EXPECT_TRUE([webView stringByEvaluatingJavaScript:@"!!editor.querySelector('h1')"].boolValue);
 }
 
-TEST(DataInteractionTests, ExternalSourceAttributedStringToContentEditable)
+TEST(DataInteractionTests, DISABLED_ExternalSourceBoldSystemAttributedStringToContentEditable)
 {
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
@@ -701,6 +701,23 @@
     EXPECT_WK_STREQ("This is a test", [webView stringByEvaluatingJavaScript:@"editor.textContent"].UTF8String);
 }
 
+TEST(DataInteractionTests, ExternalSourceColoredAttributedStringToContentEditable)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
+    [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
+    [webView stringByEvaluatingJavaScript:@"getSelection().removeAllRanges()"];
+
+    auto dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
+    NSDictionary *textAttributes = @{ NSForegroundColorAttributeName: [UIColor redColor] };
+    NSAttributedString *richText = [[NSAttributedString alloc] initWithString:@"This is a test" attributes:textAttributes];
+    auto itemProvider = adoptNS([[UIItemProvider alloc] initWithObject:richText]);
+    [dataInteractionSimulator setExternalItemProviders:@[ itemProvider.get() ]];
+    [dataInteractionSimulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
+
+    EXPECT_WK_STREQ("rgb(255, 0, 0)", [webView stringByEvaluatingJavaScript:@"getComputedStyle(document.querySelector('p')).color"]);
+    EXPECT_WK_STREQ("This is a test", [webView stringByEvaluatingJavaScript:@"editor.textContent"].UTF8String);
+}
+
 TEST(DataInteractionTests, ExternalSourceMultipleURLsToContentEditable)
 {
     auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to