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
This commit is contained in:
daserge 2016-03-21 12:54:07 +03:00
parent 0cd962466d
commit fb871d40e2
4 changed files with 20 additions and 12 deletions

View File

@ -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

View File

@ -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);

View File

@ -5,7 +5,7 @@
"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'"

View File

@ -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();