| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ export function testFromResource() { | |||
| 15 | 15 | // >> imagesource-resname | |
| 16 | 16 | const img = imageSource.fromResource("icon"); | |
| 17 | 17 | // << imagesource-resname | |
| 18 | - | ||
| 18 | + | ||
| 19 | 19 | TKUnit.assert(img.height > 0, "image.fromResource failed"); | |
| 20 | 20 | } | |
| 21 | 21 | ||
@@ -149,6 +149,22 @@ export function testFromAssetWithScalingAndAspectRatio(done) { | |||
| 149 | 149 | }); | |
| 150 | 150 | } | |
| 151 | 151 | ||
| 152 | + export function testFromAssetWithScalingAndDefaultAspectRatio(done) { | ||
| 153 | + let asset = new imageAssetModule.ImageAsset(splashscreenPath); | ||
| 154 | + let scaleWidth = 10; | ||
| 155 | + let scaleHeight = 11; | ||
| 156 | + asset.options.width = scaleWidth; | ||
| 157 | + asset.options.height = scaleHeight; | ||
| 158 | + | ||
| 159 | + let img = imageSource.fromAsset(asset).then((source) => { | ||
| 160 | + TKUnit.assertEqual(source.width, 18); | ||
| 161 | + TKUnit.assertEqual(source.height, scaleHeight); | ||
| 162 | + done(); | ||
| 163 | + }, (error) => { | ||
| 164 | + done(error); | ||
| 165 | + }); | ||
| 166 | + } | ||
| 167 | + | ||
| 152 | 168 | export function testFromAssetWithBiggerScaling(done) { | |
| 153 | 169 | let asset = new imageAssetModule.ImageAsset(splashscreenPath); | |
| 154 | 170 | let scaleWidth = 600; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,11 @@ export class ImageAsset extends observable.Observable implements definition.Ima | |||
| 9 | 9 | ios: PHAsset; | |
| 10 | 10 | android: string; | |
| 11 | 11 | ||
| 12 | + constructor () { | ||
| 13 | + super(); | ||
| 14 | + this._options = { keepAspectRatio: true }; | ||
| 15 | + } | ||
| 16 | + | ||
| 12 | 17 | get options(): definition.ImageAssetOptions { | |
| 13 | 18 | return this._options; | |
| 14 | 19 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments