mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
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:
@ -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) {
|
export function testFromAssetWithBiggerScaling(done) {
|
||||||
let asset = new imageAssetModule.ImageAsset(splashscreenPath);
|
let asset = new imageAssetModule.ImageAsset(splashscreenPath);
|
||||||
let scaleWidth = 600;
|
let scaleWidth = 600;
|
||||||
|
@ -9,6 +9,11 @@ export class ImageAsset extends observable.Observable implements definition.Ima
|
|||||||
ios: PHAsset;
|
ios: PHAsset;
|
||||||
android: string;
|
android: string;
|
||||||
|
|
||||||
|
constructor () {
|
||||||
|
super();
|
||||||
|
this._options = { keepAspectRatio: true };
|
||||||
|
}
|
||||||
|
|
||||||
get options(): definition.ImageAssetOptions {
|
get options(): definition.ImageAssetOptions {
|
||||||
return this._options;
|
return this._options;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user