diff --git a/tests/app/ui/view/view-tests-common.ts b/tests/app/ui/view/view-tests-common.ts index 6cfef149f..88ca5133f 100644 --- a/tests/app/ui/view/view-tests-common.ts +++ b/tests/app/ui/view/view-tests-common.ts @@ -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({ 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) { + TKUnit.waitUntilReady(() => btn.isLayoutValid); + }); +} \ No newline at end of file diff --git a/tns-core-modules/ui/styling/background.ios.ts b/tns-core-modules/ui/styling/background.ios.ts index 3f6cdcd15..3aadcd891 100644 --- a/tns-core-modules/ui/styling/background.ios.ts +++ b/tns-core-modules/ui/styling/background.ios.ts @@ -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;