summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjunkyu han <junkyu.han@samsung.com>2017-05-19 10:31:39 +0900
committerjunkyu han <junkyu.han@samsung.com>2017-05-19 10:34:00 +0900
commit938fd96d1d76ca816a0f5e020f9577c2883f23b8 (patch)
treee75f70e7032077a5648310e4d2de4734097dc29d
parent609c17e8791af3b1ca805cc2405154cae2ddbaf1 (diff)
downloadw3-home-938fd96d1d76ca816a0f5e020f9577c2883f23b8.tar.gz
w3-home-938fd96d1d76ca816a0f5e020f9577c2883f23b8.tar.bz2
w3-home-938fd96d1d76ca816a0f5e020f9577c2883f23b8.zip
Upgrade test code for status layout and battery, callsignal
Change-Id: I217e76c94807fca5069df2b0005675ad7d1d1426
-rw-r--r--inc/moments/moments_status_view.h7
-rwxr-xr-xsrc/moments/moments_manager.c33
-rw-r--r--src/moments/moments_status_view.c154
-rwxr-xr-xsrc/moments/moments_view.c21
-rwxr-xr-xtest/feature_test/feature_test.c2
-rwxr-xr-xtest/feature_test/group_feature_moments_default_ui.c1
-rwxr-xr-xtest/feature_test/group_feature_moments_pull_down.c2
-rw-r--r--test/feature_test/group_feature_moments_status_view_ui.c252
-rwxr-xr-xtest/feature_test/group_feature_moments_vi.c2
-rwxr-xr-xtest/feature_test/group_feature_status_area_layer_show.c6
10 files changed, 241 insertions, 239 deletions
diff --git a/inc/moments/moments_status_view.h b/inc/moments/moments_status_view.h
index 6d0e1a3..5a1da1e 100644
--- a/inc/moments/moments_status_view.h
+++ b/inc/moments/moments_status_view.h
@@ -34,11 +34,14 @@ typedef enum {
STATUS_UTIL_ICON_MAX_COUNT
} status_util_icon_type_e;
-Evas_Object *get_moments_status_layout(void);
+Evas_Object *moments_status_view_get_layout(void);
-Evas_Object *moments_create_status_ui(Evas_Object *parent);
+Evas_Object *moments_status_view_create(Evas_Object *parent);
void moments_destroy_status_ui(void);
+void moments_status_callsignal_icon_show(void);
+void moments_status_callsignal_icon_hide(void);
+
void moments_status_battery_update(int percent, int converted_percent, bool is_charging);
void moments_status_callsignal_update(int strength, bool is_roaming);
void moments_status_update_util_icon_list(void);
diff --git a/src/moments/moments_manager.c b/src/moments/moments_manager.c
index 89c54d5..41cd955 100755
--- a/src/moments/moments_manager.c
+++ b/src/moments/moments_manager.c
@@ -88,7 +88,7 @@ void moments_init(Evas_Object *win, Evas_Object *bg_scroller)
s_info.layout = moments_create_ui(s_info.win);
- moments_create_status_ui(s_info.win);
+ moments_status_view_create(s_info.win);
__moments_register_status_util_callback();
__moments_initialize_status_util();
}
@@ -255,30 +255,13 @@ static void __moments_status_battery_state_changed_cb(device_callback_e type, vo
int converted_percent = 0;
bool is_charging = 0;
- if (type == DEVICE_CALLBACK_BATTERY_CAPACITY) {
- _D("Remained battery percent is changed");
- percent = (int)value;
- ret = device_battery_is_charging(&is_charging);
- if (ret < 0) {
- _E("Failed to get battery is charging");
- }
- } else if (type == DEVICE_CALLBACK_BATTERY_CHARGING) {
- _D("Battery charging state is changed");
- is_charging = (bool)value;
- ret = device_battery_get_percent(&percent);
- if (ret < 0) {
- _E("Failed to get battery percent");
- }
- } else {
- _D("Something strange or Initialize battery state");
- ret = device_battery_is_charging(&is_charging);
- if (ret < 0) {
- _E("Failed to get battery is charging");
- }
- ret = device_battery_get_percent(&percent);
- if (ret < 0) {
- _E("Failed to get battery percent");
- }
+ ret = device_battery_is_charging(&is_charging);
+ if (ret < 0) {
+ _E("Failed to get battery is charging");
+ }
+ ret = device_battery_get_percent(&percent);
+ if (ret < 0) {
+ _E("Failed to get battery percent");
}
converted_percent = __moments_get_round_off_percent(percent);
diff --git a/src/moments/moments_status_view.c b/src/moments/moments_status_view.c
index e608a51..f746473 100644
--- a/src/moments/moments_status_view.c
+++ b/src/moments/moments_status_view.c
@@ -73,80 +73,55 @@ static Evas_Object *__status_util_icon_list[STATUS_UTIL_ICON_MAX_COUNT] = { NULL
static bool __status_util_icon_is_appended[STATUS_UTIL_ICON_MAX_COUNT] = { false, };
static Eina_List *__status_util_icon_type_list = NULL;
-static void __status_register_util_icon_type_to_list(status_util_icon_type_e type);
+static Evas_Object *__moments_status_create_base_layout(Evas_Object *parent);
+static Evas_Object *__moments_status_create_battery(Evas_Object *parent);
+static void __moments_status_register_util_icon_type_to_list(status_util_icon_type_e type);
+static void __moments_status_unregister_util_icon_type_from_list(status_util_icon_type_e type);
static status_util_icon_type_e __status_get_prev_type_by_priority(status_util_icon_type_e type);
static void __status_append_icon_type_to_type_list(status_util_icon_type_e type, status_util_icon_type_e prev_type);
static void __status_prepend_icon_type_to_type_list(status_util_icon_type_e type);
-Evas_Object *get_moments_status_layout(void)
+Evas_Object *moments_status_view_get_layout(void)
{
return s_info.status_layout;
}
-Evas_Object *moments_create_status_ui(Evas_Object *parent)
+Evas_Object *moments_status_view_create(Evas_Object *parent)
{
- s_info.status_layout = elm_layout_add(parent);
- if (!s_info.status_layout || !elm_layout_file_set(s_info.status_layout, util_get_res_file_path(STATUS_LAYOUT_EDJE), STATUS_LAYOUT)) {
- _E("Failed to create base layout");
- goto __fail;
- }
- evas_object_size_hint_weight_set(s_info.status_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_resize(s_info.status_layout, WINDOW_W, MOMENTS_INIT_H);
- evas_object_move(s_info.status_layout, OUTSIDE_X, OUTSIDE_Y);
- evas_object_hide(s_info.status_layout);
+ s_info.status_layout = __moments_status_create_base_layout(parent);
- s_info.status_grid = elm_grid_add(s_info.status_layout);
- if (!s_info.status_grid) {
- _E("Failed to create grid object");
- goto __fail;
- }
-
- evas_object_size_hint_min_set(s_info.status_grid, WINDOW_W, MOMENTS_INIT_H);
- evas_object_size_hint_weight_set(s_info.status_grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_size_hint_align_set(s_info.status_grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
- elm_grid_size_set(s_info.status_grid, WINDOW_W, MOMENTS_INIT_H);
+ s_info.status_battery = __moments_status_create_battery(s_info.status_layout);
- elm_layout_content_set(s_info.status_layout, STATUS_CONTENT, s_info.status_grid);
- evas_object_show(s_info.status_grid);
+ return s_info.status_layout;
+}
- s_info.status_battery = elm_layout_add(s_info.status_layout);
- if (!s_info.status_battery || !elm_layout_file_set(s_info.status_battery, util_get_res_file_path(STATUS_UTIL_BATTERY_EDJE), STATUS_BATTERY_LAYOUT)) {
- _E("Failed to create battery layout");
- goto __fail;
+void moments_status_callsignal_icon_show(void)
+{
+ s_info.status_callsignal = elm_layout_add(s_info.status_layout);
+ if (!s_info.status_callsignal || !elm_layout_file_set(s_info.status_callsignal, util_get_res_file_path(STATUS_UTIL_CALLSIGNAL_EDJE), STATUS_CALLSIGNAL_LAYOUT)) {
+ _E("Failed to create callsignal layout");
+ return;
}
- evas_object_size_hint_min_set(s_info.status_battery, MOMENTS_STATUS_BATTERY_ICON_W, MOMENTS_STATUS_BATTERY_ICON_H);
- evas_object_size_hint_align_set(s_info.status_battery, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(s_info.status_battery, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_show(s_info.status_battery);
+ evas_object_size_hint_min_set(s_info.status_callsignal, MOMENTS_STATUS_UTIL_ICON_W, MOMENTS_STATUS_UTIL_ICON_H);
+ evas_object_size_hint_align_set(s_info.status_callsignal, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(s_info.status_callsignal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_move(s_info.status_callsignal, OUTSIDE_X, OUTSIDE_Y);
+ evas_object_show(s_info.status_callsignal);
- elm_grid_pack(s_info.status_grid, s_info.status_battery, MOMENTS_STATUS_BATTERY_ICON_X, MOMENTS_STATUS_BATTERY_ICON_Y, MOMENTS_STATUS_BATTERY_ICON_W, MOMENTS_STATUS_BATTERY_ICON_H);
+ __status_util_icon_list[STATUS_UTIL_ICON_CALLSIGNAL] = s_info.status_callsignal;
+ __status_util_icon_is_appended[STATUS_UTIL_ICON_CALLSIGNAL] = true;
- if (moments_check_is_3g_device()) {
- s_info.status_callsignal = elm_layout_add(s_info.status_layout);
- if (!s_info.status_callsignal || !elm_layout_file_set(s_info.status_callsignal, util_get_res_file_path(STATUS_UTIL_CALLSIGNAL_EDJE), STATUS_CALLSIGNAL_LAYOUT)) {
- _E("Failed to create callsignal layout");
- goto __fail;
- }
- evas_object_size_hint_min_set(s_info.status_callsignal, MOMENTS_STATUS_UTIL_ICON_W, MOMENTS_STATUS_UTIL_ICON_H);
- evas_object_size_hint_align_set(s_info.status_callsignal, EVAS_HINT_FILL, EVAS_HINT_FILL);
- evas_object_size_hint_weight_set(s_info.status_callsignal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
- evas_object_move(s_info.status_callsignal, OUTSIDE_X, OUTSIDE_Y);
- evas_object_show(s_info.status_callsignal);
-
- __status_util_icon_list[STATUS_UTIL_ICON_CALLSIGNAL] = s_info.status_callsignal;
- __status_util_icon_is_appended[STATUS_UTIL_ICON_CALLSIGNAL] = true;
-
- __status_register_util_icon_type_to_list(STATUS_UTIL_ICON_CALLSIGNAL);
- }
+ __moments_status_register_util_icon_type_to_list(STATUS_UTIL_ICON_CALLSIGNAL);
+}
- return s_info.status_layout;
+void moments_status_callsignal_icon_hide(void)
+{
+ __moments_status_unregister_util_icon_type_from_list(STATUS_UTIL_ICON_CALLSIGNAL);
+ __status_util_icon_is_appended[STATUS_UTIL_ICON_CALLSIGNAL] = false;
-__fail:
if (s_info.status_callsignal) evas_object_del(s_info.status_callsignal);
- if (s_info.status_battery) evas_object_del(s_info.status_battery);
- if (s_info.status_grid) evas_object_del(s_info.status_grid);
- if (s_info.status_layout) evas_object_del(s_info.status_layout);
- return NULL;
+ s_info.status_callsignal = NULL;
+ __status_util_icon_list[STATUS_UTIL_ICON_CALLSIGNAL] = NULL;
}
void moments_destroy_status_ui(void)
@@ -271,7 +246,7 @@ static void __status_append_icon_type_to_type_list(status_util_icon_type_e type,
}
}
-static void __status_register_util_icon_type_to_list(status_util_icon_type_e type)
+static void __moments_status_register_util_icon_type_to_list(status_util_icon_type_e type)
{
status_util_icon_type_e prev_type = -1;
@@ -288,6 +263,71 @@ static void __status_register_util_icon_type_to_list(status_util_icon_type_e typ
}
}
+static void __moments_status_unregister_util_icon_type_from_list(status_util_icon_type_e type)
+{
+ Eina_List *list = NULL;
+ void *data = NULL;
+
+ EINA_LIST_FOREACH(__status_util_icon_type_list, list, data) {
+ status_util_icon_type_e cur_type = (status_util_icon_type_e)data;
+ if (cur_type == type) {
+ __status_util_icon_type_list = eina_list_remove_list(__status_util_icon_type_list, list);
+ break;
+ }
+ }
+}
+
+static Evas_Object *__moments_status_create_base_layout(Evas_Object *parent)
+{
+ Evas_Object *status_layout = elm_layout_add(parent);
+ if (!status_layout || !elm_layout_file_set(status_layout, util_get_res_file_path(STATUS_LAYOUT_EDJE), STATUS_LAYOUT)) {
+ _E("Failed to create base layout");
+ goto __fail;
+ }
+ evas_object_size_hint_weight_set(status_layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_resize(status_layout, WINDOW_W, MOMENTS_INIT_H);
+ evas_object_move(status_layout, OUTSIDE_X, OUTSIDE_Y);
+ evas_object_hide(status_layout);
+
+ s_info.status_grid = elm_grid_add(status_layout);
+ if (!s_info.status_grid) {
+ _E("Failed to create grid object");
+ goto __fail;
+ }
+
+ evas_object_size_hint_min_set(s_info.status_grid, WINDOW_W, MOMENTS_INIT_H);
+ evas_object_size_hint_weight_set(s_info.status_grid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_size_hint_align_set(s_info.status_grid, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ elm_grid_size_set(s_info.status_grid, WINDOW_W, MOMENTS_INIT_H);
+
+ elm_layout_content_set(status_layout, STATUS_CONTENT, s_info.status_grid);
+ evas_object_show(s_info.status_grid);
+
+ return status_layout;
+
+__fail:
+ if (s_info.status_grid) evas_object_del(s_info.status_grid);
+ if (s_info.status_layout) evas_object_del(s_info.status_layout);
+ return NULL;
+}
+
+static Evas_Object *__moments_status_create_battery(Evas_Object *parent)
+{
+ Evas_Object *status_battery = elm_layout_add(parent);
+ if (!status_battery || !elm_layout_file_set(status_battery, util_get_res_file_path(STATUS_UTIL_BATTERY_EDJE), STATUS_BATTERY_LAYOUT)) {
+ _E("Failed to create battery layout");
+ return NULL;
+ }
+ evas_object_size_hint_min_set(status_battery, MOMENTS_STATUS_BATTERY_ICON_W, MOMENTS_STATUS_BATTERY_ICON_H);
+ evas_object_size_hint_align_set(status_battery, EVAS_HINT_FILL, EVAS_HINT_FILL);
+ evas_object_size_hint_weight_set(status_battery, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_show(status_battery);
+
+ elm_grid_pack(s_info.status_grid, status_battery, MOMENTS_STATUS_BATTERY_ICON_X, MOMENTS_STATUS_BATTERY_ICON_Y, MOMENTS_STATUS_BATTERY_ICON_W, MOMENTS_STATUS_BATTERY_ICON_H);
+
+ return status_battery;
+}
+
#include <test.h>
#if TEST_MODE
Evas_Object * __t__get_moments_status_grid(void)
diff --git a/src/moments/moments_view.c b/src/moments/moments_view.c
index 7d87b21..3a7b92c 100755
--- a/src/moments/moments_view.c
+++ b/src/moments/moments_view.c
@@ -170,14 +170,14 @@ bool moments_view_show(void)
_D("%s", __func__);
if (!s_info.background_layout) return false;
- if (!get_moments_status_layout()) return false;
+ if (!moments_status_view_get_layout()) return false;
if (animator_is_ongoing()) {
animator_stop();
}
evas_object_show(s_info.background_layout);
- evas_object_show(get_moments_status_layout());
+ evas_object_show(moments_status_view_get_layout());
MOVEMENT movement_info[2];
movement_info[0].start_x = 0;
@@ -192,7 +192,7 @@ bool moments_view_show(void)
movement_info[1].dest_y = 0;
movement_info[1].duration = MOMENTS_ANIMATION_SHOW_TIME;
- Evas_Object *layout[2] = {s_info.background_layout, get_moments_status_layout()};
+ Evas_Object *layout[2] = {s_info.background_layout, moments_status_view_get_layout()};
moments_view_animator_move(layout, movement_info, NULL);
return true;
@@ -203,7 +203,7 @@ bool moments_view_hide(void)
_D("%s", __func__);
if (!s_info.background_layout) return false;
- if (!get_moments_status_layout()) return false;
+ if (!moments_status_view_get_layout()) return false;
if (animator_is_ongoing()) {
animator_stop();
@@ -220,14 +220,14 @@ bool moments_view_hide(void)
movement_info[0].dest_y = -WINDOW_H;
movement_info[0].duration = MOMENTS_ANIMATION_DRAW_TIME;
- evas_object_geometry_get(get_moments_status_layout(), &x, &y, &w, &h);
+ evas_object_geometry_get(moments_status_view_get_layout(), &x, &y, &w, &h);
movement_info[1].start_x = x;
movement_info[1].start_y = y;
movement_info[1].dest_x = 0;
movement_info[1].dest_y = -MOMENTS_INIT_H;
movement_info[1].duration = MOMENTS_ANIMATION_DRAW_TIME;
- Evas_Object *layout[2] = {s_info.background_layout, get_moments_status_layout()};
+ Evas_Object *layout[2] = {s_info.background_layout, moments_status_view_get_layout()};
moments_view_animator_move(layout, movement_info, __hide_complete_cb);
return true;
@@ -463,14 +463,14 @@ static void __put_down(void)
movement_info[0].dest_y = 0;
movement_info[0].duration = MOMENTS_ANIMATION_DRAW_TIME;
- evas_object_geometry_get(get_moments_status_layout(), &x, &y, &w, &h);
+ evas_object_geometry_get(moments_status_view_get_layout(), &x, &y, &w, &h);
movement_info[1].start_x = x;
movement_info[1].start_y = y;
movement_info[1].dest_x = 0;
movement_info[1].dest_y = 0;
movement_info[1].duration = MOMENTS_ANIMATION_DRAW_TIME;
- Evas_Object *layout[2] = {s_info.background_layout, get_moments_status_layout()};
+ Evas_Object *layout[2] = {s_info.background_layout, moments_status_view_get_layout()};
moments_view_animator_move(layout, movement_info, __pull_down_complete_cb);
}
@@ -499,6 +499,7 @@ static void __unfreeze_touch_event(void)
static void __hide_complete_cb(void)
{
+ _D("%s", __func__);
s_info.is_show = false;
__freeze_touch_event();
@@ -506,8 +507,8 @@ static void __hide_complete_cb(void)
evas_object_hide(s_info.background_layout);
evas_object_move(s_info.background_layout, OUTSIDE_X, OUTSIDE_Y);
- evas_object_hide(get_moments_status_layout());
- evas_object_move(get_moments_status_layout(), OUTSIDE_X, OUTSIDE_Y);
+ evas_object_hide(moments_status_view_get_layout());
+ evas_object_move(moments_status_view_get_layout(), OUTSIDE_X, OUTSIDE_Y);
evas_object_color_set(s_info.control_layout, 255, 255, 255, 0);
}
diff --git a/test/feature_test/feature_test.c b/test/feature_test/feature_test.c
index 3dabe72..9b22792 100755
--- a/test/feature_test/feature_test.c
+++ b/test/feature_test/feature_test.c
@@ -17,8 +17,8 @@ void feature_test(void)
TEST_GROUP_ADD("group_feature_status_area_layer_show", group_feature_status_area_layer_show);
TEST_GROUP_ADD("group_feature_moments_default_ui", group_feature_moments_default_ui);
TEST_GROUP_ADD("group_feature_moments_vi", group_feature_moments_vi);
- TEST_GROUP_ADD("group_feature_moments_status_view_ui", group_feature_moments_status_view_ui);
TEST_GROUP_ADD("group_feature_moments_controls_show", group_feature_moments_controls_show);
+ TEST_GROUP_ADD("group_feature_moments_status_view_ui", group_feature_moments_status_view_ui);
TEST_RUN(__test_complete_cb);
}
diff --git a/test/feature_test/group_feature_moments_default_ui.c b/test/feature_test/group_feature_moments_default_ui.c
index c9fd4bf..e389480 100755
--- a/test/feature_test/group_feature_moments_default_ui.c
+++ b/test/feature_test/group_feature_moments_default_ui.c
@@ -135,7 +135,6 @@ static void __case_check_center_layout(bool * is_passed)
*is_passed = true;
}
-
static void __case_restore_status(bool * is_passed)
{
__t__set_connection_status(MOMENTS_CONNECTION_STATUS_STANDALONE);
diff --git a/test/feature_test/group_feature_moments_pull_down.c b/test/feature_test/group_feature_moments_pull_down.c
index b1368cf..0d57e92 100755
--- a/test/feature_test/group_feature_moments_pull_down.c
+++ b/test/feature_test/group_feature_moments_pull_down.c
@@ -137,7 +137,7 @@ static void __case_touch_down_top(bool * is_passed)
TEST_ASSERT_TRUE(moments_get_visible());
- Evas_Object * layout = get_moments_status_layout();
+ Evas_Object * layout = moments_status_view_get_layout();
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout) == EINA_TRUE);
diff --git a/test/feature_test/group_feature_moments_status_view_ui.c b/test/feature_test/group_feature_moments_status_view_ui.c
index c825dd0..21de5ae 100644
--- a/test/feature_test/group_feature_moments_status_view_ui.c
+++ b/test/feature_test/group_feature_moments_status_view_ui.c
@@ -13,8 +13,8 @@
#include <Elementary.h>
#include <app.h>
-#define STATUS_LAYOUT_EDJE "/usr/apps/org.tizen.w-home/res/edje/circle/moments_status_layout.edj"
#define STATUS_CONTENT "status_content"
+#define STATUS_LAYOUT_EDJE "/usr/apps/org.tizen.w-home/res/edje/circle/moments_status_layout.edj"
extern Evas_Object *__t__get_moments_view_base_window(void);
extern Evas_Object *__t__get_moments_status_grid(void);
@@ -25,37 +25,22 @@ extern void __t__moments_restore_status_callsignal(void);
extern void __t__layout_mouse_down(Evas_Object *layout, int down_x, int down_y);
extern void __t__layout_mouse_up(Evas_Object *layout, int down_x, int down_y);
-static void __case_check_status_view_layout(bool * is_passed);
-static void __case_check_status_view_battery(bool * is_passed);
-static void __case_check_status_view_callsignal(bool * is_passed);
-static void __case_check_status_battery_icon_change(bool * is_passed);
-static void __case_check_status_callsignal_icon_change(bool * is_passed);
+static unit_case_func_t __case_check_status_view_layout(void *data);
+static unit_case_func_t __case_check_status_view_battery(void *data);
+static unit_case_func_t __case_check_status_view_callsignal(void *data);
static struct {
- int before_step_battery_text;
- int before_step_battery_percent;
- bool before_step_battery_charging;
- int callsignal_index;
int current_step;
Ecore_Timer * group_timer;
unit_group_t * group;
int current_case;
void(*case_pool[TEST_CASE_MAX + 1])(bool * is_passed);
} s_info = {
- .before_step_battery_text = 0,
- .before_step_battery_percent = 0,
- .before_step_battery_charging = false,
- .callsignal_index = 0,
.current_step = 0,
.group_timer = NULL,
.group = NULL,
.current_case = 0,
.case_pool = {
- __case_check_status_view_layout,
- __case_check_status_view_battery,
- __case_check_status_view_callsignal,
- __case_check_status_battery_icon_change,
- __case_check_status_callsignal_icon_change,
NULL,
},
};
@@ -77,21 +62,28 @@ static char *__t__callsignal_type[13] = {
static Eina_Bool __group_timer_callback(void * data);
-static void __set_up(void) {}
+static void __set_up(void)
+{
+ s_info.group->set_up_complete(s_info.group);
+}
-static void __tear_down(void) {}
+static void __tear_down(void)
+{
+ s_info.group->tear_down_complete(s_info.group);
+}
-static void __case_check_status_view_layout(bool * is_passed)
+static unit_case_func_t __case_check_status_view_layout(void *data)
{
- Evas_Object *win = __t__get_moments_view_base_window();
- TEST_ASSERT_TRUE(win != NULL);
+ if (moments_get_visible()) {
+ TEST_CASE_CONTINUE(0.1, __case_check_status_view_layout, NULL);
+ }
- Evas_Object *layout = get_moments_status_layout();
+ Evas_Object *layout = moments_status_view_get_layout();
TEST_ASSERT_TRUE(layout != NULL);
const char *status_layout_file = NULL;
elm_layout_file_get(layout, &status_layout_file, NULL);
TEST_ASSERT_EQUAL_STRING(STATUS_LAYOUT_EDJE, status_layout_file);
- TEST_ASSERT_TRUE(!evas_object_visible_get(layout));
+ TEST_ASSERT_TRUE(evas_object_visible_get(layout) == false);
int x, y, w, h;
evas_object_geometry_get(layout, &x, &y, &w, &h);
TEST_ASSERT_EQUAL_INT(OUTSIDE_X, x);
@@ -108,10 +100,19 @@ static void __case_check_status_view_layout(bool * is_passed)
TEST_ASSERT_EQUAL_INT(WINDOW_W, w);
TEST_ASSERT_EQUAL_INT(MOMENTS_INIT_H, h);
- *is_passed = true;
+ TEST_CASE_DONE(s_info.group);
}
-static void __case_check_status_view_battery(bool * is_passed)
+static char battery_text[5] = { 0, };
+static char battery_percent[PATH_MAX] = { 0, };
+static void __set_battery_percent(int percent)
+{
+ snprintf(battery_text, sizeof(battery_text), "%d%%", percent);
+ snprintf(battery_percent, sizeof(battery_percent), "battery_percent_%02d", percent);
+}
+
+static unit_case_func_t __continue_check_status_battery_icon_change(void *data);
+static unit_case_func_t __case_check_status_view_battery(void *data)
{
Evas_Object *battery = __t__get_moments_status_battery();
TEST_ASSERT_TRUE(battery != NULL);
@@ -123,153 +124,128 @@ static void __case_check_status_view_battery(bool * is_passed)
TEST_ASSERT_EQUAL_INT(MOMENTS_STATUS_BATTERY_ICON_W, w);
TEST_ASSERT_EQUAL_INT(MOMENTS_STATUS_BATTERY_ICON_H, h);
- *is_passed = true;
-}
+ main_s *info = main_get_info();
+ TEST_ASSERT_TRUE(info != NULL);
+ TEST_ASSERT_TRUE(info->layout != NULL);
-#if 0
-static void __case_check_status_view_call_signal(bool * is_passed)
-{
- Evas_Object *battery = __t__get_moments_status_call_signal();
- TEST_ASSERT_TRUE(call_signal!= NULL);
- TEST_ASSERT_TRUE(evas_object_visible_get(call_signal));
- int x, y, w, h;
- evas_object_geometry_get(call_signal, &x, &y, &w, &h);
- TEST_ASSERT_EQUAL_INT(OUTSIDE_X + MOMENTS_STATUS_UTIL_POSITION_X, x);
- TEST_ASSERT_EQUAL_INT(OUTSIDE_Y + MOMENTS_STATUS_UTIL_FIXED_POSITION_Y, y);
- TEST_ASSERT_EQUAL_INT(MOMENTS_STATUS_UTIL_ICON_W, w);
- TEST_ASSERT_EQUAL_INT(MOMENTS_STATUS_UTIL_ICON_H, h);
+ Evas_Object *layout = moments_status_view_get_layout();
+ TEST_ASSERT_TRUE(layout != NULL);
- *is_passed = true;
+ __t__layout_mouse_down(info->layout, 180, 50);
+ TEST_ASSERT_TRUE(evas_object_visible_get(layout) == true);
+
+ static int percent = 0;
+ __set_battery_percent(percent);
+ moments_status_battery_update(0, 0, percent % 2);
+ TEST_CASE_CONTINUE(0.01, __continue_check_status_battery_icon_change, &percent);
}
-#endif
-static void __case_check_status_battery_icon_change(bool * is_passed)
+static unit_case_func_t __continue_check_status_battery_icon_change(void *data)
{
double val = 0.0;
- char battery_text[5] = {0, };
- char battery_percent[PATH_MAX] = {0, };
+ int percent = *(int *)data;
- main_s *info = main_get_info();
- TEST_ASSERT_TRUE(info != NULL);
- TEST_ASSERT_TRUE(info->layout != NULL);
-
- Evas_Object *layout = get_moments_status_layout();
+ Evas_Object *layout = moments_status_view_get_layout();
TEST_ASSERT_TRUE(layout != NULL);
- if (s_info.current_step == 0) {
- TEST_ASSERT_TRUE(evas_object_visible_get(layout) != true);
- }
Evas_Object *battery = __t__get_moments_status_battery();
TEST_ASSERT_TRUE(battery != NULL);
- if (s_info.current_step == 0) {
- __t__layout_mouse_down(info->layout, 180, 50);
- TEST_ASSERT_TRUE(evas_object_visible_get(layout) == true);
+ TEST_ASSERT_EQUAL_STRING(battery_text, elm_object_part_text_get(layout, "txt.battery"));
+ TEST_ASSERT_EQUAL_STRING(battery_percent, edje_object_part_state_get(elm_layout_edje_get(battery), "icon_image", &val));
+ if (percent % 2) {
+ TEST_ASSERT_EQUAL_STRING("show", edje_object_part_state_get(elm_layout_edje_get(battery), "battery_charge_image", &val));
+ } else {
+ TEST_ASSERT_EQUAL_STRING("default", edje_object_part_state_get(elm_layout_edje_get(battery), "battery_charge_image", &val));
}
-
- if (s_info.current_step > 0) {
- snprintf(battery_text, sizeof(battery_text), "%d%%", s_info.before_step_battery_text);
- snprintf(battery_percent, sizeof(battery_percent), "battery_percent_%02d", s_info.before_step_battery_percent);
-
- TEST_ASSERT_EQUAL_STRING(battery_text, elm_object_part_text_get(layout, "txt.battery"));
- TEST_ASSERT_EQUAL_STRING(battery_percent, edje_object_part_state_get(elm_layout_edje_get(battery), "icon_image", &val));
- if (s_info.before_step_battery_charging) {
- TEST_ASSERT_EQUAL_STRING("show", edje_object_part_state_get(elm_layout_edje_get(battery), "battery_charge_image", &val));
- } else {
- TEST_ASSERT_EQUAL_STRING("default", edje_object_part_state_get(elm_layout_edje_get(battery), "battery_charge_image", &val));
- }
+
+ if (percent >= 100) {
+ TEST_CASE_DONE(s_info.group);
}
- if (s_info.current_step < 21) {
- s_info.before_step_battery_text = s_info.current_step * 5;
- s_info.before_step_battery_percent = s_info.current_step * 5;
- s_info.before_step_battery_charging = s_info.current_step % 2 ? true : false;
-
- moments_status_battery_update(s_info.before_step_battery_text, s_info.before_step_battery_percent, s_info.before_step_battery_charging);
+ percent += 5;
+ __set_battery_percent(percent);
+ moments_status_battery_update(percent, percent, percent % 2);
- s_info.current_step += 1;
- s_info.current_case -= 1;
- } else {
- __t__moments_restore_status_battery();
- s_info.current_step = -1;
- }
-
- *is_passed = true;
+ *(int *)data = percent;
+ TEST_CASE_CONTINUE(0.1, __continue_check_status_battery_icon_change, data);
}
-static void __case_check_status_view_callsignal(bool * is_passed)
+static bool is_roaming = false;
+static int call_strength = -1;
+static int call_signal_index = 0;
+static unit_case_func_t __continue_check_status_callsignal_icon_change(void *data);
+
+static unit_case_func_t __case_check_status_view_callsignal(void *data)
{
Evas_Object *callsignal = __t__get_moments_status_callsignal();
- if (moments_check_is_3g_device()) {
- TEST_ASSERT_TRUE(callsignal != NULL);
- TEST_ASSERT_TRUE(evas_object_visible_get(callsignal));
-
- int x, y, w, h;
- evas_object_geometry_get(callsignal, &x, &y, &w, &h);
- TEST_ASSERT_EQUAL_INT(OUTSIDE_X + 135, x);
- TEST_ASSERT_EQUAL_INT(OUTSIDE_Y + 7, y);
- TEST_ASSERT_EQUAL_INT(MOMENTS_STATUS_UTIL_ICON_W, w);
- TEST_ASSERT_EQUAL_INT(MOMENTS_STATUS_UTIL_ICON_H, h);
- } else {
- TEST_ASSERT_TRUE(callsignal == NULL);
+ if (!callsignal) {
+ moments_status_callsignal_icon_show();
+ moments_status_update_util_icon_list();
+ TEST_CASE_CONTINUE(0.1, __case_check_status_view_callsignal, NULL);
}
- *is_passed = true;
+ TEST_ASSERT_TRUE(evas_object_visible_get(callsignal));
+
+ int x, y, w, h;
+ evas_object_geometry_get(callsignal, &x, &y, &w, &h);
+ TEST_ASSERT_EQUAL_INT(135, x);
+ TEST_ASSERT_EQUAL_INT(7, y);
+ TEST_ASSERT_EQUAL_INT(MOMENTS_STATUS_UTIL_ICON_W, w);
+ TEST_ASSERT_EQUAL_INT(MOMENTS_STATUS_UTIL_ICON_H, h);
+
+ //moments_status_callsignal_icon_hide();
+
+ moments_status_callsignal_update(call_strength, is_roaming);
+
+ TEST_CASE_CONTINUE(0.1, __continue_check_status_callsignal_icon_change, &call_strength);
}
-bool is_roaming_test = false;
-static void __case_check_status_callsignal_icon_change(bool * is_passed)
+static unit_case_func_t __continue_check_status_callsignal_icon_change(void *data)
{
+ int strength = *(int *)data;
double val = 0.0;
- main_s *info = main_get_info();
- TEST_ASSERT_TRUE(info != NULL);
- TEST_ASSERT_TRUE(info->layout != NULL);
-
- Evas_Object *layout = get_moments_status_layout();
- TEST_ASSERT_TRUE(layout != NULL);
-
Evas_Object *callsignal = __t__get_moments_status_callsignal();
TEST_ASSERT_TRUE(callsignal != NULL);
- if (s_info.current_step >= 0) {
- TEST_ASSERT_EQUAL_STRING(__t__callsignal_type[s_info.callsignal_index], edje_object_part_state_get(elm_layout_edje_get(callsignal), "icon_image", &val));
+ TEST_ASSERT_EQUAL_STRING(__t__callsignal_type[call_signal_index], edje_object_part_state_get(elm_layout_edje_get(callsignal), "icon_image", &val));
- s_info.callsignal_index += 1;
+ if (strength == 5 && !is_roaming) {
+ main_s *info = main_get_info();
+ __t__layout_mouse_up(info->layout, 0, 0);
+ TEST_CASE_DONE(s_info.group);
}
- if (s_info.current_step < 5) {
- int strength = s_info.current_step;
-
- moments_status_callsignal_update(strength, is_roaming_test);
-
- if (!is_roaming_test && s_info.current_step == 4) {
- is_roaming_test = true;
- s_info.current_step = -1;
- }
-
- s_info.current_step += 1;
- s_info.current_case -= 1;
- } else if (s_info.current_step == 5 && is_roaming_test) {
- int strength = s_info.current_step;
-
- moments_status_callsignal_update(strength, !is_roaming_test);
-
- s_info.current_step += 1;
- s_info.current_case -= 1;
- } else {
- __t__layout_mouse_up(info->layout, 0, 0);
- __t__moments_restore_status_callsignal();
- s_info.current_step = 0;
- s_info.callsignal_index = 0;
- is_roaming_test = false;
+ if (strength < 4) {
+ strength += 1;
+ } else if (strength == 4 && !is_roaming) {
+ strength = 0;
+ is_roaming = true;
+ } else if (strength == 4 && is_roaming) {
+ is_roaming = false;
+ strength += 1;
}
- *is_passed = true;
+ call_signal_index += 1;
+ moments_status_callsignal_update(strength, is_roaming);
+
+ *(int *)data = strength;
+ TEST_CASE_CONTINUE(0.2, __continue_check_status_callsignal_icon_change, data);
}
void group_feature_moments_status_view_ui(unit_group_t * group)
{
- if (s_info.group_timer) {
+ s_info.group = group;
+ s_info.group->set_up = __set_up;
+ s_info.group->tear_down = __tear_down;
+
+ TEST_CASE_ADD(s_info.group, __case_check_status_view_layout, NULL);
+ TEST_CASE_ADD(s_info.group, __case_check_status_view_battery, NULL);
+ TEST_CASE_ADD(s_info.group, __case_check_status_view_callsignal, NULL);
+
+ TEST_GROUP_RUN(s_info.group);
+
+ /*if (s_info.group_timer) {
ecore_timer_del(s_info.group_timer);
s_info.group_timer = NULL;
}
@@ -277,7 +253,7 @@ void group_feature_moments_status_view_ui(unit_group_t * group)
s_info.current_step = 0;
s_info.current_case = 0;
s_info.group = group;
- s_info.group_timer = ecore_timer_add(0.1, __group_timer_callback, NULL);
+ s_info.group_timer = ecore_timer_add(0.1, __group_timer_callback, NULL);*/
}
static Eina_Bool __group_timer_callback(void * data)
diff --git a/test/feature_test/group_feature_moments_vi.c b/test/feature_test/group_feature_moments_vi.c
index 65874bd..52db4ba 100755
--- a/test/feature_test/group_feature_moments_vi.c
+++ b/test/feature_test/group_feature_moments_vi.c
@@ -80,7 +80,7 @@ static void __case_touch_down_top(bool * is_passed)
TEST_ASSERT_TRUE(moments_get_visible());
- Evas_Object * layout = get_moments_status_layout();
+ Evas_Object * layout = moments_status_view_get_layout();
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout) == EINA_TRUE);
diff --git a/test/feature_test/group_feature_status_area_layer_show.c b/test/feature_test/group_feature_status_area_layer_show.c
index 3feb371..6541fee 100755
--- a/test/feature_test/group_feature_status_area_layer_show.c
+++ b/test/feature_test/group_feature_status_area_layer_show.c
@@ -59,7 +59,7 @@ static void __case_touch_down_top(bool * is_passed)
TEST_ASSERT_TRUE(moments_get_visible());
- Evas_Object * layout = get_moments_status_layout();
+ Evas_Object * layout = moments_status_view_get_layout();
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout) == EINA_TRUE);
@@ -86,7 +86,7 @@ static void __case_touch_up(bool * is_passed)
static void __case_check_status_layout_state_show(bool * is_passed)
{
- Evas_Object * layout = get_moments_status_layout();
+ Evas_Object * layout = moments_status_view_get_layout();
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout) == EINA_TRUE);
@@ -103,7 +103,7 @@ static void __case_check_status_layout_state_show(bool * is_passed)
static void __case_check_icon_state_show(bool * is_passed)
{
- Evas_Object * layout = get_moments_status_layout();
+ Evas_Object * layout = moments_status_view_get_layout();
TEST_ASSERT_TRUE(layout != NULL);
TEST_ASSERT_TRUE(evas_object_visible_get(layout) == EINA_TRUE);