mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-03-03 21:32:53 +08:00
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:
parent
0cd962466d
commit
fb871d40e2
@ -1,4 +1,8 @@
|
|||||||
language: node_js
|
language: objective-c
|
||||||
sudo: false
|
sudo: false
|
||||||
node_js:
|
node_js:
|
||||||
- "4.2"
|
- "4.2"
|
||||||
|
env:
|
||||||
|
- TEST_DIR=.
|
||||||
|
- TEST_DIR=./tests/ios
|
||||||
|
script: cd $TEST_DIR && npm install && npm test
|
||||||
|
@ -21,9 +21,6 @@
|
|||||||
#import <XCTest/XCTest.h>
|
#import <XCTest/XCTest.h>
|
||||||
#import "CDVCamera.h"
|
#import "CDVCamera.h"
|
||||||
#import "UIImage+CropScaleOrientation.h"
|
#import "UIImage+CropScaleOrientation.h"
|
||||||
#import <Cordova/NSArray+Comparisons.h>
|
|
||||||
#import <Cordova/NSData+Base64.h>
|
|
||||||
#import <Cordova/NSDictionary+Extensions.h>
|
|
||||||
#import <MobileCoreServices/UTCoreTypes.h>
|
#import <MobileCoreServices/UTCoreTypes.h>
|
||||||
|
|
||||||
|
|
||||||
@ -291,12 +288,14 @@
|
|||||||
|
|
||||||
// test 640x480
|
// test 640x480
|
||||||
|
|
||||||
targetSize = CGSizeMake(640, 480);
|
targetSize = CGSizeMake(480, 640);
|
||||||
|
|
||||||
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
||||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||||
|
|
||||||
|
targetSize = CGSizeMake(640, 480);
|
||||||
|
|
||||||
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
||||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||||
@ -304,24 +303,28 @@
|
|||||||
|
|
||||||
// test 800x600
|
// test 800x600
|
||||||
|
|
||||||
targetSize = CGSizeMake(800, 600);
|
targetSize = CGSizeMake(600, 800);
|
||||||
|
|
||||||
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
||||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||||
|
|
||||||
|
targetSize = CGSizeMake(800, 600);
|
||||||
|
|
||||||
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
||||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||||
|
|
||||||
// test 1024x768
|
// test 1024x768
|
||||||
|
|
||||||
targetSize = CGSizeMake(1024, 768);
|
targetSize = CGSizeMake(768, 1024);
|
||||||
|
|
||||||
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
targetImage = [sourceImagePortrait imageByScalingNotCroppingForSize:targetSize];
|
||||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||||
|
|
||||||
|
targetSize = CGSizeMake(1024, 768);
|
||||||
|
|
||||||
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
targetImage = [sourceImageLandscape imageByScalingNotCroppingForSize:targetSize];
|
||||||
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
XCTAssertEqual(targetImage.size.width, targetSize.width);
|
||||||
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
XCTAssertEqual(targetImage.size.height, targetSize.height);
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
"author": "Apache Software Foundation",
|
"author": "Apache Software Foundation",
|
||||||
"license": "Apache Version 2.0",
|
"license": "Apache Version 2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cordova-ios": "^3.7.0"
|
"cordova-ios": "*"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "xcodebuild -scheme CordovaLib && xcodebuild test -scheme CDVCameraLibTests -destination 'platform=iOS Simulator,name=iPhone 5'"
|
"test": "xcodebuild -scheme CordovaLib && xcodebuild test -scheme CDVCameraLibTests -destination 'platform=iOS Simulator,name=iPhone 5'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,8 @@ exports.defineManualTests = function (contentEl, createActionButton) {
|
|||||||
var img = document.getElementById('camera_image');
|
var img = document.getElementById('camera_image');
|
||||||
var startTime = new Date();
|
var startTime = new Date();
|
||||||
img.src = url;
|
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));
|
log('Image tag load time: ' + (new Date() - startTime));
|
||||||
if (callback) {
|
if (callback) {
|
||||||
callback();
|
callback();
|
||||||
|
Loading…
Reference in New Issue
Block a user