chore: set keepAspectRatio to true as default in image-asset (#5613)

* chore: set keepAspectRatio to true as default in image-asset

* fix: remove empty lines
This commit is contained in:
tbozhikov
2018-04-10 00:46:27 +03:00
committed by Svetoslav
parent c5fa922579
commit c06d5bae63
2 changed files with 22 additions and 1 deletions

View File

@ -149,6 +149,22 @@ export function testFromAssetWithScalingAndAspectRatio(done) {
});
}
export function testFromAssetWithScalingAndDefaultAspectRatio(done) {
let asset = new imageAssetModule.ImageAsset(splashscreenPath);
let scaleWidth = 10;
let scaleHeight = 11;
asset.options.width = scaleWidth;
asset.options.height = scaleHeight;
let img = imageSource.fromAsset(asset).then((source) => {
TKUnit.assertEqual(source.width, 18);
TKUnit.assertEqual(source.height, scaleHeight);
done();
}, (error) => {
done(error);
});
}
export function testFromAssetWithBiggerScaling(done) {
let asset = new imageAssetModule.ImageAsset(splashscreenPath);
let scaleWidth = 600;

View File

@ -9,6 +9,11 @@ export class ImageAsset extends observable.Observable implements definition.Ima
ios: PHAsset;
android: string;
constructor () {
super();
this._options = { keepAspectRatio: true };
}
get options(): definition.ImageAssetOptions {
return this._options;
}