forked from enlightenment/efl
eina_value: revert bogus array change, add test.
oops! the list commit changed array back! I blame svn not having "git add -p" and I have to do it by coping files :-/ SVN revision: 67097
This commit is contained in:
parent
16c03cc014
commit
0b2ddbd396
|
@ -2497,18 +2497,8 @@ _eina_value_type_array_convert_to(const Eina_Value_Type *type __UNUSED__, const
|
|||
const Eina_Value_Array *tmem = type_mem;
|
||||
Eina_Bool ret = EINA_FALSE;
|
||||
|
||||
if ((tmem->array) && (tmem->array->len == 1))
|
||||
{
|
||||
const Eina_Value_Type *subtype = tmem->subtype;
|
||||
void *imem = tmem->array->members;
|
||||
|
||||
if (subtype->convert_to)
|
||||
ret = subtype->convert_to(subtype, convert, imem, convert_mem);
|
||||
if ((!ret) && (convert->convert_from))
|
||||
ret = convert->convert_from(convert, subtype, convert_mem, imem);
|
||||
}
|
||||
else if ((convert == EINA_VALUE_TYPE_STRING) ||
|
||||
(convert == EINA_VALUE_TYPE_STRINGSHARE))
|
||||
if ((convert == EINA_VALUE_TYPE_STRING) ||
|
||||
(convert == EINA_VALUE_TYPE_STRINGSHARE))
|
||||
{
|
||||
Eina_Strbuf *str = eina_strbuf_new();
|
||||
if (!tmem->array) eina_strbuf_append(str, "[]");
|
||||
|
@ -2562,6 +2552,16 @@ _eina_value_type_array_convert_to(const Eina_Value_Type *type __UNUSED__, const
|
|||
eina_strbuf_free(str);
|
||||
}
|
||||
}
|
||||
else if ((tmem->array) && (tmem->array->len == 1))
|
||||
{
|
||||
const Eina_Value_Type *subtype = tmem->subtype;
|
||||
void *imem = tmem->array->members;
|
||||
|
||||
if (subtype->convert_to)
|
||||
ret = subtype->convert_to(subtype, convert, imem, convert_mem);
|
||||
if ((!ret) && (convert->convert_from))
|
||||
ret = convert->convert_from(convert, subtype, convert_mem, imem);
|
||||
}
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
|
|
|
@ -1000,7 +1000,7 @@ END_TEST
|
|||
|
||||
START_TEST(eina_value_test_array)
|
||||
{
|
||||
Eina_Value *value;
|
||||
Eina_Value *value, other;
|
||||
char c;
|
||||
char buf[1024];
|
||||
char *str;
|
||||
|
@ -1063,6 +1063,25 @@ START_TEST(eina_value_test_array)
|
|||
fail_unless(strcmp(str, "[Enlightenment.org, X11, Pants, on!!!, k-s]") == 0);
|
||||
free(str);
|
||||
|
||||
eina_value_flush(value);
|
||||
fail_unless(eina_value_array_setup(value, EINA_VALUE_TYPE_CHAR, 0));
|
||||
fail_unless(eina_value_setup(&other, EINA_VALUE_TYPE_CHAR));
|
||||
|
||||
fail_unless(eina_value_set(&other, 100));
|
||||
fail_unless(eina_value_get(&other, &c));
|
||||
fail_unless(c == 100);
|
||||
|
||||
fail_unless(eina_value_convert(&other, value));
|
||||
str = eina_value_to_string(value);
|
||||
fail_unless(str != NULL);
|
||||
fail_unless(strcmp(str, "[100]") == 0);
|
||||
free(str);
|
||||
|
||||
fail_unless(eina_value_array_set(value, 0, 33));
|
||||
fail_unless(eina_value_convert(value, &other));
|
||||
fail_unless(eina_value_get(&other, &c));
|
||||
fail_unless(c == 33);
|
||||
|
||||
eina_value_free(value);
|
||||
eina_shutdown();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue