You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2016/12/08 00:57:16 UTC

[4/8] cordova-plugin-media-capture git commit: CB-11996 Added a new manual test to capture multiple images

CB-11996 Added a new manual test to capture multiple images


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/commit/cd7d40d5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/tree/cd7d40d5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/diff/cd7d40d5

Branch: refs/heads/1.4.x
Commit: cd7d40d5dc80755fb6798b839383cdae73bd01ab
Parents: 108c2ef
Author: Alexander Sorokin <al...@akvelon.com>
Authored: Tue Oct 11 18:53:39 2016 +0300
Committer: Alexander Sorokin <al...@akvelon.com>
Committed: Tue Oct 11 18:53:39 2016 +0300

----------------------------------------------------------------------
 tests/tests.js | 42 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 41 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture/blob/cd7d40d5/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index 7336b8a..c3177f4 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -156,6 +156,30 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         document.getElementById('camera_image').src = path;
     }
 
+    function captureImagesWin(mediaFiles) {
+        var path = mediaFiles[0].fullPath;
+        // Necessary since windows doesn't allow file URLs for <img> elements
+        if (cordova.platformId == 'windows' || cordova.platformId == 'windows8' || cordova.platformId === 'browser') {
+            path = mediaFiles[0].localURL;
+        }
+        var path2 = mediaFiles[1].fullPath;
+        // Necessary since windows doesn't allow file URLs for <img> elements
+        if (cordova.platformId == 'windows' || cordova.platformId == 'windows8' || cordova.platformId === 'browser') {
+            path = mediaFiles[1].localURL;
+        }
+        var path3 = mediaFiles[2].fullPath;
+        // Necessary since windows doesn't allow file URLs for <img> elements
+        if (cordova.platformId == 'windows' || cordova.platformId == 'windows8' || cordova.platformId === 'browser') {
+            path = mediaFiles[2].localURL;
+        }
+        log('Image captured: ' + path);
+        log('Image captured: ' + path2);
+        log('Image captured: ' + path3);
+        document.getElementById('camera_image').src = path;
+        document.getElementById('camera_image2').src = path2;
+        document.getElementById('camera_image3').src = path3;
+    }
+
     function captureImageFail(e) {
         log('Error getting image: ' + e.code);
     }
@@ -166,6 +190,12 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         navigator.device.capture.captureImage(captureImageWin, captureImageFail, options);
     }
 
+    function getImages() {
+        clearStatus();
+        var options = { limit: 3 };
+        navigator.device.capture.captureImage(captureImagesWin, captureImageFail, options);
+    }
+
     function captureVideoWin(mediaFiles) {
         var path = mediaFiles[0].fullPath;
         log('Video captured: ' + path);
@@ -231,18 +261,24 @@ exports.defineManualTests = function (contentEl, createActionButton) {
     function clearStatus() {
         document.getElementById('camera_status').innerHTML = '';
         document.getElementById('camera_image').src = 'about:blank';
+        document.getElementById('camera_image2').src = 'about:blank';
+        document.getElementById('camera_image3').src = 'about:blank';
     }
 
     /******************************************************************************/
 
     contentEl.innerHTML = '<div id="info" style="white-space: pre-wrap">' +
         '<b>Status:</b> <div id="camera_status"></div>' +
-        'img: <img width="100" id="camera_image">' +
+        'img1: <img width="100" id="camera_image">' +
+        'img2: <img width="100" id="camera_image2">' +
+        'img3: <img width="100" id="camera_image3">' +
         'video: <div id="video_container"></div>' +
         '</div><div id="audio"></div>' +
         'Expected result: Audio recorder will come up. Press record button to record for 10 seconds. Press Done. Status box will update with audio file and automatically play recording.' +
         '<p/> <div id="image"></div>' +
         'Expected result: Status box will update with image just taken.' +
+        '<p/> <div id="images"></div>' +
+        'Expected result: Status box will update with images just taken.' +
         '<p/> <div id="video"></div>' +
         'Expected result: Record 10 second video. Status box will update with video file that you can play.' +
         '<p/> <div id="video_and_resolve"></div>' +
@@ -256,6 +292,10 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         getImage();
     }, 'image');
 
+    createActionButton('Capture 3 images', function () {
+        getImages();
+    }, 'images');
+
     createActionButton('Capture 10 sec of video', function () {
         getVideo();
     }, 'video');


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org