edje: don't return negative width and height from _parts_extends

Summary:
It should return width and height with positive values or zero.
@fix

Test Plan: make check

Reviewers: raster, jpeg, cedric

Reviewed By: raster

Subscribers: jiin.moon

Differential Revision: https://phab.enlightenment.org/D5422
This commit is contained in:
Youngbok Shin 2017-11-06 11:06:41 +09:00 committed by Carsten Haitzler (Rasterman)
parent 9e98ddb63b
commit de9f0aff57
2 changed files with 11 additions and 2 deletions

View File

@ -3274,7 +3274,7 @@ EOLIAN Eina_Rectangle
_edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje *ed)
{
Evas_Coord xx1 = INT_MAX, yy1 = INT_MAX;
Evas_Coord xx2 = 0, yy2 = 0;
Evas_Coord xx2 = 0, yy2 = 0, w = 0, h = 0;
unsigned short i;
ed->calc_only = EINA_TRUE;
@ -3304,7 +3304,10 @@ _edje_object_efl_canvas_layout_calc_calc_parts_extends(Eo *obj EINA_UNUSED, Edje
ed->calc_only = EINA_FALSE;
return (Eina_Rectangle) { xx1, yy1, xx2 - xx1, yy2 - yy1 };
if ((xx2 - xx1) > 0) w = xx2 - xx1;
if ((yy2 - yy1) > 0) h = yy2 - yy1;
return (Eina_Rectangle) { xx1, yy1, w, h };
}
EOLIAN Eina_Size2D

View File

@ -151,8 +151,14 @@ START_TEST(edje_test_calculate_parens)
int x, y, w, h;
Evas *evas = EDJE_TEST_INIT_EVAS();
Evas_Object *obj;
Eina_Rect rect;
obj = edje_object_add(evas);
/* A negative test case for efl_canvas_layout_calc_parts_extends */
rect = efl_canvas_layout_calc_parts_extends(obj);
fail_if(rect.w < 0 || rect.h < 0);
fail_unless(edje_object_file_set(obj, test_layout_get("test_parens.edj"), "test_group"));
evas_object_resize(obj, 100, 100);