mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 18:48:09 +08:00
improve object_default
This commit is contained in:
parent
55a1ad1183
commit
568aaec80e
@ -1,4 +1,6 @@
|
||||
# 最新动态
|
||||
2024/08/1
|
||||
* 修复了object_default读写 "[a]" 这样的属性名会出错的问题(感谢陈聪提供补丁)
|
||||
|
||||
2024/07/31
|
||||
* 修改app_helper没有从compile config中获取LCD_ORIENTATION的问题(感谢朝泽提供补丁)
|
||||
|
@ -45,7 +45,7 @@ static value_t* object_default_find_prop_by_name(tk_object_t* obj, const char* n
|
||||
object_default_t* o = OBJECT_DEFAULT(obj);
|
||||
return_value_if_fail(o != NULL && name != NULL, NULL);
|
||||
|
||||
if (*name == '[') {
|
||||
if (*name == '[' && tk_isdigit(name[1]) && tk_str_end_with(name, "]")) {
|
||||
uint32_t index = tk_atoi(name + 1);
|
||||
return_value_if_fail(index < o->props.size, NULL);
|
||||
nv = (named_value_t*)(o->props.elms[index]);
|
||||
|
@ -511,6 +511,7 @@ TEST(ObjectDefault, size) {
|
||||
|
||||
ASSERT_STREQ(tk_object_get_prop_str(obj, "[0]"), "123");
|
||||
ASSERT_STREQ(tk_object_get_prop_str(obj, "[1]"), "abc");
|
||||
ASSERT_STREQ(tk_object_get_prop_str(obj, "[a]"), NULL);
|
||||
|
||||
tk_object_unref(obj);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user