mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
Hhristov/ios background image crash fix (#4214)
* uiColorFromImage should return if there is no image. * added unit-test
This commit is contained in:
@ -249,7 +249,7 @@ export function test_InheritableStylePropertiesWhenUsedWithExtendedClass_AreInhe
|
||||
page.content = newButton;
|
||||
|
||||
TKUnit.assertEqual(newButton.style.color, redColor);
|
||||
};
|
||||
}
|
||||
|
||||
// TestView definition START
|
||||
const customCssProperty = new CssProperty<Style, string>({ name: "customCssProperty", cssName: "custom-css-property" });
|
||||
@ -919,3 +919,11 @@ export function test_getActualSize() {
|
||||
TKUnit.assertAreClose(actualSize.height, 200, delta, "actualSize.height");
|
||||
});
|
||||
};
|
||||
|
||||
export function test_background_image_doesnt_throw() {
|
||||
var btn = new Button();
|
||||
btn.style.backgroundImage = 'https://www.bodybuilding.com/images/2016/june/8-benefits-to-working-out-in-the-morning-header-v2-830x467.jpg';
|
||||
helper.buildUIAndRunTest(btn, function (views: Array<View>) {
|
||||
TKUnit.waitUntilReady(() => btn.isLayoutValid);
|
||||
});
|
||||
}
|
@ -262,6 +262,7 @@ function getDrawParams(this: void, image: UIImage, background: BackgroundDefinit
|
||||
function uiColorFromImage(img: UIImage, view: View, callback: (uiColor: UIColor) => void, flip?: boolean): void {
|
||||
if (!img) {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
|
||||
const nativeView = view.nativeView as UIView;
|
||||
|
Reference in New Issue
Block a user