From: maneesha Date: Fri, 1 Dec 2017 07:15:15 +0000 (+0530) Subject: [TBT][tbtcoreapp][Non-ACR][Added TCs for CBHM APIs] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fae49c990b9a052cc69b51a6f27f7c176ac8f75b;p=test%2Ftct%2Fnative%2Fbehavior.git [TBT][tbtcoreapp][Non-ACR][Added TCs for CBHM APIs] Change-Id: I8503866656c6d10366c686a5459274865134449a Signed-off-by: maneesha --- diff --git a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk index 98d2963..e0f0cb6 100644 Binary files a/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk and b/release/binary-armv7l/org.tizen.tbtcoreapp-1.0.0-arm.tpk differ diff --git a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk index 9b85099..406d491 100644 Binary files a/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk and b/release/binary-x86/org.tizen.tbtcoreapp-1.0.0-x86.tpk differ diff --git a/tbtcoreapp/inc/model/tbt-info.h b/tbtcoreapp/inc/model/tbt-info.h index c6337e8..d0f197b 100755 --- a/tbtcoreapp/inc/model/tbt-info.h +++ b/tbtcoreapp/inc/model/tbt-info.h @@ -309,7 +309,10 @@ typedef enum { TBT_APP_MOTION_DETECTION, TBT_APP_CBHM_CHANGE_CALLBACK, TBT_APP_CBHM_MONITOR_CALLBACK, - TBT_APP_CBHM_TYPE_GET + TBT_APP_CBHM_TYPE_GET, + TBT_APP_CBHM_SELECTION_GET, + TBT_APP_CBHM_COUNT_GET, + TBT_APP_CBHM_STATE_GET //TBT_APP_DALI_SCROLL_BAR } tbt_app_type_e; diff --git a/tbtcoreapp/inc/utils/app_module_config.h b/tbtcoreapp/inc/utils/app_module_config.h index 4f21240..0460c7a 100755 --- a/tbtcoreapp/inc/utils/app_module_config.h +++ b/tbtcoreapp/inc/utils/app_module_config.h @@ -304,4 +304,7 @@ #define TBT_MODULE_APP_CBHM_CHANGE_CALLBACK #define TBT_MODULE_APP_CBHM_TYPE_GET #define TBT_MODULE_APP_CBHM_MONITOR_CALLBACK +#define TBT_MODULE_APP_CBHM_SELECTION_GET +#define TBT_MODULE_APP_CBHM_COUNT_GET +#define TBT_MODULE_APP_CBHM_STATE_GET #endif diff --git a/tbtcoreapp/inc/view/tbt-cbhm-view.h b/tbtcoreapp/inc/view/tbt-cbhm-view.h index bd90698..24f68df 100644 --- a/tbtcoreapp/inc/view/tbt-cbhm-view.h +++ b/tbtcoreapp/inc/view/tbt-cbhm-view.h @@ -38,7 +38,7 @@ * @typedef cbhm_callbacks_view * @since_tizen 4.0 */ -typedef struct _cbhm_callbacks_view cbhm_callbacks_view; +typedef struct _cbhm_view cbhm_view; /** * @brief Create CBHM test view @@ -48,7 +48,7 @@ typedef struct _cbhm_callbacks_view cbhm_callbacks_view; * @param[in] item of the main tbt menu * @return Pointer of cbhm_callbacks_view on success, otherwise NULL */ -cbhm_callbacks_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item); +cbhm_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item); #endif #endif // __TBT_LOCAL_VIEW_H__ diff --git a/tbtcoreapp/res/edje/3.0/mobile/cbhm_viewer.edc b/tbtcoreapp/res/edje/3.0/mobile/cbhm_viewer.edc new file mode 100755 index 0000000..a6a0335 --- /dev/null +++ b/tbtcoreapp/res/edje/3.0/mobile/cbhm_viewer.edc @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +#define TEXT_HEIGHT 0.08 +#define CONTENT_X_PAD 0.15 + +collections +{ + base_scale: 1.8; + group + { + name: "cbhm_test"; + parts{ + part{ + name: "_title"; + type: SWALLOW; + description{ + state: "default" 0.0; + align: 0.0 0.0; + visible: 1; + rel1 {relative: 0.0 0.0; } + rel2 {relative: 1.0 0.1; } + } + } + + part{ + name: "_callback"; + type: SWALLOW; + description{ + state: "default" 0.0; + align: 0.0 0.0; + visible: 1; + rel1 {relative: 0.0 0.1;} + rel2 {relative: 1.0 0.2;} + } + } + part{ + name: "controlr_part"; + type: SWALLOW; + description { + state: "default" 0.0; + rel1 {relative: 0.0 0.5;} + rel2 {relative: 1.0 0.8;} + visible: 1; + } + } + + swallow { + name: "_edittext"; + type: SWALLOW; + desc { + state: "default" 0 0; + visible: 1; + align: 0.5 0.5; + color: 236 255 255 249; + rel1.relative: 0.0 0.2; + rel2.relative: 1.0 0.5; + } + } + } + } +} \ No newline at end of file diff --git a/tbtcoreapp/res/edje/4.0/mobile/cbhm_viewer.edc b/tbtcoreapp/res/edje/4.0/mobile/cbhm_viewer.edc new file mode 100755 index 0000000..b1484ce --- /dev/null +++ b/tbtcoreapp/res/edje/4.0/mobile/cbhm_viewer.edc @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + +collections +{ + base_scale: 1.8; + group + { + name: "cbhm_test"; + parts{ + part{ + name: "_title"; + type: SWALLOW; + description{ + state: "default" 0.0; + align: 0.0 0.0; + visible: 1; + rel1 {relative: 0.0 0.0; } + rel2 {relative: 1.0 0.1; } + } + } + + part{ + name: "_callback"; + type: SWALLOW; + description{ + state: "default" 0.0; + align: 0.0 0.0; + visible: 1; + rel1 {relative: 0.0 0.1;} + rel2 {relative: 1.0 0.2;} + } + } + part{ + name: "controlr_part"; + type: SWALLOW; + description { + state: "default" 0.0; + rel1 {relative: 0.0 0.5;} + rel2 {relative: 1.0 0.8;} + visible: 1; + } + } + + swallow { + name: "_edittext"; + type: SWALLOW; + desc { + state: "default" 0 0; + visible: 1; + align: 0.5 0.5; + color: 236 255 255 249; + rel1.relative: 0.0 0.2; + rel2.relative: 1.0 0.5; + } + } + } + } +} diff --git a/tbtcoreapp/src/model/tbt-list.c b/tbtcoreapp/src/model/tbt-list.c index f0c1ae0..e8d81f8 100755 --- a/tbtcoreapp/src/model/tbt-list.c +++ b/tbtcoreapp/src/model/tbt-list.c @@ -2881,7 +2881,37 @@ static tbt_info tbtapps[] = .parent = "CBHM", .apptype = TBT_APP_CBHM_TYPE_GET, .icon_name = "dummy", - .info = "1.Please press any one of Copy button to copy the type of element to ClipBoard.
2. Press 'Display Type' button to display the last item added to clipboard
If The displayed type is as per selection the Test Case Passes else it Fails", + .info = "1.Please press any one of Copy button to copy the type of element to ClipBoard.
2. Press 'Display Type' button to display the last item added to ClipBoard
If The displayed type is as per selection the Test Case Passes else it Fails", + .result = 0 + }, + #endif +#ifdef TBT_MODULE_APP_CBHM_SELECTION_GET + { + .name = "CBHM Selection Get", + .parent = "CBHM", + .apptype = TBT_APP_CBHM_SELECTION_GET, + .icon_name = "dummy", + .info = "1.Type text in the Editor
2.Copy text to ClipBoard
3.Press Get Selection Button
4.The last text copied should be displayed in the label", + .result = 0 + }, + #endif +#ifdef TBT_MODULE_APP_CBHM_COUNT_GET + { + .name = "CBHM Get Count", + .parent = "CBHM", + .apptype = TBT_APP_CBHM_COUNT_GET, + .icon_name = "dummy", + .info = "1.Type text in the Editor
2.Copy text to ClipBoard
3.Repeat the previous two steps
4.Click Get Count button
5.The number of items in ClipBoard should be displayed.
6. You can cross check it by Clicking Show ClipBoard button", + .result = 0 + }, + #endif +#ifdef TBT_MODULE_APP_CBHM_STATE_GET + { + .name = "CBHM Get State", + .parent = "CBHM", + .apptype = TBT_APP_CBHM_STATE_GET, + .icon_name = "dummy", + .info = "1.Click on Show/Hide ClipBoard
2.Click on Show State the current state(Show/Hide) of ClipBoard should appear in label", .result = 0 } #endif diff --git a/tbtcoreapp/src/view/tbt-cbhm-view.c b/tbtcoreapp/src/view/tbt-cbhm-view.c index 199d2d1..f61d044 100755 --- a/tbtcoreapp/src/view/tbt-cbhm-view.c +++ b/tbtcoreapp/src/view/tbt-cbhm-view.c @@ -40,16 +40,18 @@ bool __is_cbhm_test_running = false; -struct _cbhm_callbacks_view { +struct _cbhm_view { common_view* view; location_manager_h manager; Evas_Object *lat_label; Evas_Object *lon_label; + Evas_Object *button1; Evas_Object *button2; Evas_Object *button3; Evas_Object *button4; + Evas_Object *editfield; tbt_app_type_e apptype; cbhm_h cbhm_handle; @@ -57,39 +59,61 @@ struct _cbhm_callbacks_view { bool monitorAdded; }; -static void _app_destroy_cb(void* this); -static Evas_Object *add_control_layout(cbhm_callbacks_view *this, - Evas_Object *parent); -static void update(cbhm_callbacks_view *this); +static char *get_selection_type(cbhm_sel_type_e type); +static void on_cbhm_item_changed(cbhm_h cbhm_handle, int item_count, + void *data); +static int on_cbhm_selection_get(cbhm_h cbhm_handle, const char *buf, + size_t len, void *data); +static void on_monitor_item_changed(cbhm_h cbhm_handle, bool active_state, + void *data); +static void _selection_type_set_cb(cbhm_sel_type_e type, + void *data); +static void _selection_type_show(void *data, Evas_Object *obj, + void *event_info); + + static void _add_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj, +static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static void _clear_label_button_pressed_cb(void *data, Evas_Object *obj, +static void _cbhm_count_get_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static void _show_clipboard_button_pressed_cb(void *data, Evas_Object *obj, +static void _cbhm_selection_get_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, +static void _clear_label_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static void _remove_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, +static void _hide_clipboard_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static void on_cbhm_item_changed(cbhm_h cbhm_handle, int item_count, - void *data); -static void on_monitor_item_changed(cbhm_h cbhm_handle, bool active_state, - void *data); -static void _text_type_button_pressed_cb(void *data, Evas_Object *obj, +static void _html_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); static void _markup_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static void _html_type_button_pressed_cb(void *data, Evas_Object *obj, +static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static void _selection_type_set_cb(cbhm_sel_type_e type, - void *data); -static void _selection_type_show(void *data, Evas_Object *obj, +static void _remove_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, void *event_info); -static char *get_selection_type(cbhm_sel_type_e type); +static void _show_clipboard_button_pressed_cb(void *data, Evas_Object *obj, + void *event_info); +static void _show_cbhm_state_button_pressed_cb(void *data, Evas_Object *obj, + void *event_info); +static void _text_type_button_pressed_cb(void *data, Evas_Object *obj, + void *event_info); + + +static Evas_Object *add_control_layout(cbhm_view *this, + Evas_Object *parent); +static void update(cbhm_view *this); + +static void _app_destroy_cb(void* this); +/** + * @function get_selection_type + * @since_tizen 4.0 + * @description Get Selection Type + * @parameter cbhm_sel_type_e: Type + * @return static char * + */ static char *get_selection_type(cbhm_sel_type_e type) { char msg[40]; @@ -118,29 +142,143 @@ static char *get_selection_type(cbhm_sel_type_e type) /** - * @function cbhm_callbacks_view_add + * @function on_cbhm_item_changed + * @since_tizen 4.0 + * @description Callback on CBHM Item Changed + * @parameter cbhm_handle: CBHM Handle, int: Item Count, void*: Void Pointer + * @return static void + */ +static void on_cbhm_item_changed(cbhm_h cbhm_handle, int item_count, void *data) +{ + cbhm_view *this = (cbhm_view*) data; + RETM_IF(NULL == this, "cbhm_view is null"); + char msg[100]; + snprintf(msg, sizeof(msg), "CBHM Item Changed Callback Hit with item number %d", item_count); + ui_utils_label_set_text(this->lon_label, msg, + "left"); +} + + +/** + * @function on_cbhm_selection_get + * @since_tizen 4.0 + * @description Callback on Selection Get + * @parameter cbhm_handle: CBHM Handle ,const char*: Buffer, size_t: len, void *: Data + * @return static int + */ +static int on_cbhm_selection_get(cbhm_h cbhm_handle, const char *buf, size_t len, void *data) +{ + cbhm_view *this = (cbhm_view*) data; + char msg[100]; + + snprintf(msg, sizeof(msg), "Data from Clipboard : %s", buf); + ui_utils_label_set_text(this->lat_label, msg, + "left"); + return 0; +} + + +/** + * @function on_monitor_item_changed + * @since_tizen 4.0 + * @description Callback on Monitor Item Changed + * @parameter cbhm_handle: CBHM Handle ,bool: active state, void*: Void Pointer + * @return static void + */ +static void on_monitor_item_changed(cbhm_h cbhm_handle, bool active_state, void *data) +{ + cbhm_view *this = (cbhm_view*) data; + RETM_IF(NULL == this, "cbhm_view is null"); + char msg[100]; + snprintf(msg, sizeof(msg), "CBHM Monitor Changed Callback Hit with active state %d", active_state); + ui_utils_label_set_text(this->lon_label, msg, + "left"); +return; +} + + +/** + * @function _selection_type_set_cb + * @since_tizen 4.0 + * @description Selection Type Set Cb + * @parameter cbhm_sel_type_e: Type, void *: Data + * @return static void + */ +static void _selection_type_set_cb(cbhm_sel_type_e type, void *data) +{ + int nRet; + char *hello_str; + cbhm_view *this = (cbhm_view*) data; + hello_str = (char *) malloc(50); + snprintf(hello_str, 50, "String : %s", get_selection_type(type)); + + nRet = cbhm_selection_type_set(this->cbhm_handle, type); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_type_set failed"); + + nRet = cbhm_selection_set(this->cbhm_handle, type, hello_str, strlen(hello_str)); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_set failed"); +} + + + +/** + * @function _selection_type_show + * @since_tizen 4.0 + * @description Show the selection type + * @parameter void* : Data, Evas_Object*: Evas Object Pointer, void* : Event Information + * @return static void + */ +static void _selection_type_show(void *data, Evas_Object *obj, void *event_info) +{ + cbhm_view *this = (cbhm_view*) data; + int nRet; + cbhm_sel_type_e sType; + + nRet = cbhm_latest_item_type_get(this->cbhm_handle, &sType); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_latest_item_type_get failed"); + + switch(sType) + { + case CBHM_SEL_TYPE_MARKUP : + ui_utils_label_set_text(this->lat_label, "Selection Type is Markup", "left"); + break; + case CBHM_SEL_TYPE_TEXT : + ui_utils_label_set_text(this->lat_label, "Selection Type is Text", "left"); + break; + case CBHM_SEL_TYPE_HTML : + ui_utils_label_set_text(this->lat_label, "Selection Type is HTML", "left"); + break; + default : + ui_utils_label_set_text(this->lat_label, "Unknown Type", "left"); + } +} + + + +/** + * @function cbhm_view_add * @since_tizen 4.0 - * @description CBHM Callbacks View Add + * @description CBHM View Add * @parameter Evas_Object*: Evas Object Pointer, tbt_info*: Tbt Info Pointer, Elm_Object_Item*: Elm Object Item Pointer - * @return cbhm_callbacks_view* + * @return cbhm_view* */ -cbhm_callbacks_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item) +cbhm_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item) { RETVM_IF(NULL == navi, NULL, "navi is null"); int nRet; char msg[100]; - cbhm_callbacks_view *this = NULL; + cbhm_view *this = NULL; - this = calloc(1, sizeof(cbhm_callbacks_view)); + this = calloc(1, sizeof(cbhm_view)); RETVM_IF(!this, NULL, "calloc failed"); this->view = calloc(1, sizeof(common_view)); RETVM_IF(!this->view, NULL, "calloc failed"); tbt_info->layout_group = "cbhm_test"; - tbt_info->layout_file = get_edje_path("cbhm_callback_viewer.edj"); + tbt_info->layout_file = get_edje_path("cbhm_viewer.edj"); common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this); @@ -157,8 +295,8 @@ cbhm_callbacks_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Ob elm_label_line_wrap_set(this->lat_label, ELM_WRAP_CHAR); elm_label_line_wrap_set(this->lat_label, ELM_WRAP_CHAR); - ui_utils_label_set_text(this->lat_label, "???", "left"); - ui_utils_label_set_text(this->lon_label, "???", "left"); + ui_utils_label_set_text(this->lat_label, "", "left"); + ui_utils_label_set_text(this->lon_label, "", "left"); elm_object_part_content_set(this->view->layout, "_title", this->lat_label); @@ -169,7 +307,8 @@ cbhm_callbacks_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Ob elm_object_part_content_set(this->view->layout, "controlr_part", table); - if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK) + + if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK || this->apptype == TBT_APP_CBHM_COUNT_GET || this->apptype == TBT_APP_CBHM_SELECTION_GET) { //Create an editfield this->editfield = ui_utils_entry_add(this, this->view->layout, ELM_INPUT_PANEL_LAYOUT_NORMAL, "Trial Text"); @@ -187,65 +326,7 @@ cbhm_callbacks_view *cbhm_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Ob } -/** - * @function add_control_layout - * @since_tizen 4.0 - * @description Add Control Layout - * @parameter cbhm_callbacks_view*: CBHM Callbacks View Pointer, Evas_Object*: Evas Object Pointer - * @return static Evas_Object* - */ -static Evas_Object *add_control_layout(cbhm_callbacks_view *this, Evas_Object *parent) -{ - RETVM_IF(NULL == this, NULL, "view is NULL"); - - Evas_Object *table = elm_table_add(parent); - - evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); - evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL); - evas_object_show(table); - - elm_table_padding_set(table, TABLE_PADDING_HORIZONTAL, - TABLE_PADDING_VERTICAL); - if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK ) - { - this->button1 = ui_utils_push_button_add(this, table, "Add Callback", - _add_cb_button_pressed_cb); - this->button2 = ui_utils_push_button_add(this, table, "Remove Callback", - _rem_cb_button_pressed_cb); - this->button3= ui_utils_push_button_add(this, table, "Clear Label", - _clear_label_button_pressed_cb); - this->button4= ui_utils_push_button_add(this, table, "Show ClipBoard", - _show_clipboard_button_pressed_cb); - } - else if(this->apptype == TBT_APP_CBHM_MONITOR_CALLBACK) - { - this->button1= ui_utils_push_button_add(this, table, "Add Monitor CB", - _add_monitor_callback_button_pressed_cb); - this->button2 = ui_utils_push_button_add(this, table, "Remove Monitor CB", - _remove_monitor_callback_button_pressed_cb); - this->button3= ui_utils_push_button_add(this, table, "Clear Label", - _clear_label_button_pressed_cb); - this->button4 = ui_utils_push_button_add(this, table, "Show Clipboard", - _show_clipboard_button_pressed_cb); - } - else - { - this->button1 = ui_utils_push_button_add(this, table, "Copy Text", - _text_type_button_pressed_cb); - this->button2 = ui_utils_push_button_add(this, table, "Copy Markup", - _markup_type_button_pressed_cb); - this->button3 = ui_utils_push_button_add(this, table, "Copy HTML", - _html_type_button_pressed_cb); - this->button4 = ui_utils_push_button_add(this, table, "Display Type", - _selection_type_show); - } - elm_table_pack(table, this->button1, 0, 0, 1, 1); - elm_table_pack(table, this->button2, 1, 0, 2, 1); - elm_table_pack(table, this->button3, 0, 1, 1, 2); - elm_table_pack(table, this->button4, 1, 1, 2, 2); - return table; -} /** * @function _add_cb_button_pressed_cb @@ -256,8 +337,8 @@ static Evas_Object *add_control_layout(cbhm_callbacks_view *this, Evas_Object */ static void _add_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - RETM_IF(NULL == this, "cbhm_callbacks_view is null"); + cbhm_view *this = (cbhm_view*) data; + RETM_IF(NULL == this, "cbhm_view is null"); int nRet = 0; @@ -272,28 +353,61 @@ static void _add_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_ } /** - * @function _rem_cb_button_pressed_cb + * @function _add_monitor_callback_button_pressed_cb * @since_tizen 4.0 - * @description Remove Callback Button Pressed Cb + * @description Add Monitor Callback Button Pressed Cb * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer * @return static void */ -static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - int nRet = 0; - RETM_IF(NULL == this, "cbhm_callbacks_view is null"); - - if(this->callbackAdded == true) + cbhm_view *this = (cbhm_view*) data; + if(this->monitorAdded == false) { - nRet = cbhm_item_changed_callback_remove(this->cbhm_handle, on_cbhm_item_changed, data); - RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_item_changed_callback_remove failed"); - this->callbackAdded = false; + int nRet = cbhm_monitor_callback_add(this->cbhm_handle, on_monitor_item_changed, data); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_monitor_callback_add failed"); + ui_utils_label_set_text(this->lat_label, "Add Monitor Callback", "left"); + this->monitorAdded = true; } +} - update(this); + +/** + * @function on_cbhm_item_changed + * @since_tizen 4.0 + * @description Callback on CBHM Item Changed + * @parameter cbhm_handle: CBHM Handle, int: Item Count, void*: Void Pointer + * @return static void + */ +static void _cbhm_count_get_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +{ + cbhm_view *this = (cbhm_view*) data; + char msg[100]; + int item_count = cbhm_item_count_get(this->cbhm_handle); + snprintf(msg, sizeof(msg), "CBHM Item Count is : %d", item_count); + ui_utils_label_set_text(this->lat_label, msg, + "left"); +} + + +/** + * @function _cbhm_selection_get_button_pressed_cb + * @since_tizen 4.0 + * @description Selection Text Get Button Pressed Cb + * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer + * @return static void + */ +static void _cbhm_selection_get_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +{ + cbhm_view *this = (cbhm_view*) data; + int nRet; + cbhm_sel_type_e eType = CBHM_SEL_TYPE_TEXT; + nRet = cbhm_selection_get(this->cbhm_handle, eType, on_cbhm_selection_get, data); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_get failed"); } + + /** * @function _clear_label_button_pressed_cb * @since_tizen 4.0 @@ -303,48 +417,78 @@ static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_ */ static void _clear_label_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - RETM_IF(NULL == this, "cbhm_callbacks_view is null"); + cbhm_view *this = (cbhm_view*) data; + RETM_IF(NULL == this, "cbhm_view is null"); ui_utils_label_set_text(this->lat_label, "Cleared Label", "left"); - ui_utils_label_set_text(this->lon_label, "Waiting for Event", "left"); + if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK || this->apptype == TBT_APP_CBHM_MONITOR_CALLBACK) + ui_utils_label_set_text(this->lon_label, "Cleared Label", "left"); } +/** + * @function _hide_clipboard_button_pressed_cb + * @since_tizen 4.0 + * @description Hide Clipboard Button Pressed Cb + * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer + * @return static void + */ +static void _hide_clipboard_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +{ + cbhm_view *this = (cbhm_view*) data; + RETM_IF(NULL == this, "cbhm_view is null"); + int nRet = cbhm_hide(this->cbhm_handle); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_hide failed"); + +} /** - * @function _show_clipboard_button_pressed_cb + * @function _html_type_button_pressed_cb * @since_tizen 4.0 - * @description Show Clipboard Button Pressed Cb + * @description HTML type Button Pressed Cb * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer * @return static void */ -static void _show_clipboard_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _html_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - RETM_IF(NULL == this, "cbhm_callbacks_view is null"); - int nRet = cbhm_show(this->cbhm_handle); - RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_show failed"); - ui_utils_label_set_text(this->lat_label, "Show Clipboard", "left"); + _selection_type_set_cb(CBHM_SEL_TYPE_HTML, data); } /** - * @function _add_monitor_callback_button_pressed_cb + * @function _markup_type_button_pressed_cb * @since_tizen 4.0 - * @description Add Monitor Callback Button Pressed Cb + * @description Markup Type BUtton Pressed Cb * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer * @return static void */ -static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) + +static void _markup_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - if(this->monitorAdded == false) + _selection_type_set_cb(CBHM_SEL_TYPE_MARKUP, data); +} + + +/** + * @function _rem_cb_button_pressed_cb + * @since_tizen 4.0 + * @description Remove Callback Button Pressed Cb + * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer + * @return static void + */ +static void _rem_cb_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +{ + cbhm_view *this = (cbhm_view*) data; + int nRet = 0; + RETM_IF(NULL == this, "cbhm_view is null"); + + if(this->callbackAdded == true) { - int nRet = cbhm_monitor_callback_add(this->cbhm_handle, on_monitor_item_changed, data); - RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_monitor_callback_add failed"); - ui_utils_label_set_text(this->lat_label, "Add Monitor Callback", "left"); - this->monitorAdded = true; + nRet = cbhm_item_changed_callback_remove(this->cbhm_handle, on_cbhm_item_changed, data); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_item_changed_callback_remove failed"); + this->callbackAdded = false; } + + update(this); } @@ -357,7 +501,7 @@ static void _add_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj */ static void _remove_monitor_callback_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; + cbhm_view *this = (cbhm_view*) data; if(this->monitorAdded == true) { int nRet = cbhm_monitor_callback_remove(this->cbhm_handle, on_monitor_item_changed, data); @@ -367,96 +511,167 @@ static void _remove_monitor_callback_button_pressed_cb(void *data, Evas_Object * } } + /** - * @function _text_type_button_pressed_cb + * @function _show_clipboard_button_pressed_cb * @since_tizen 4.0 - * @description Text Type Button Pressed Cb + * @description Show Clipboard Button Pressed Cb * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer * @return static void */ -static void _text_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _show_clipboard_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - _selection_type_set_cb(CBHM_SEL_TYPE_TEXT, data); + cbhm_view *this = (cbhm_view*) data; + RETM_IF(NULL == this, "cbhm_view is null"); + + int nRet = cbhm_show(this->cbhm_handle); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_show failed"); + } /** - * @function _markup_type_button_pressed_cb + * @function _show_clipboard_button_pressed_cb * @since_tizen 4.0 - * @description Markup Type BUtton Pressed Cb + * @description Show Clipboard Button Pressed Cb * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer * @return static void */ - -static void _markup_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _show_cbhm_state_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - _selection_type_set_cb(CBHM_SEL_TYPE_MARKUP, data); + cbhm_view *this = (cbhm_view*) data; + cbhm_state_type_e sType; + RETM_IF(NULL == this, "cbhm_view is null"); + int nRet = cbhm_state_get(this->cbhm_handle, &sType); + RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_state_get failed"); + + switch(sType) + { + case CBHM_STATE_NONE : + ui_utils_label_set_text(this->lat_label, "Clip Board State is : None", "left"); + break; + case CBHM_STATE_SHOW : + ui_utils_label_set_text(this->lat_label, "Clip Board State is : Show", "left"); + break; + case CBHM_STATE_HIDE : + ui_utils_label_set_text(this->lat_label, "Clip Board State is : Hide", "left"); + break; + default : + ui_utils_label_set_text(this->lat_label, "Unknown State", "left"); + } } /** - * @function _html_type_button_pressed_cb + * @function _text_type_button_pressed_cb * @since_tizen 4.0 - * @description HTML type Button Pressed Cb + * @description Text Type Button Pressed Cb * @parameter void*: Void Pointer, Evas_Object*: Evas Object Pointer, void*: Void Pointer * @return static void */ -static void _html_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) +static void _text_type_button_pressed_cb(void *data, Evas_Object *obj, void *event_info) { - _selection_type_set_cb(CBHM_SEL_TYPE_HTML, data); + _selection_type_set_cb(CBHM_SEL_TYPE_TEXT, data); } /** - * @function _selection_type_set_cb + * @function add_control_layout * @since_tizen 4.0 - * @description Selection Type Set Cb - * @parameter cbhm_sel_type_e: Type, void *: Data - * @return static void + * @description Add Control Layout + * @parameter cbhm_view*: CBHM Callbacks View Pointer, Evas_Object*: Evas Object Pointer + * @return static Evas_Object* */ -static void _selection_type_set_cb(cbhm_sel_type_e type, void *data) +static Evas_Object *add_control_layout(cbhm_view *this, Evas_Object *parent) { - int nRet; - char *hello_str; - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - hello_str = (char *) malloc(50); - snprintf(hello_str, 50, "String : %s", get_selection_type(type)); - - nRet = cbhm_selection_type_set(this->cbhm_handle, type); - RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_type_set failed"); - - nRet = cbhm_selection_set(this->cbhm_handle, type, hello_str, strlen(hello_str)); - RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_set failed"); -} + RETVM_IF(NULL == this, NULL, "view is NULL"); + Evas_Object *table = elm_table_add(parent); -/** - * @function _selection_type_show - * @since_tizen 4.0 - * @description Show the selection type - * @parameter void* : Data, Evas_Object*: Evas Object Pointer, void* : Event Information - * @return static void - */ -static void _selection_type_show(void *data, Evas_Object *obj, void *event_info) -{ - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - int nRet; - cbhm_sel_type_e sType; + evas_object_size_hint_weight_set(table, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); + evas_object_size_hint_align_set(table, EVAS_HINT_FILL, EVAS_HINT_FILL); + evas_object_show(table); - nRet = cbhm_latest_item_type_get(this->cbhm_handle, &sType); - RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_latest_item_type_get failed"); + elm_table_padding_set(table, TABLE_PADDING_HORIZONTAL, + TABLE_PADDING_VERTICAL); + int button_table = 1; - switch(sType) + switch(this->apptype) { - case CBHM_SEL_TYPE_MARKUP : - ui_utils_label_set_text(this->lat_label, "Selection Type is Markup", "left"); + case TBT_APP_CBHM_CHANGE_CALLBACK : + this->button1 = ui_utils_push_button_add(this, table, "Add Callback", + _add_cb_button_pressed_cb); + this->button2 = ui_utils_push_button_add(this, table, "Remove Callback", + _rem_cb_button_pressed_cb); + this->button3= ui_utils_push_button_add(this, table, "Clear Label", + _clear_label_button_pressed_cb); + this->button4= ui_utils_push_button_add(this, table, "Show ClipBoard", + _show_clipboard_button_pressed_cb); break; - case CBHM_SEL_TYPE_TEXT : - ui_utils_label_set_text(this->lat_label, "Selection Type is Text", "left"); + case TBT_APP_CBHM_MONITOR_CALLBACK : + + this->button1= ui_utils_push_button_add(this, table, "Add Monitor CB", + _add_monitor_callback_button_pressed_cb); + this->button2 = ui_utils_push_button_add(this, table, "Remove Monitor CB", + _remove_monitor_callback_button_pressed_cb); + this->button3= ui_utils_push_button_add(this, table, "Clear Label", + _clear_label_button_pressed_cb); + this->button4 = ui_utils_push_button_add(this, table, "Show Clipboard", + _show_clipboard_button_pressed_cb); break; - case CBHM_SEL_TYPE_HTML : - ui_utils_label_set_text(this->lat_label, "Selection Type is HTML", "left"); + case TBT_APP_CBHM_TYPE_GET : + this->button1 = ui_utils_push_button_add(this, table, "Copy Text", + _text_type_button_pressed_cb); + this->button2 = ui_utils_push_button_add(this, table, "Copy Markup", + _markup_type_button_pressed_cb); + this->button3 = ui_utils_push_button_add(this, table, "Copy HTML", + _html_type_button_pressed_cb); + this->button4 = ui_utils_push_button_add(this, table, "Display Type", + _selection_type_show); + break; + case TBT_APP_CBHM_SELECTION_GET : + this->button1 = ui_utils_push_button_add(this, table, "Show ClipBoard", + _show_clipboard_button_pressed_cb); + this->button2 = ui_utils_push_button_add(this, table, "Clear Label", + _clear_label_button_pressed_cb); + this->button3 = ui_utils_push_button_add(this, table, "Get Selection", + _cbhm_selection_get_button_pressed_cb); + button_table = 0; + break; + case TBT_APP_CBHM_COUNT_GET : + this->button1 = ui_utils_push_button_add(this, table, "Show ClipBoard", + _show_clipboard_button_pressed_cb); + this->button2 = ui_utils_push_button_add(this, table, "Clear Label", + _clear_label_button_pressed_cb); + this->button3 = ui_utils_push_button_add(this, table, "Show Count", + _cbhm_count_get_button_pressed_cb); + button_table = 0; + break; + case TBT_APP_CBHM_STATE_GET : + this->button1 = ui_utils_push_button_add(this, table, "Show State", + _show_cbhm_state_button_pressed_cb); + this->button2 = ui_utils_push_button_add(this, table, "Show ClipBoard", + _show_clipboard_button_pressed_cb); + this->button3 = ui_utils_push_button_add(this, table, "Clear Label", + _clear_label_button_pressed_cb); + this->button4 = ui_utils_push_button_add(this, table, "Hide Clipboard", + _hide_clipboard_button_pressed_cb); break; default : - ui_utils_label_set_text(this->lat_label, "Unknown Type", "left"); + break; + } + + if(button_table == 1) + { + elm_table_pack(table, this->button1, 0, 0, 1, 1); + elm_table_pack(table, this->button2, 1, 0, 2, 1); + elm_table_pack(table, this->button3, 0, 1, 1, 2); + elm_table_pack(table, this->button4, 1, 1, 2, 2); } + else + { + elm_table_pack(table, this->button1, 0, 0, 1, 1); + elm_table_pack(table, this->button2, 1, 0, 2, 1); + elm_table_pack(table, this->button3, 0, 1, 2, 2); + } + return table; } @@ -464,65 +679,35 @@ static void _selection_type_show(void *data, Evas_Object *obj, void *event_info) * @function update * @since_tizen 4.0 * @description Update - * @parameter cbhm_callbacks_view*: CBHM Callbacks View Pointer + * @parameter cbhm_view*: CBHM Callbacks View Pointer * @return static void */ -static void update(cbhm_callbacks_view *this) +static void update(cbhm_view *this) { - RETM_IF(NULL == this, "cbhm_callbacks_view is null"); + RETM_IF(NULL == this, "cbhm_view is null"); - if (this->callbackAdded) + if(this->apptype == TBT_APP_CBHM_CHANGE_CALLBACK || this->apptype == TBT_APP_CBHM_MONITOR_CALLBACK) { - ui_utils_label_set_text(this->lat_label, "Callback added", "left"); - ui_utils_label_set_text(this->lon_label, "Waiting for callback...", - "left"); + if (this->callbackAdded) + { + ui_utils_label_set_text(this->lat_label, "Callback added", "left"); + ui_utils_label_set_text(this->lon_label, "Waiting for callback...", + "left"); + } + else + { + ui_utils_label_set_text(this->lat_label, "No Callback Added", "left"); + ui_utils_label_set_text(this->lon_label, "Waiting for callback...", + "left"); + } } else { - ui_utils_label_set_text(this->lat_label, "No Callback Added", "left"); - ui_utils_label_set_text(this->lon_label, "Waiting for callback...", - "left"); + ui_utils_label_set_text(this->lat_label, "Label", "left"); } } -/** - * @function on_cbhm_item_changed - * @since_tizen 4.0 - * @description Callback on CBHM Item Changed - * @parameter cbhm_handle: CBHM Handle, int: Item Count, void*: Void Pointer - * @return static void - */ -static void on_cbhm_item_changed(cbhm_h cbhm_handle, int item_count, void *data) -{ - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - RETM_IF(NULL == this, "cbhm_callbacks_view is null"); - char msg[100]; - snprintf(msg, sizeof(msg), "CBHM Item Changed Callback Hit with item number %d", item_count); - ui_utils_label_set_text(this->lon_label, msg, - "left"); -} - - -/** - * @function on_monitor_item_changed - * @since_tizen 4.0 - * @description Callback on Monitor Item Changed - * @parameter cbhm_handle: CBHM Handle ,bool: active state, void*: Void Pointer - * @return static void - */ -static void on_monitor_item_changed(cbhm_h cbhm_handle, bool active_state, void *data) -{ - cbhm_callbacks_view *this = (cbhm_callbacks_view*) data; - RETM_IF(NULL == this, "cbhm_callbacks_view is null"); - char msg[100]; - snprintf(msg, sizeof(msg), "CBHM Monitor Changed Callback Hit with active state %d", active_state); - ui_utils_label_set_text(this->lon_label, msg, - "left"); -return; -} - - /** * @function _app_destroy_cb * @since_tizen 4.0 @@ -534,8 +719,8 @@ static void _app_destroy_cb(void* this) { RETM_IF(NULL == this, "data is NULL"); - cbhm_callbacks_view *view = NULL; - view = (cbhm_callbacks_view*) this; + cbhm_view *view = NULL; + view = (cbhm_view*) this; RETM_IF(NULL == view, "view is NULL"); __is_cbhm_test_running = false; @@ -552,6 +737,4 @@ static void _app_destroy_cb(void* this) SAFE_DELETE(view->view); SAFE_DELETE(view); } - - #endif diff --git a/tbtcoreapp/src/view/tbt-genlist-view.c b/tbtcoreapp/src/view/tbt-genlist-view.c index d0b1e75..9a0a92d 100755 --- a/tbtcoreapp/src/view/tbt-genlist-view.c +++ b/tbtcoreapp/src/view/tbt-genlist-view.c @@ -1269,6 +1269,15 @@ static void _gl_item_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void case TBT_APP_CBHM_TYPE_GET : cbhm_view_add(view->navi, info, it); break; + case TBT_APP_CBHM_SELECTION_GET : + cbhm_view_add(view->navi, info, it); + break; + case TBT_APP_CBHM_COUNT_GET : + cbhm_view_add(view->navi, info, it); + break; + case TBT_APP_CBHM_STATE_GET : + cbhm_view_add(view->navi, info, it); + break; #endif default: assert(false);