mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(android-styling): correctly detect if drawable uses ColorFilter (#6342)
* fix(android-styling): correctly detect if drawable uses ColorFilter Treat a widget with a BorderDrawable background as any other, even if it's FilterOnly If the drawable has been replaced with a new one, clear _cachedDrawable Fixes #6341 * test(button): add test for changing border-radius and color in button * test: fix test checks for IOS * keep original drawable cached
This commit is contained in:
committed by
Dimitar Topuzov
parent
00c25b7c0c
commit
11d3884243
@@ -404,3 +404,18 @@ export function test_setting_formattedText_With_UnknownFont_DoesNotCrash() {
|
||||
TKUnit.waitUntilReady(() => btn.isLayoutValid);
|
||||
});
|
||||
}
|
||||
|
||||
export function test_Native_Background_Color_BorderRadius_Change() {
|
||||
let view = new buttonModule.Button();
|
||||
view.text = "TEST";
|
||||
helper.buildUIAndRunTest(view, function (views: Array<viewModule.View>) {
|
||||
let page = <pagesModule.Page>views[1];
|
||||
page.css = ".border { background-color: #00FF00; border-radius: 1; } .colorfilter { background-color: #FF0000; }";
|
||||
view.className = "border";
|
||||
helper.waitUntilLayoutReady(view);
|
||||
TKUnit.assertEqual(buttonTestsNative.getNativeBackgroundColor(view).hex, "#00FF00");
|
||||
view.className = "colorfilter";
|
||||
helper.waitUntilLayoutReady(view);
|
||||
TKUnit.assertEqual(buttonTestsNative.getNativeBackgroundColor(view).hex, "#FF0000");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ export module ad {
|
||||
|
||||
if (isSetColorFilterOnlyWidget(nativeView)
|
||||
&& drawable
|
||||
&& !(drawable instanceof org.nativescript.widgets.BorderDrawable)
|
||||
&& !background.hasBorderWidth()
|
||||
&& !background.hasBorderRadius()
|
||||
&& !background.clipPath
|
||||
|
||||
Reference in New Issue
Block a user