Page MenuHomePhabricator

evas_box: fix calculation logic when item's weight is 0.0.
Needs RevisionPublic

Authored by eagleeye on Dec 5 2018, 2:39 AM.

Details

Summary

In case of box item's size and min size are different,
box item position is calculated incorrectly.
Please check with example code.

Test Plan

/*

  • gcc -o box_example box_example.c pkg-config --cflags --libs elementary */

#include <Elementary.h>

EAPI_MAIN int
elm_main(int argc EINA_UNUSED, char **argv EINA_UNUSED)
{

Evas_Object *win = NULL;
Evas_Object *btn = NULL;

elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

win = elm_win_util_standard_add("Greetings", "Hello, World!");
elm_win_autodel_set(win, EINA_TRUE);

Evas_Object *box = evas_object_box_add(evas_object_evas_get(win));
evas_object_box_layout_set(box, evas_object_box_layout_horizontal, NULL, NULL);
evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_show(box);
elm_win_resize_object_add(win, box);

btn = elm_button_add(win);
elm_object_text_set(btn, "Good-Bye");
evas_object_size_hint_weight_set(btn, 0.0, 0.0);
evas_object_resize(btn, 100,100);
evas_object_box_append(box, btn);
evas_object_show(btn);

btn = elm_button_add(win);
elm_object_text_set(btn, "World!");
evas_object_size_hint_weight_set(btn, 0.0, 0.0);
evas_object_resize(btn, 100,100);
evas_object_box_append(box, btn);
evas_object_show(btn);

evas_object_resize(win, 200, 100);
evas_object_show(win);

elm_run();

return 0;

}
ELM_MAIN()

Diff Detail

Repository
rEFL core/efl
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 8332
eagleeye created this revision.Dec 5 2018, 2:39 AM
eagleeye requested review of this revision.Dec 5 2018, 2:39 AM
eagleeye edited the test plan for this revision. (Show Details)Dec 5 2018, 2:40 AM
eagleeye added a reviewer: Jaehyun.

@raster

Could you give some comments on this patch? :)

zmike added a subscriber: zmike.Jan 9 2019, 9:03 AM

Can a unit test be added for this? It should be fairly simple since you can just get the position of the object after box layout has occurred.

@eagleeye
could you add unit test for this as @zmike mentioned?

Ping? We are getting close to trigger a release, it would be best to have this patch properly landed sooner rather than later.

zmike requested changes to this revision.Feb 25 2019, 4:14 AM
This revision now requires changes to proceed.Feb 25 2019, 4:14 AM