You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by da...@apache.org on 2016/03/21 11:02:53 UTC

cordova-plugin-camera git commit: CB-10865 Run ios native tests on Travis

Repository: cordova-plugin-camera
Updated Branches:
  refs/heads/master 0cd962466 -> fb871d40e


CB-10865 Run ios native tests on Travis

Updated cordova-ios tests dependency version to latest published
Changed the tests to reflect the current scaling behavior
Fixed a typo in manual test img.onloadend -> img.onload


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

Branch: refs/heads/master
Commit: fb871d40e2076c11a34a224479dbd2ff3c27358b
Parents: 0cd9624
Author: daserge <v-...@microsoft.com>
Authored: Mon Mar 21 12:54:07 2016 +0300
Committer: daserge <v-...@microsoft.com>
Committed: Mon Mar 21 12:54:07 2016 +0300

----------------------------------------------------------------------
 .travis.yml                                        |  6 +++++-
 .../CDVCameraTest/CDVCameraLibTests/CameraTest.m   | 17 ++++++++++-------
 tests/ios/package.json                             |  6 +++---
 tests/tests.js                                     |  3 ++-
 4 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/fb871d40/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index b9af4c5..93e7dd6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,8 @@
-language: node_js
+language: objective-c
 sudo: false
 node_js:
   - "4.2"
+env:
+  - TEST_DIR=.
+  - TEST_DIR=./tests/ios
+script: cd $TEST_DIR && npm install && npm test

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/fb871d40/tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
----------------------------------------------------------------------
diff --git a/tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m b/tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
index d1da2fa..b9439d1 100644
--- a/tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
+++ b/tests/ios/CDVCameraTest/CDVCameraLibTests/CameraTest.m
@@ -21,9 +21,6 @@
 #import <XCTest/XCTest.h>
 #import "CDVCamera.h"
 #import "UIImage+CropScaleOrientation.h"
-#import <Cordova/NSArray+Comparisons.h>
-#import <Cordova/NSData+Base64.h>
-#import <Cordova/NSDictionary+Extensions.h>
 #import <MobileCoreServices/UTCoreTypes.h>
 
 
@@ -291,12 +288,14 @@
     
     // test 640x480
     
-    targetSize = CGSizeMake(640, 480);
+    targetSize = CGSizeMake(480, 640);
     
     targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
     XCTAssertEqual(targetImage.size.width, targetSize.width);
     XCTAssertEqual(targetImage.size.height, targetSize.height);
-    
+
+    targetSize = CGSizeMake(640, 480);
+
     targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
     XCTAssertEqual(targetImage.size.width, targetSize.width);
     XCTAssertEqual(targetImage.size.height, targetSize.height);
@@ -304,24 +303,28 @@
     
     // test 800x600
     
-    targetSize = CGSizeMake(800, 600);
+    targetSize = CGSizeMake(600, 800);
     
     targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
     XCTAssertEqual(targetImage.size.width, targetSize.width);
     XCTAssertEqual(targetImage.size.height, targetSize.height);
     
+    targetSize = CGSizeMake(800, 600);
+
     targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
     XCTAssertEqual(targetImage.size.width, targetSize.width);
     XCTAssertEqual(targetImage.size.height, targetSize.height);
     
     // test 1024x768
     
-    targetSize = CGSizeMake(1024, 768);
+    targetSize = CGSizeMake(768, 1024);
     
     targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
     XCTAssertEqual(targetImage.size.width, targetSize.width);
     XCTAssertEqual(targetImage.size.height, targetSize.height);
     
+    targetSize = CGSizeMake(1024, 768);
+
     targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
     XCTAssertEqual(targetImage.size.width, targetSize.width);
     XCTAssertEqual(targetImage.size.height, targetSize.height);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/fb871d40/tests/ios/package.json
----------------------------------------------------------------------
diff --git a/tests/ios/package.json b/tests/ios/package.json
index 84bd9ec..4b9486f 100644
--- a/tests/ios/package.json
+++ b/tests/ios/package.json
@@ -5,9 +5,9 @@
     "author": "Apache Software Foundation",
     "license": "Apache Version 2.0",
     "dependencies": {
-        "cordova-ios": "^3.7.0"
+        "cordova-ios": "*"
     },
     "scripts": {
         "test": "xcodebuild -scheme CordovaLib && xcodebuild test -scheme CDVCameraLibTests -destination 'platform=iOS Simulator,name=iPhone 5'"
-    }    
-}
\ No newline at end of file
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-camera/blob/fb871d40/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index fd7bd6f..1513f14 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -125,7 +125,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         var img = document.getElementById('camera_image');
         var startTime = new Date();
         img.src = url;
-        img.onloadend = function () {
+        img.onload = function () {
+            log('Img size: ' + img.naturalWidth + 'x' + img.naturalHeight);
             log('Image tag load time: ' + (new Date() - startTime));
             if (callback) {
                 callback();


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