fix(obj): style opa of other part is not effective (#7905)

Signed-off-by: yushuailong <yushuailong1@xiaomi.com>
Signed-off-by: yushuailong1 <yushuailong1@xiaomi.com>
Co-authored-by: yushuailong1 <yushuailong1@xiaomi.com>
This commit is contained in:
yushuailong
2025-03-13 00:19:26 +08:00
committed by GitHub
parent 176b500005
commit 57a428abd8
4 changed files with 25 additions and 1 deletions
+5 -1
View File
@@ -379,7 +379,11 @@ static inline lv_opa_t get_layer_opa(const lv_obj_t * obj, lv_part_t part, const
{
if(base_dsc->layer) {
/* Accessing the layer opa directly is faster than using get style opa recursive */
return base_dsc->layer->opa;
if(part == LV_PART_MAIN) {
return base_dsc->layer->opa;
}
return LV_OPA_MIX2(base_dsc->layer->opa, lv_obj_get_style_opa(obj, part));
}
/* fallback to old recursive style opa */
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

@@ -24,6 +24,17 @@ static void event_handler(lv_event_t * e)
}
}
void setUp(void)
{
/* Function run before every test */
}
void tearDown(void)
{
/* Function run after every test */
lv_obj_clean(lv_screen_active());
}
void test_checkbox_creation_successful(void)
{
active_screen = lv_screen_active();
@@ -115,4 +126,13 @@ void test_checkbox_rtl(void)
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/checkbox_rtl_1.png");
}
void test_checkbox_style_opa(void)
{
lv_obj_t * obj = lv_checkbox_create(lv_screen_active());
lv_obj_set_style_opa(obj, LV_OPA_0, LV_PART_INDICATOR);
lv_obj_center(obj);
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/checkbox_1.png");
}
#endif