Changeset 220952 in webkit


Ignore:
Timestamp:
Aug 19, 2017 1:46:16 AM (7 years ago)
Author:
Wenson Hsieh
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):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r220947 r220952  
     12017-08-19  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        [iOS WK2] Add a version of DataInteractionTests.ExternalSourceAttributedStringToContentEditable that doesn't hit a debug assertion
     4        https://bugs.webkit.org/show_bug.cgi?id=175509
     5        <rdar://problem/33728169>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Removes ExternalSourceAttributedStringToContentEditable and adds
     10        ExternalSourceColoredAttributedStringToContentEditable, which tests dropping an attributed string with colored
     11        text instead of a bold attributed string of system font. Due to a recent change in behavior in UIKit, the
     12        original test (which this patch renames to ExternalSourceBoldSystemAttributedStringToContentEditable) hits a
     13        debug assertion when dropping text of system bold font. Since the original intent of this test was to verify
     14        that the attributed string UTI can be accepted in richly contenteditable areas, it suffices to check that some
     15        other style attribute, such as color, carries over from the NSAttributedString to the DOM.
     16
     17        Also marks ExternalSourceBoldSystemAttributedStringToContentEditable as disabled for the time being.
     18
     19        * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
     20        (TestWebKitAPI::TEST):
     21
    1222017-08-18  Ryan Haddad  <ryanhaddad@apple.com>
    223
  • trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm

    r220865 r220952  
    686686}
    687687
    688 TEST(DataInteractionTests, ExternalSourceAttributedStringToContentEditable)
     688TEST(DataInteractionTests, DISABLED_ExternalSourceBoldSystemAttributedStringToContentEditable)
    689689{
    690690    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     
    699699    [dataInteractionSimulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
    700700
     701    EXPECT_WK_STREQ("This is a test", [webView stringByEvaluatingJavaScript:@"editor.textContent"].UTF8String);
     702}
     703
     704TEST(DataInteractionTests, ExternalSourceColoredAttributedStringToContentEditable)
     705{
     706    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 320, 500)]);
     707    [webView synchronouslyLoadTestPageNamed:@"autofocus-contenteditable"];
     708    [webView stringByEvaluatingJavaScript:@"getSelection().removeAllRanges()"];
     709
     710    auto dataInteractionSimulator = adoptNS([[DataInteractionSimulator alloc] initWithWebView:webView.get()]);
     711    NSDictionary *textAttributes = @{ NSForegroundColorAttributeName: [UIColor redColor] };
     712    NSAttributedString *richText = [[NSAttributedString alloc] initWithString:@"This is a test" attributes:textAttributes];
     713    auto itemProvider = adoptNS([[UIItemProvider alloc] initWithObject:richText]);
     714    [dataInteractionSimulator setExternalItemProviders:@[ itemProvider.get() ]];
     715    [dataInteractionSimulator runFrom:CGPointMake(300, 400) to:CGPointMake(100, 300)];
     716
     717    EXPECT_WK_STREQ("rgb(255, 0, 0)", [webView stringByEvaluatingJavaScript:@"getComputedStyle(document.querySelector('p')).color"]);
    701718    EXPECT_WK_STREQ("This is a test", [webView stringByEvaluatingJavaScript:@"editor.textContent"].UTF8String);
    702719}
Note: See TracChangeset for help on using the changeset viewer.