Title: [227910] trunk/Tools
Revision
227910
Author
wenson_hs...@apple.com
Date
2018-01-31 11:17:56 -0800 (Wed, 31 Jan 2018)

Log Message

[iOS WK2] API test DataInteractionTests.ExternalSourceDataTransferItemGetFolderAsEntry is failing after an SDK update
https://bugs.webkit.org/show_bug.cgi?id=182339
<rdar://problem/36041396>

Reviewed by Andy Estes.

This API test wasn't meant to be dependent on the size of an image generated using UIImagePNGRepresentation().
To make this test robust against changes to image encoding, write the raw data to the test folder instead and
check against the length of the data written.

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

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (227909 => 227910)


--- trunk/Tools/ChangeLog	2018-01-31 19:14:51 UTC (rev 227909)
+++ trunk/Tools/ChangeLog	2018-01-31 19:17:56 UTC (rev 227910)
@@ -1,3 +1,20 @@
+2018-01-31  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [iOS WK2] API test DataInteractionTests.ExternalSourceDataTransferItemGetFolderAsEntry is failing after an SDK update
+        https://bugs.webkit.org/show_bug.cgi?id=182339
+        <rdar://problem/36041396>
+
+        Reviewed by Andy Estes.
+
+        This API test wasn't meant to be dependent on the size of an image generated using UIImagePNGRepresentation().
+        To make this test robust against changes to image encoding, write the raw data to the test folder instead and
+        check against the length of the data written.
+
+        * TestWebKitAPI/Tests/ios/DataInteractionTests.mm:
+        (testIconImageData):
+        (runTestWithTemporaryFolder):
+        (TestWebKitAPI::TEST):
+
 2018-01-31  Dan Bernstein  <m...@apple.com>
 
         [macOS] MiniBrowser isn’t app-sandboxed

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm (227909 => 227910)


--- trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2018-01-31 19:14:51 UTC (rev 227909)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/DataInteractionTests.mm	2018-01-31 19:17:56 UTC (rev 227910)
@@ -184,6 +184,11 @@
         NSLog(@"Expected JSON: %@ to match values: %@", jsonString, expected);
 }
 
+static NSData *testIconImageData()
+{
+    return [NSData dataWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"icon" withExtension:@"png" subdirectory:@"TestWebKitAPI.resources"]];
+}
+
 static void runTestWithTemporaryTextFile(void(^runTest)(NSURL *fileURL))
 {
     NSString *fileName = [NSString stringWithFormat:@"drag-drop-text-file-%@.txt", [NSUUID UUID].UUIDString];
@@ -212,7 +217,7 @@
     NSError *error = nil;
     NSFileManager *defaultManager = [NSFileManager defaultManager];
     [defaultManager createDirectoryAtURL:temporaryFolder.get() withIntermediateDirectories:NO attributes:nil error:&error];
-    [UIImagePNGRepresentation(testIconImage()) writeToURL:[temporaryFolder.get() URLByAppendingPathComponent:@"icon.png" isDirectory:NO] atomically:YES];
+    [testIconImageData() writeToURL:[temporaryFolder.get() URLByAppendingPathComponent:@"icon.png" isDirectory:NO] atomically:YES];
     [testZIPArchive() writeToURL:[temporaryFolder.get() URLByAppendingPathComponent:@"archive.zip" isDirectory:NO] atomically:YES];
 
     NSURL *firstSubdirectory = [temporaryFolder.get() URLByAppendingPathComponent:@"subdirectory1" isDirectory:YES];
@@ -1016,8 +1021,8 @@
         @"DIR: /somedirectory",
         @"DIR: /somedirectory/subdirectory1",
         @"DIR: /somedirectory/subdirectory2",
-        @"FILE: /somedirectory/archive.zip ('application/zip', 988 bytes)",
-        @"FILE: /somedirectory/icon.png ('image/png', 42130 bytes)",
+        [NSString stringWithFormat:@"FILE: /somedirectory/archive.zip ('application/zip', %tu bytes)", testZIPArchive().length],
+        [NSString stringWithFormat:@"FILE: /somedirectory/icon.png ('image/png', %tu bytes)", testIconImageData().length],
         @"FILE: /somedirectory/subdirectory1/text-file-1.txt ('text/plain', 43 bytes)",
         @"FILE: /somedirectory/subdirectory2/text-file-2.txt ('text/plain', 44 bytes)"
     ];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to