[iOS] Need a test for bug #145539: Uploading an animated GIF from the
authorjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Sep 2015 00:58:37 +0000 (00:58 +0000)
committerjhoneycutt@apple.com <jhoneycutt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Sep 2015 00:58:37 +0000 (00:58 +0000)
photo library uploads a JPEG
https://bugs.webkit.org/show_bug.cgi?id=148849

Reviewed by Daniel Bates.

* ManualTests/ios/image-file-uploads-as-original-type.html: Added.
On the Mac, file upload tests use EventSender::beginDragWithFiles. This
functionality doesn't exist on iOS, so we'll add a manual test.
This tests that the first few bytes of the selected file are "GIF".

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189410 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
ManualTests/ios/image-file-uploads-as-original-type.html [new file with mode: 0644]

index 2a587bc..3309764 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2015-09-04  Jon Honeycutt  <jhoneycutt@apple.com>
+
+        [iOS] Need a test for bug #145539: Uploading an animated GIF from the
+        photo library uploads a JPEG
+        https://bugs.webkit.org/show_bug.cgi?id=148849
+
+        Reviewed by Daniel Bates.
+
+        * ManualTests/ios/image-file-uploads-as-original-type.html: Added.
+        On the Mac, file upload tests use EventSender::beginDragWithFiles. This
+        functionality doesn't exist on iOS, so we'll add a manual test.
+        This tests that the first few bytes of the selected file are "GIF".
+
 2015-09-04  Carlos Alberto Lopez Perez  <clopez@igalia.com>
 
         Follow-up patch for r189343.
 2015-09-04  Carlos Alberto Lopez Perez  <clopez@igalia.com>
 
         Follow-up patch for r189343.
diff --git a/ManualTests/ios/image-file-uploads-as-original-type.html b/ManualTests/ios/image-file-uploads-as-original-type.html
new file mode 100644 (file)
index 0000000..fbbe8c5
--- /dev/null
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script>
+            const GIFSignature = "GIF89a";
+
+            function runTest(fileControl) {
+                var reader = new FileReader();
+                reader.onload = function(e) {
+                    var arrayBuffer = reader.result;
+                    if (!arrayBuffer || arrayBuffer.byteLength < GIFSignature.length) {
+                        document.getElementById("console").textContent = "TEST FAILED. Failed to get array buffer for file.";
+                        return;
+                    }
+                    var view = new Uint8Array(arrayBuffer, 0, GIFSignature.length);
+                    var signature = Array.prototype.map.call(view, function(value) { return String.fromCharCode(value); }).join('');
+                    if (signature !== GIFSignature) {
+                        document.getElementById("console").textContent = "TEST FAILED. File was not of correct type.";
+                        return;
+                    }
+                    document.getElementById("console").textContent = "TEST PASSED";
+                }
+                reader.readAsArrayBuffer(fileControl.files[0]);
+            }
+        </script>
+    </head>
+    <body>
+        <div>
+            This is a test for Bug #<a href="http://trac.webkit.org/changeset/185241">185241</a>: [iOS] Uploading an animated GIF from the photo library uploads a JPEG.
+            <br><br>
+            This test should be run on iOS. If the test passes, TEST PASSED will appear below.
+            <br><br>
+            <div id="console">Waiting on test to complete...</div>
+            <br><br>
+        </div>
+        <div>
+            Long-press on this image, and save it to your photo library:
+            <img src="../resources/non-animated.gif">
+        </div>
+        <br>
+        <div>
+            Tap "Choose File," and select the image from your photo library:
+            <input type="file" onchange="runTest(this)">
+        </div>
+    </body>
+</html>