Add TEST_CODE for bluetooth 67/131567/3
authorjunkyu han <junkyu.han@samsung.com>
Tue, 30 May 2017 04:59:48 +0000 (13:59 +0900)
committerjunkyu han <junkyu.han@samsung.com>
Tue, 30 May 2017 05:18:40 +0000 (14:18 +0900)
Change-Id: I12bd655a371c3a6da8226c1fb70c68bdc82eb0a5

inc/moments/moments.h
inc/moments/moments_status_view.h
inc/moments/moments_view_edje_conf.h
res/edje/circle/moments_status_bluetooth.edc [new file with mode: 0644]
res/edje/images/Bluetooth/bluetooth_connected.png [new file with mode: 0644]
res/edje/images/Bluetooth/bluetooth_on.png [new file with mode: 0644]
src/moments/moments_manager.c
src/moments/moments_status_view.c
test/feature_test/group_feature_moments_status_behavior.c
test/feature_test/group_feature_moments_status_view_ui.c
test/test_function.h

index 9ca3f2ac0eb78225fd182cce4a4685cecb4ca9c8..5e5e0295c59c9f936d45de2d59aa567b8e0f93b6 100755 (executable)
 
 #include <Elementary.h>
 
-#define MOMENT_STATUS_UTIL_FLIGHT_MODE 5
-#define MOMENT_STATUS_UTIL_CALL_DISABLE (-2)
-#define MOMENT_STATUS_UTIL_NETWORK_DISABLE 0
-#define MOMENT_STATUS_UTIL_NETWORK_PS_DISABLE (-1)
+#define MOMENT_STATUS_FLIGHT_MODE 5
+#define MOMENT_STATUS_CALL_DISABLE (-2)
+#define MOMENT_STATUS_NETWORK_DISABLE 0
+#define MOMENT_STATUS_NETWORK_PS_DISABLE (-1)
 #define MOMENT_STATUS_SIGNAL_WIFI_INDEX 10
 
 bool moments_get_visible(void);
index 12560f1f6b0774d25e5c5fa918e871b3893dfed6..57f66b0e1c27bad3f809057dbe68c0ab3b826b58 100644 (file)
@@ -49,9 +49,13 @@ void moments_status_simcard_icon_hide(void);
 void moments_status_location_icon_show(void);
 void moments_status_location_icon_hide(void);
 
+void moments_status_bluetooth_icon_show(void);
+void moments_status_bluetooth_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_network_update(int network_type, int packet_type);
+void moments_status_bluetooth_update(int on_off, int connected);
 void moments_status_update_view(void);
 
 #endif
index 563c40e62abaa4d9c464a85c797776c812034d52..49da1db9885bd66f232caf2a717381ea5a09ee03 100755 (executable)
@@ -24,6 +24,7 @@
 #define STATUS_NETWORK_LAYOUT "status_network_layout"
 #define STATUS_SIMCARD_LAYOUT "status_simcard_layout"
 #define STATUS_LOCATION_LAYOUT "status_location_layout"
+#define STATUS_BLUETOOTH_LAYOUT "status_bluetooth_layout"
 #define SIZE_SETTER "size_setter"
 #define MOMENTS_BG "moments_bg"
 #define MOMENTS_CONTENT "moments_content"
diff --git a/res/edje/circle/moments_status_bluetooth.edc b/res/edje/circle/moments_status_bluetooth.edc
new file mode 100644 (file)
index 0000000..ef8b031
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../../../inc/moments/moments_view_edje_conf.h"
+
+#define BLUETOOTH_DIR_PREFIX "Bluetooth"
+
+collections {
+   group { STATUS_BLUETOOTH_LAYOUT;
+      images {
+         image: BLUETOOTH_DIR_PREFIX"/bluetooth_on.png" COMP;
+         image: BLUETOOTH_DIR_PREFIX"/bluetooth_connected.png" COMP;
+      }
+      parts {
+         part {
+            name: "icon_image";
+            type: IMAGE;
+            description {
+                state: "default" 0.0;
+                align: 0.5 0.5;
+                rel1 { relative: 0.0 0.0; }
+                rel2 { relative: 1.0 1.0; }
+                image.normal: BLUETOOTH_DIR_PREFIX"/bluetooth_on.png";
+                color: 250 250 250 255;
+            }
+            description {
+                state: "connected" 0.0;
+                inherit: "default" 0.0;
+                image.normal: BLUETOOTH_DIR_PREFIX"/bluetooth_connected.png";
+            }
+                }
+      }
+         programs {
+                 program {
+                       name: "conneted";
+                       signal: "bt_connected";
+                       source: "bluetooth";
+                       action: STATE_SET "connected" 0.0;
+                       target: "icon_image";
+                 }
+                 program {
+                       name: "dis_conneted";
+                       signal: "bt_disconnected";
+                       source: "bluetooth";
+                       action: STATE_SET "default" 0.0;
+                       target: "icon_image";
+                 }
+         }
+   }
+}
+
+
diff --git a/res/edje/images/Bluetooth/bluetooth_connected.png b/res/edje/images/Bluetooth/bluetooth_connected.png
new file mode 100644 (file)
index 0000000..aa7dc5e
Binary files /dev/null and b/res/edje/images/Bluetooth/bluetooth_connected.png differ
diff --git a/res/edje/images/Bluetooth/bluetooth_on.png b/res/edje/images/Bluetooth/bluetooth_on.png
new file mode 100644 (file)
index 0000000..513c48f
Binary files /dev/null and b/res/edje/images/Bluetooth/bluetooth_on.png differ
index d172f1f6513981c926f4c21b316ef1e327a3ed9c..ad9f68bf650f35f40d42660c6be10d18d421ba56 100755 (executable)
@@ -38,12 +38,14 @@ static struct __manager_s {
        Evas_Object *layout;
        bool visible;
        bool on_initialization;
+       int before_wifi_state;
 } s_info = {
        .win = NULL,
        .bg_scroller = NULL,
        .layout = NULL,
        .visible = false,
        .on_initialization = false,
+       .before_wifi_state = 0,
 };
 
 static telephony_handle_list_s handle_list;
@@ -59,6 +61,7 @@ static void __flight_mode_changed_cb(keynode_t *node, void *user_data);
 static void __wifi_state_changed_cb(keynode_t *node, void *user_data);
 static void __simcard_state_changed_cb(telephony_h handle, telephony_noti_e noti_id, void *data, void *user_data);
 static void __location_service_state_changed_cb(runtime_info_key_e key, void *data);
+static void __bluetooth_state_changed_cb(keynode_t *node, void *user_data);
 static void __get_callsignal_state(bool *is_roaming, int *strength);
 static void __get_network_strength_and_packet_type(int *network_type, int *packet_type);
 static void __get_wifi_strength_and_packet_type(int *strength, int *packet_type);
@@ -175,6 +178,7 @@ static void __initialize_status_view(void)
                __call_network_service_state_changed_cb(NULL, 0, NULL, NULL);
                __location_service_state_changed_cb(0, NULL);
        }
+       __bluetooth_state_changed_cb(NULL, NULL);
 
        s_info.on_initialization = false;
 }
@@ -232,10 +236,15 @@ static void __register_status_callback(void)
                }
        }
 
+       /* FLIGHTI MODE */
        vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, __flight_mode_changed_cb, NULL);
+       /* WIFI */
        vconf_notify_key_changed(VCONFKEY_WIFI_STATE, __wifi_state_changed_cb, NULL);
        vconf_notify_key_changed(VCONFKEY_WIFI_TRANSFER_STATE, __wifi_state_changed_cb, NULL);
        vconf_notify_key_changed(VCONFKEY_WIFI_STRENGTH, __wifi_state_changed_cb, NULL);
+       /* BLUETOOTH */
+       vconf_notify_key_changed(VCONFKEY_BT_STATUS, __bluetooth_state_changed_cb, NULL);
+       vconf_notify_key_changed(VCONFKEY_WMS_WMANAGER_CONNECTED, __bluetooth_state_changed_cb, NULL);
 }
 
 static void __unregister_status_callback(void)
@@ -286,9 +295,13 @@ static void __unregister_status_callback(void)
                vconf_ignore_key_changed(VCONFKEY_DNET_STATE, __network_type_changed_cb);
        }
        vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, __flight_mode_changed_cb);
+
        vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, __wifi_state_changed_cb);
        vconf_ignore_key_changed(VCONFKEY_WIFI_TRANSFER_STATE, __wifi_state_changed_cb);
        vconf_ignore_key_changed(VCONFKEY_WIFI_STRENGTH, __wifi_state_changed_cb);
+
+       vconf_ignore_key_changed(VCONFKEY_BT_STATUS, __bluetooth_state_changed_cb);
+       vconf_ignore_key_changed(VCONFKEY_WMS_WMANAGER_CONNECTED, __bluetooth_state_changed_cb);
 }
 
 static void __battery_state_changed_cb(device_callback_e type, void *value, void *user_data)
@@ -312,7 +325,7 @@ static void __battery_state_changed_cb(device_callback_e type, void *value, void
        moments_status_battery_update(percent, converted_percent, is_charging);
 }
 
-static void __moments_manager_update_status_view(int is_flight, int _service_state, int wifi_state)
+static void __update_status_view_by_call_network_changed(int is_flight, int _service_state, int wifi_state)
 {
        int callsignal_strength = 0;
        int network_type = 0;
@@ -321,9 +334,9 @@ static void __moments_manager_update_status_view(int is_flight, int _service_sta
        telephony_network_service_state_e service_state = (telephony_network_service_state_e)_service_state;
 
        if (is_flight) {
-               callsignal_strength = MOMENT_STATUS_UTIL_FLIGHT_MODE;
-               network_type = MOMENT_STATUS_UTIL_NETWORK_DISABLE;
-               packet_type = MOMENT_STATUS_UTIL_NETWORK_PS_DISABLE;
+               callsignal_strength = MOMENT_STATUS_FLIGHT_MODE;
+               network_type = MOMENT_STATUS_NETWORK_DISABLE;
+               packet_type = MOMENT_STATUS_NETWORK_PS_DISABLE;
                moments_status_location_icon_hide();
        } else {
                if (service_state == TELEPHONY_NETWORK_SERVICE_STATE_IN_SERVICE) {
@@ -334,15 +347,15 @@ static void __moments_manager_update_status_view(int is_flight, int _service_sta
                        } else {
                                __get_network_strength_and_packet_type(&network_type, &packet_type);
                        }
-                       moments_status_location_icon_show();
+                       __location_service_state_changed_cb(0, NULL);
                } else {
                        if (wifi_state == VCONFKEY_WIFI_CONNECTED) {
                                __get_wifi_strength_and_packet_type(&network_type, &packet_type);
                        } else {
-                               callsignal_strength = MOMENT_STATUS_UTIL_CALL_DISABLE;
-                               network_type = MOMENT_STATUS_UTIL_NETWORK_DISABLE;
-                               packet_type = MOMENT_STATUS_UTIL_NETWORK_PS_DISABLE;
+                               network_type = MOMENT_STATUS_NETWORK_DISABLE;
+                               packet_type = MOMENT_STATUS_NETWORK_PS_DISABLE;
                        }
+                       callsignal_strength = MOMENT_STATUS_CALL_DISABLE;
                        moments_status_location_icon_hide();
                }
        }
@@ -374,7 +387,7 @@ static void __call_network_service_state_changed_cb(telephony_h handle, telephon
                return;
        }
 
-       __moments_manager_update_status_view(is_flight, (int)service_state, wifi_state);
+       __update_status_view_by_call_network_changed(is_flight, (int)service_state, wifi_state);
 }
 
 static void __flight_mode_changed_cb(keynode_t *node, void *user_data)
@@ -387,6 +400,28 @@ static void __wifi_state_changed_cb(keynode_t *node, void *user_data)
        _D("Wifi State is changed");
 }
 
+static void __bluetooth_state_changed_cb(keynode_t *node, void *user_data)
+{
+       _D("Bluetooth State is changed");
+       int on_off = 0;
+       int connected = 0;
+
+       if (vconf_get_int(VCONFKEY_BT_STATUS, &on_off) < 0) {
+               _E("Failed to get vocnfkey for BLUETOOTH ON/OFF");
+               return;
+       }
+
+       if (on_off) {
+               if (vconf_get_int(VCONFKEY_WMS_WMANAGER_CONNECTED, &connected) < 0) {
+                       _E("Failed to get vconkey for BLUETOOTH CONNECTED");
+                       return;
+               }
+       }
+
+       moments_status_bluetooth_update(on_off, connected);
+       moments_status_update_view();
+}
+
 static void __network_type_changed_cb(keynode_t *node, void *user_data)
 {
        __call_network_service_state_changed_cb(NULL, 0, NULL, NULL);
@@ -417,6 +452,7 @@ static void __simcard_state_changed_cb(telephony_h handle, telephony_noti_e noti
 static void __location_service_state_changed_cb(runtime_info_key_e key, void *data)
 {
        _D("LOCATION SERVICE STATE CHANGED");
+       int is_flight = 0;
        runtime_info_gps_status_e gps_status = 0;
 
        if (runtime_info_get_value_int(RUNTIME_INFO_KEY_GPS_STATUS, (int *)&gps_status) < 0) {
@@ -424,9 +460,16 @@ static void __location_service_state_changed_cb(runtime_info_key_e key, void *da
                return;
        }
 
+       if (vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &is_flight) < 0) {
+               _E("Failed to get FLIGHT MODE VCONFKEY");
+               return;
+       }
+
        if (gps_status == RUNTIME_INFO_GPS_STATUS_CONNECTED) {
                _D("Location is available, Show LOCATION icon");
-               moments_status_location_icon_show();
+               if (!is_flight) {
+                       moments_status_location_icon_show();
+               }
        } else {
                _D("Location is unavailable, Hide LOCATION icon");
                moments_status_location_icon_hide();
@@ -535,9 +578,14 @@ void __t__moments_restore_status_call_network_service_state(void)
        __call_network_service_state_changed_cb(NULL, 0, NULL, NULL);
 }
 
+void __t__moments_restore_status_bluetooth_state(void)
+{
+       __bluetooth_state_changed_cb(NULL, NULL);
+}
+
 void __t__moments_manager_update_status_view(int is_flight, int service_state, int wifi_state)
 {
-       __moments_manager_update_status_view(is_flight, service_state, wifi_state);
+       __update_status_view_by_call_network_changed(is_flight, service_state, wifi_state);
 }
 
 void __t__moments_get_callsignal_state(bool *is_roaming, int *strength)
index bd1916cb7cf6a823f125823918ab15238ba77355..75422dd9f8278b3efbc8cca2fda14dee9a480eee 100644 (file)
@@ -39,6 +39,7 @@
 #define STATUS_NETWORK_EDJE EDJE_DIR"/circle/moments_status_network.edj"
 #define STATUS_SIMCARD_EDJE EDJE_DIR"/circle/moments_status_simcard.edj"
 #define STATUS_LOCATION_EDJE EDJE_DIR"/circle/moments_status_location.edj"
+#define STATUS_BLUETOOTH_EDJE EDJE_DIR"/circle/moments_status_bluetooth.edj"
 
 static struct __status_view_s {
        Evas_Object *status_layout;
@@ -48,6 +49,7 @@ static struct __status_view_s {
        Evas_Object *status_network;
        Evas_Object *status_simcard;
        Evas_Object *status_location;
+       Evas_Object *status_bluetooth;
 } s_info = {
        .status_layout = NULL,
        .status_grid = NULL,
@@ -56,6 +58,7 @@ static struct __status_view_s {
        .status_network = NULL,
        .status_simcard = NULL,
        .status_location = NULL,
+       .status_bluetooth = NULL,
 };
 
 static status_icon_type_e __status_icon_priority_bt[STATUS_ICON_MAX_COUNT_BT] = {
@@ -116,6 +119,7 @@ static Evas_Object *__create_callsignal(Evas_Object *parent);
 static Evas_Object *__create_network(Evas_Object *parent);
 static Evas_Object *__create_simcard(Evas_Object *parent);
 static Evas_Object *__create_location(Evas_Object *parent);
+static Evas_Object *__create_bluetooth(Evas_Object *parent);
 
 Evas_Object *moments_status_view_create(Evas_Object *parent)
 {
@@ -286,6 +290,47 @@ void moments_status_location_icon_hide(void)
        __status_icon_list[STATUS_ICON_LOCATION] = NULL;
 }
 
+void moments_status_bluetooth_icon_show(void)
+{
+       if (s_info.status_bluetooth) moments_status_bluetooth_icon_hide();
+
+       s_info.status_bluetooth = __create_bluetooth(s_info.status_layout);
+
+       __status_icon_list[STATUS_ICON_BLUETOOTH] = s_info.status_bluetooth;
+       __status_icon_is_appended[STATUS_ICON_BLUETOOTH] = true;
+
+       __register_icon_type_to_list(STATUS_ICON_BLUETOOTH);
+}
+
+void moments_status_bluetooth_icon_hide(void)
+{
+       __unregister_icon_type_from_list(STATUS_ICON_BLUETOOTH);
+       __status_icon_is_appended[STATUS_ICON_BLUETOOTH] = false;
+
+       if (s_info.status_bluetooth) evas_object_del(s_info.status_bluetooth);
+       s_info.status_bluetooth = NULL;
+       __status_icon_list[STATUS_ICON_BLUETOOTH] = NULL;
+}
+
+void moments_status_bluetooth_update(int on_off, int connected)
+{
+       _D("Update bluetooth state, on_off[%d], connected[%d]", on_off, connected);
+
+       if (!on_off) {
+               moments_status_bluetooth_icon_hide();
+       } else {
+               if (!s_info.status_bluetooth) {
+                       moments_status_bluetooth_icon_show();
+               }
+
+               if (!connected) {
+                       elm_object_signal_emit(s_info.status_bluetooth, "bt_disconnected", "bluetooth");
+               } else {
+                       elm_object_signal_emit(s_info.status_bluetooth, "bt_connected", "bluetooth");
+               }
+       }
+}
+
 void moments_status_update_view(void)
 {
        _D("Update status icon list");
@@ -498,6 +543,22 @@ static Evas_Object *__create_location(Evas_Object *parent)
        return location;
 }
 
+static Evas_Object *__create_bluetooth(Evas_Object *parent)
+{
+       Evas_Object *bluetooth = elm_layout_add(parent);
+       if (!bluetooth || !elm_layout_file_set(bluetooth, util_get_res_file_path(STATUS_BLUETOOTH_EDJE), STATUS_BLUETOOTH_LAYOUT)) {
+               _E("Failed to create location layout");
+               return NULL;
+       }
+       evas_object_size_hint_min_set(bluetooth, MOMENTS_STATUS_ICON_W, MOMENTS_STATUS_ICON_H);
+       evas_object_size_hint_align_set(bluetooth, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_size_hint_weight_set(bluetooth, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_move(bluetooth, OUTSIDE_X, OUTSIDE_Y);
+       evas_object_show(bluetooth);
+
+       return bluetooth;
+}
+
 static int __get_icon_position_index(status_icon_type_e type)
 {
        Eina_List *list = NULL;
@@ -549,6 +610,11 @@ Evas_Object *__t__get_moments_status_location(void)
        return s_info.status_location;
 }
 
+Evas_Object *__t__get_moments_status_bluetooth(void)
+{
+       return s_info.status_bluetooth;
+}
+
 int __t__get_moments_status_icon_index(int type)
 {
        return __get_icon_position_index(type);
index 9b8a59b14a0d63717c4ddc097028f4c616595cd6..75cf0146ae1f8b49b66d8ff25827b79b478a3a21 100755 (executable)
 #define STATUS_CONTENT "status_content"
 #define STATUS_LAYOUT_EDJE "/usr/apps/org.tizen.w-home/res/edje/circle/moments_status_layout.edj"
 
-static unit_case_func_t __case_check_status_flight_on(void *data);
-static unit_case_func_t __case_check_status_flightoff_serviceoff_wifioff(void *data);
-static unit_case_func_t __case_check_status_flightoff_serviceon_wifioff(void *data);
-
 static void __status_restore_icons(void);
 
 static struct {
@@ -95,9 +91,8 @@ static void __group_tear_down(void)
 
 static bool call_is_for_test = false;
 static bool network_is_for_test = false;
-static bool location_is_for_test = false;
-static unit_case_func_t __continue_check_status_flight_on(void *data);
-static unit_case_func_t __case_check_status_flight_on(void *data)
+static unit_case_func_t __continue_check_status_flighton_serviceoff_wifioff(void *data);
+static unit_case_func_t __case_check_status_flighton_serviceoff_wifioff(void *data)
 {
        main_s *info = main_get_info();
        TEST_ASSERT_TRUE_UPGRADE(info != NULL);
@@ -121,8 +116,7 @@ static unit_case_func_t __case_check_status_flight_on(void *data)
        if (!location) {
                moments_status_location_icon_show();
                moments_status_update_view();
-               location_is_for_test = true;
-               TEST_CASE_CONTINUE(0.1, __case_check_status_flight_on, NULL);
+               TEST_CASE_CONTINUE(0.1, __case_check_status_flighton_serviceoff_wifioff, NULL);
        }
 
        __t__layout_mouse_down(info->layout, 180, 50);
@@ -132,10 +126,10 @@ static unit_case_func_t __case_check_status_flight_on(void *data)
        TEST_ASSERT_TRUE_UPGRADE(evas_object_visible_get(network));
        TEST_ASSERT_TRUE_UPGRADE(evas_object_visible_get(location));
 
-       TEST_CASE_CONTINUE(0.6, __continue_check_status_flight_on, NULL);
+       TEST_CASE_CONTINUE(0.6, __continue_check_status_flighton_serviceoff_wifioff, NULL);
 }
 
-static unit_case_func_t __continue_check_status_flight_on(void *data)
+static unit_case_func_t __continue_check_status_flighton_serviceoff_wifioff(void *data)
 {
        double val = 0.0;
        Evas_Object *callsignal = __t__get_moments_status_callsignal();
@@ -144,7 +138,7 @@ static unit_case_func_t __continue_check_status_flight_on(void *data)
        if (s_info.current_step == 0) {
                __t__moments_manager_update_status_view(1, 0, 0);
                s_info.current_step += 1;
-               TEST_CASE_CONTINUE(0.6, __continue_check_status_flight_on, NULL);
+               TEST_CASE_CONTINUE(0.6, __continue_check_status_flighton_serviceoff_wifioff, NULL);
        }
 
        TEST_ASSERT_EQUAL_STRING_UPGRADE("flight_mode", edje_object_part_state_get(elm_layout_edje_get(callsignal), "icon_image", &val));
@@ -160,6 +154,16 @@ static unit_case_func_t __continue_check_status_flight_on(void *data)
 static unit_case_func_t __continue_check_status_flightoff_serviceoff_wifioff(void *data);
 static unit_case_func_t __case_check_status_flightoff_serviceoff_wifioff(void *data)
 {
+       Evas_Object *location = __t__get_moments_status_location();
+       /* Create Location for service off scenario */
+       if (!location) {
+               moments_status_location_icon_show();
+               moments_status_update_view();
+               TEST_CASE_CONTINUE(0.2, __case_check_status_flightoff_serviceoff_wifioff, NULL);
+       }
+
+       TEST_ASSERT_TRUE_UPGRADE(location != NULL);
+
        __t__moments_manager_update_status_view(0, 1, 0);
        TEST_CASE_CONTINUE(0.6, __continue_check_status_flightoff_serviceoff_wifioff, NULL);
 }
@@ -204,9 +208,6 @@ static unit_case_func_t __continue_check_status_flightoff_serviceon_wifioff(void
        TEST_ASSERT_EQUAL_STRING_UPGRADE(__t__network_type[network_type], edje_object_part_state_get(elm_layout_edje_get(network), "type_icon_image", &val));
        TEST_ASSERT_EQUAL_STRING_UPGRADE(__t__network_type[network_type == 0 ? network_type : packet_type+15], edje_object_part_state_get(elm_layout_edje_get(network), "inout_icon_image", &val));
 
-       Evas_Object *location = __t__get_moments_status_location();
-       TEST_ASSERT_TRUE_UPGRADE(location);
-
        TEST_CASE_DONE(s_info.group);
 }
 
@@ -234,8 +235,41 @@ static unit_case_func_t __continue_check_status_flightoff_serviceon_wifion(void
        TEST_ASSERT_EQUAL_STRING_UPGRADE(__t__network_type[network_type+10], edje_object_part_state_get(elm_layout_edje_get(network), "type_icon_image", &val));
        TEST_ASSERT_EQUAL_STRING_UPGRADE(__t__network_type[packet_type+15], edje_object_part_state_get(elm_layout_edje_get(network), "inout_icon_image", &val));
 
+       TEST_CASE_DONE(s_info.group);
+}
+
+static unit_case_func_t __continue_check_status_flightoff_serviceoff_wifion(void *data);
+static unit_case_func_t __case_check_status_flightoff_serviceoff_wifion(void *data)
+{
        Evas_Object *location = __t__get_moments_status_location();
-       TEST_ASSERT_TRUE_UPGRADE(location);
+       if (!location) {
+               moments_status_location_icon_show();
+               moments_status_update_view();
+               TEST_CASE_CONTINUE(0.1, __case_check_status_flightoff_serviceoff_wifion, NULL);
+       }
+       __t__moments_manager_update_status_view(0, 1, 2);
+       TEST_CASE_CONTINUE(0.6, __continue_check_status_flightoff_serviceoff_wifion, NULL);
+}
+
+static unit_case_func_t __continue_check_status_flightoff_serviceoff_wifion(void *data)
+{
+       double val = 0.0;
+       int strength = 0;
+       int network_type = 0;
+       int packet_type = 0;
+       bool roaming = false;
+       Evas_Object *callsignal = __t__get_moments_status_callsignal();
+       Evas_Object *network = __t__get_moments_status_network();
+       Evas_Object *location = __t__get_moments_status_location();
+
+        __t__moments_get_callsignal_state(&roaming, &strength);
+        __t__moments_get_wifi_strength_and_packet_type(&network_type, &packet_type);
+
+       TEST_ASSERT_EQUAL_STRING_UPGRADE("default", edje_object_part_state_get(elm_layout_edje_get(callsignal), "icon_image", &val));
+       TEST_ASSERT_EQUAL_STRING_UPGRADE(__t__network_type[network_type+10], edje_object_part_state_get(elm_layout_edje_get(network), "type_icon_image", &val));
+       TEST_ASSERT_EQUAL_STRING_UPGRADE(__t__network_type[packet_type+15], edje_object_part_state_get(elm_layout_edje_get(network), "inout_icon_image", &val));
+
+       TEST_ASSERT_TRUE_UPGRADE(!evas_object_visible_get(location));
 
        TEST_CASE_DONE(s_info.group);
 }
@@ -246,12 +280,14 @@ void group_feature_moments_status_behavior(unit_group_t * group)
        s_info.group->set_up = __set_up;
        s_info.group->tear_down = __tear_down;
 
-       TEST_CASE_ADD(s_info.group, __case_check_status_flight_on, NULL);
-       TEST_CASE_ADD(s_info.group, __case_check_status_flightoff_serviceoff_wifioff, NULL);
+       TEST_CASE_ADD(s_info.group, __case_check_status_flighton_serviceoff_wifioff, NULL);
        if (moments_check_is_3g_device()) {
+               TEST_CASE_ADD(s_info.group, __case_check_status_flightoff_serviceoff_wifioff, NULL);
                TEST_CASE_ADD(s_info.group, __case_check_status_flightoff_serviceon_wifioff, NULL);
                TEST_CASE_ADD(s_info.group, __case_check_status_flightoff_serviceon_wifion, NULL);
+               TEST_CASE_ADD(s_info.group, __case_check_status_flightoff_serviceoff_wifion, NULL);
        }
+
        TEST_GROUP_TEAR_DOWN(s_info.group, __group_tear_down);
 
        TEST_GROUP_RUN(s_info.group);
@@ -265,12 +301,10 @@ static void __status_restore_icons(void)
        if (network_is_for_test) {
                moments_status_network_icon_hide();
        }
-       if (location_is_for_test) {
-               moments_status_location_icon_hide();
-       }
        if (!call_is_for_test && !network_is_for_test) {
                __t__moments_restore_status_call_network_service_state();
        }
+       __t__moments_restore_status_bluetooth_state();
 }
 
 #endif
index 9cf50f4693572675580d3f31d8fcfdf08b4e283a..c42a2d000a29d0590b0c61f8584888f3977d59c4 100755 (executable)
@@ -22,6 +22,7 @@ static unit_case_func_t __case_check_status_view_callsignal(void *data);
 static unit_case_func_t __case_check_status_view_network(void *data);
 static unit_case_func_t __case_check_status_view_simcard(void *data);
 static unit_case_func_t __case_check_status_view_location(void *data);
+static unit_case_func_t __case_check_status_view_bluetooth(void *data);
 
 static void __status_restore_icons(void);
 
@@ -72,6 +73,8 @@ static char *__network_type[19] = {
        "state_inout_connected"
 };
 
+static char *__bluetooth_state[3] = { "default", "connected", "" };
+
 static void __group_set_up(void)
 {
        if (moments_get_visible() == false) {
@@ -362,6 +365,7 @@ static unit_case_func_t __case_check_status_view_location(void *data)
        moments_status_update_view();
 
        TEST_CASE_CONTINUE(0.6, __continue_check_status_location_icon_change, location);
+       TEST_CASE_DONE(s_info.group);
 }
 
 static unit_case_func_t __continue_check_status_location_icon_change(void *data)
@@ -372,6 +376,59 @@ static unit_case_func_t __continue_check_status_location_icon_change(void *data)
        TEST_CASE_DONE(s_info.group);
 }
 
+static int bt_on_off = 1;
+static int bt_connected = 0;
+static unit_case_func_t __continue_check_status_bluetooth_icon_change(void *data);
+static unit_case_func_t __case_check_status_view_bluetooth(void *data)
+{
+       Evas_Object *bluetooth = __t__get_moments_status_bluetooth();
+       if (!bluetooth) {
+               moments_status_bluetooth_icon_show();
+               moments_status_update_view();
+               TEST_CASE_CONTINUE(0.3, __case_check_status_view_bluetooth, NULL);
+       }
+
+       TEST_ASSERT_TRUE_UPGRADE(evas_object_visible_get(bluetooth));
+
+       int index = __t__get_moments_status_icon_index(STATUS_ICON_BLUETOOTH);
+       TEST_ASSERT_TRUE_UPGRADE(index >= 0);
+
+       int x, y, w, h;
+       evas_object_geometry_get(bluetooth, &x, &y, &w, &h);
+       TEST_ASSERT_EQUAL_INT_UPGRADE(__t_status_icon_position[index][0], x);
+       TEST_ASSERT_EQUAL_INT_UPGRADE(__t_status_icon_position[index][1], y);
+       TEST_ASSERT_EQUAL_INT_UPGRADE(MOMENTS_STATUS_ICON_W, w);
+       TEST_ASSERT_EQUAL_INT_UPGRADE(MOMENTS_STATUS_ICON_H, h);
+
+       moments_status_update_view();
+       moments_status_bluetooth_update(bt_on_off, bt_connected);
+
+       TEST_CASE_CONTINUE(0.3, __continue_check_status_bluetooth_icon_change, bluetooth);
+}
+
+static unit_case_func_t __continue_check_status_bluetooth_icon_change(void *data)
+{
+       double val = 0.0;
+       Evas_Object *bluetooth = (Evas_Object *)data;
+
+       if (bt_connected < 2) {
+               TEST_ASSERT_EQUAL_STRING_UPGRADE(__bluetooth_state[bt_connected], edje_object_part_state_get(elm_layout_edje_get(bluetooth), "icon_image", &val));
+
+               if (bt_connected == 1) { // This time we should show off state
+                       bt_on_off = 0;
+               }
+               bt_connected++;
+
+               moments_status_bluetooth_update(bt_on_off, bt_connected);
+
+               TEST_CASE_CONTINUE(0.3, __continue_check_status_bluetooth_icon_change, bluetooth);
+       }
+
+       TEST_ASSERT_TRUE_UPGRADE(!evas_object_visible_get(bluetooth));
+
+       TEST_CASE_DONE(s_info.group);
+}
+
 void group_feature_moments_status_view_ui(unit_group_t * group)
 {
        s_info.group = group;
@@ -384,6 +441,7 @@ void group_feature_moments_status_view_ui(unit_group_t * group)
        TEST_CASE_ADD(s_info.group, __case_check_status_view_network, NULL);
        TEST_CASE_ADD(s_info.group, __case_check_status_view_simcard, NULL);
        TEST_CASE_ADD(s_info.group, __case_check_status_view_location, NULL);
+       TEST_CASE_ADD(s_info.group, __case_check_status_view_bluetooth, NULL);
        TEST_GROUP_TEAR_DOWN(s_info.group, __group_tear_down);
 
        TEST_GROUP_RUN(s_info.group);
@@ -406,6 +464,7 @@ static void __status_restore_icons(void)
        if (!call_is_for_test && !network_is_for_test) {
                __t__moments_restore_status_call_network_service_state();
        }
+       __t__moments_restore_status_bluetooth_state();
 }
 
 #endif
index f9f5e0709f3921c491ed70ba953ea643307d3ba4..74b7b168a6470e3d7a7392ecf36e5b0f10e70086 100755 (executable)
@@ -45,8 +45,12 @@ extern Evas_Object *__t__get_moments_status_callsignal(void);
 extern Evas_Object *__t__get_moments_status_network(void);
 extern Evas_Object *__t__get_moments_status_simcard(void);
 extern Evas_Object *__t__get_moments_status_location(void);
+extern Evas_Object *__t__get_moments_status_location(void);
+extern Evas_Object *__t__get_moments_status_bluetooth(void);
 extern void __t__moments_restore_status_battery(void);
 extern void __t__moments_restore_status_call_network_service_state(void);
+extern void __t__moments_restore_status_bluetooth_state(void);
+extern void __t__moments_flight_mode_just_turned_on_off(int turn_on);
 extern void __t__moments_manager_update_status_view(int is_flight, int service_state, int wifi_state);
 extern int __t__get_moments_status_icon_index(int type);