2 * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
27 /* notification header */
28 #include <notification.h>
29 #include <notification_internal.h>
30 #include <notification_ongoing_flag.h>
31 #include <notification_status.h>
32 #include <notification_setting.h>
33 #include <notification_setting_internal.h>
34 #include <notification_list.h>
35 #include <notification_text_domain.h>
36 #include <tzplatform_config.h>
38 #define PATH_FMT_RO_APP_ROOT tzplatform_getenv(TZ_SYS_RO_APP)
39 #define TIZEN_PATH_MAX 1024
41 /*-----------------------------------------------------------------------------------------*/
43 typedef enum testapp_menu_type {
44 TESTAPP_MENU_TYPE_MAIN_MENU = 1,
45 TESTAPP_MENU_TYPE_BASIC_TEST_MENU = 2,
46 TESTAPP_MENU_TYPE_SETTING_TEST_MENU = 3
47 } testapp_menu_type_e;
49 /*-----------------------------------------------------------------------------------------*/
50 /* function prototypes */
51 static void testapp_system_signal_handler(int signal_number);
52 void testapp_show_prompt(testapp_menu_type_e menu);
54 /*-----------------------------------------------------------------------------------------*/
56 void testapp_print(char *fmt, ...)
60 vfprintf(stdout, fmt, args);
65 static gboolean testapp_initialize_testing()
67 struct timeval tv_1, tv_2;
70 /* register signal handler */
71 if (signal(SIGINT, testapp_system_signal_handler) == SIG_ERR) {
72 testapp_print("register signal handler fail\n");
76 if (signal(SIGQUIT, testapp_system_signal_handler) == SIG_ERR) {
77 testapp_print("register signal handler fail\n");
81 if (signal(SIGTSTP, testapp_system_signal_handler) == SIG_ERR) {
82 testapp_print("register signal handler fail\n");
86 if (signal(SIGTERM, testapp_system_signal_handler) == SIG_ERR) {
87 testapp_print("register signal handler fail\n");
92 gettimeofday(&tv_1, NULL);
94 /* TODO : initializing notification */
96 gettimeofday(&tv_2, NULL);
97 interval = tv_2.tv_usec - tv_1.tv_usec;
98 testapp_print("\t Initializing Proceed time %d us\n", interval);
104 static gboolean testapp_finalize_testing()
106 /* TODO : finalizing notification */
111 static void testapp_system_signal_handler(int signal_number)
113 testapp_print("signal:%d\n", signal_number);
114 switch (signal_number) {
119 testapp_finalize_testing();
123 testapp_print("unhandled signal:%d\n", signal_number);
132 void testapp_show_menu(testapp_menu_type_e menu)
135 case TESTAPP_MENU_TYPE_MAIN_MENU:
136 testapp_print("==========================================\n");
137 testapp_print(" Notification test application \n");
138 testapp_print("==========================================\n");
139 testapp_print("1. Basic Test\n");
140 testapp_print("2. Setting Test\n");
141 testapp_print("0. Exit \n");
142 testapp_print("------------------------------------------\n");
144 case TESTAPP_MENU_TYPE_BASIC_TEST_MENU:
145 testapp_print("==========================================\n");
146 testapp_print(" Basic test menu \n");
147 testapp_print("==========================================\n");
148 testapp_print(" 1. Post a simple notification\n");
149 testapp_print(" 2. Post simple notifications repeatedly\n");
150 testapp_print(" 3. Post a notification on indicator\n");
151 testapp_print(" 4. Post status status message\n");
152 testapp_print(" 5. Delete all notification\n");
153 testapp_print(" 6. Post a heads notification with a button\n");
154 testapp_print(" 7. Post a notification with domain text\n");
155 testapp_print(" 8. Load by tag\n");
156 testapp_print(" 9. Get list\n");
157 testapp_print(" 10. Post noti to 5002 \n");
158 testapp_print("------------------------------------------\n");
160 case TESTAPP_MENU_TYPE_SETTING_TEST_MENU:
161 testapp_print("==========================================\n");
162 testapp_print(" Setting test menu \n");
163 testapp_print("==========================================\n");
164 testapp_print(" 1. Get setting list\n");
165 testapp_print(" 2. Update setting\n");
166 testapp_print(" 3. Update system setting\n");
167 testapp_print(" 4. Refresh setting table\n");
168 testapp_print("------------------------------------------\n");
174 /* Common { ------------------------------------------------------------------*/
177 static int testapp_add_a_notification_to_bob()
179 notification_h noti_handle = NULL;
180 int noti_err = NOTIFICATION_ERROR_NONE;
182 noti_handle = notification_create(NOTIFICATION_TYPE_NOTI);
184 if (noti_handle == NULL) {
185 testapp_print("notification_create failed");
189 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
190 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "CONTENT", NOTIFICATION_VARIABLE_TYPE_NONE);
191 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "3", "3", NOTIFICATION_VARIABLE_TYPE_NONE);
192 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_1, "I'm Info 1", "INFO_1", NOTIFICATION_VARIABLE_TYPE_NONE);
193 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, "I'm Info Sub 1", "INFO_SUB_1", NOTIFICATION_VARIABLE_TYPE_NONE);
194 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_2, "I'm Info 2", "INFO_2", NOTIFICATION_VARIABLE_TYPE_NONE);
195 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_2, "I'm Info Sub 2", "INFO_SUB_2", NOTIFICATION_VARIABLE_TYPE_NONE);
196 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_3, "I'm Info 3", "INFO_3", NOTIFICATION_VARIABLE_TYPE_NONE);
197 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_3, "I'm Info Sub 3", "INFO_SUB_3", NOTIFICATION_VARIABLE_TYPE_NONE);
199 noti_err = notification_set_ongoing_flag(noti_handle, true);
200 noti_err = notification_set_auto_remove(noti_handle, false);
202 noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_INDICATOR | NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER);
204 noti_err = notification_post_for_uid(noti_handle, 5002);
206 if (noti_err != NOTIFICATION_ERROR_NONE) {
207 testapp_print("notification_post failed[%d]", noti_err);
213 notification_free(noti_handle);
219 static int testapp_add_a_notification()
221 notification_h noti_handle = NULL;
222 int noti_err = NOTIFICATION_ERROR_NONE;
224 noti_handle = notification_create(NOTIFICATION_TYPE_NOTI);
226 if (noti_handle == NULL) {
227 testapp_print("notification_create failed");
231 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
232 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "CONTENT", NOTIFICATION_VARIABLE_TYPE_NONE);
233 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, "3", "3", NOTIFICATION_VARIABLE_TYPE_NONE);
234 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_1, "I'm Info 1", "INFO_1", NOTIFICATION_VARIABLE_TYPE_NONE);
235 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_1, "I'm Info Sub 1", "INFO_SUB_1", NOTIFICATION_VARIABLE_TYPE_NONE);
236 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_2, "I'm Info 2", "INFO_2", NOTIFICATION_VARIABLE_TYPE_NONE);
237 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_2, "I'm Info Sub 2", "INFO_SUB_2", NOTIFICATION_VARIABLE_TYPE_NONE);
238 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_3, "I'm Info 3", "INFO_3", NOTIFICATION_VARIABLE_TYPE_NONE);
239 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_INFO_SUB_3, "I'm Info Sub 3", "INFO_SUB_3", NOTIFICATION_VARIABLE_TYPE_NONE);
241 noti_err = notification_set_ongoing_flag(noti_handle, true);
242 noti_err = notification_set_auto_remove(noti_handle, false);
244 noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_INDICATOR | NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY | NOTIFICATION_DISPLAY_APP_TICKER);
246 noti_err = notification_post(noti_handle);
248 if (noti_err != NOTIFICATION_ERROR_NONE) {
249 testapp_print("notification_post failed[%d]", noti_err);
255 notification_free(noti_handle);
260 /* Common } ------------------------------------------------------------------ */
262 /* Basic Test { -------------------------------------------------------------- */
263 static int testapp_test_post_notification()
265 int err = NOTIFICATION_ERROR_NONE;
267 if ((err = testapp_add_a_notification()) != NOTIFICATION_ERROR_NONE) {
268 testapp_print("testapp_add_a_notification failed[%d]", err);
278 static int testapp_test_post_notifications()
280 int err = NOTIFICATION_ERROR_NONE;
281 int repeat_count = 0;
284 testapp_print("Input count : ");
286 if (0 >= scanf("%d", &repeat_count)) {
287 testapp_print("Invalid input");
291 if (repeat_count > 30) {
292 testapp_print("Too many count");
296 for (i = 0; i < repeat_count; i++) {
297 if ((err = testapp_add_a_notification()) != NOTIFICATION_ERROR_NONE) {
298 testapp_print("testapp_add_a_notification failed[%d]", err);
307 static int testapp_test_post_notification_on_indicator()
309 notification_h noti_handle = NULL;
310 int noti_err = NOTIFICATION_ERROR_NONE;
311 char image_path[TIZEN_PATH_MAX] = {0, };
313 noti_handle = notification_create(NOTIFICATION_TYPE_ONGOING);
315 if (noti_handle == NULL) {
316 testapp_print("notification_create failed");
320 snprintf(image_path, TIZEN_PATH_MAX, "%s/org.tizen.indicator/res/icons/Shealth/B03_shealth.png", PATH_FMT_RO_APP_ROOT);
321 noti_err = notification_set_image(noti_handle, NOTIFICATION_IMAGE_TYPE_ICON_FOR_INDICATOR, image_path);
323 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
324 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "This is very long message", NOTIFICATION_VARIABLE_TYPE_NONE);
326 noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_TICKER | NOTIFICATION_DISPLAY_APP_INDICATOR);
328 if (noti_err != NOTIFICATION_ERROR_NONE) {
329 testapp_print("notification_set_display_applist failed[%d]", noti_err);
333 noti_err = notification_post(noti_handle);
335 if (noti_err != NOTIFICATION_ERROR_NONE) {
336 testapp_print("notification_post failed[%d]", noti_err);
342 notification_free(noti_handle);
347 static int testapp_test_post_status_message()
349 int noti_err = NOTIFICATION_ERROR_NONE;
352 noti_err = notification_status_message_post("This is only a test");
354 if (noti_err != NOTIFICATION_ERROR_NONE)
355 testapp_print("notification_status_message_post failed[%d]", noti_err);
360 static int testapp_test_delete_all_notifications()
362 int noti_err = NOTIFICATION_ERROR_NONE;
364 noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
366 testapp_print("notification_delete_all returns[%d]", noti_err);
371 static int testapp_test_post_heads_up_notification_with_button()
373 notification_h noti_handle = NULL;
374 int noti_err = NOTIFICATION_ERROR_NONE;
375 int app_control_err = APP_CONTROL_ERROR_NONE;
379 app_control_h app_control = NULL;
380 time_t result = time(NULL);
381 char tag[100] = { 0, };
383 noti_handle = notification_create(NOTIFICATION_TYPE_NOTI);
385 if (noti_handle == NULL) {
386 testapp_print("notification_create failed");
390 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
391 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "CONTENT", NOTIFICATION_VARIABLE_TYPE_NONE);
393 noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_ACTIVE | NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
395 snprintf(tag, 100, "%d", (int)result);
397 noti_err = notification_set_tag(noti_handle, tag);
399 if (noti_err != NOTIFICATION_ERROR_NONE) {
400 testapp_print("notification_set_display_applist failed[%d]\n", noti_err);
404 app_control_err = app_control_create(&app_control);
405 if (app_control_err != APP_CONTROL_ERROR_NONE) {
406 testapp_print("app_control_create failed[%d]\n", app_control_err);
410 app_control_err = app_control_set_app_id(app_control, "org.tizen.quickpanel");
411 if (app_control_err != APP_CONTROL_ERROR_NONE) {
412 testapp_print("app_control_set_app_id failed[%d]\n", app_control_err);
416 noti_err = notification_set_event_handler(noti_handle, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, app_control);
418 if (noti_err != NOTIFICATION_ERROR_NONE) {
419 testapp_print("notification_set_event_handler failed[%d]", noti_err);
423 app_control_destroy(app_control);
426 noti_err = notification_post(noti_handle);
428 if (noti_err != NOTIFICATION_ERROR_NONE) {
429 testapp_print("notification_post failed[%d]", noti_err);
433 noti_err = notification_get_id(noti_handle, &group_id, &priv_id);
435 if (noti_err != NOTIFICATION_ERROR_NONE) {
436 testapp_print("notification_get_id failed[%d]", noti_err);
441 notification_free(noti_handle);
444 noti_handle = notification_load(NULL, priv_id);
446 if (noti_handle == NULL) {
447 testapp_print("notification_load failed");
451 noti_err = notification_get_event_handler(noti_handle, NOTIFICATION_EVENT_TYPE_CLICK_ON_BUTTON_1, &app_control);
453 if (noti_err != NOTIFICATION_ERROR_NONE || app_control == NULL) {
454 testapp_print("notification_get_event_handler failed[%d]", noti_err);
458 app_control_get_app_id(app_control, &app_id);
461 testapp_print("result app_id [%s]\n", app_id);
468 app_control_destroy(app_control);
471 notification_free(noti_handle);
476 static int testapp_test_post_notification_with_domain_text()
478 notification_h noti_handle = NULL;
479 int noti_err = NOTIFICATION_ERROR_NONE;
480 time_t result = time(NULL);
481 char tag[100] = { 0, };
483 noti_handle = notification_create(NOTIFICATION_TYPE_NOTI);
485 if (noti_handle == NULL) {
486 testapp_print("notification_create failed");
490 noti_err = notification_set_text_domain(noti_handle, "message", "/usr/apps/org.tizen.message/res/locale");
492 if (noti_err != NOTIFICATION_ERROR_NONE) {
493 testapp_print("notification_set_display_applist failed[%d]\n", noti_err);
497 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_TITLE, "I'm Title", "TITLE", NOTIFICATION_VARIABLE_TYPE_NONE);
498 noti_err = notification_set_text(noti_handle, NOTIFICATION_TEXT_TYPE_CONTENT, "I'm Content", "[%s] *** [%s]",
499 NOTIFICATION_VARIABLE_TYPE_STRING, "IDS_MSGF_BODY_NO_SUBJECT",
500 NOTIFICATION_VARIABLE_TYPE_STRING, "IDS_MSGF_POP_NEW_MESSAGE",
501 NOTIFICATION_VARIABLE_TYPE_NONE);
503 noti_err = notification_set_display_applist(noti_handle, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
505 if (noti_err != NOTIFICATION_ERROR_NONE) {
506 testapp_print("notification_set_display_applist failed[%d]\n", noti_err);
510 snprintf(tag, 100, "%d", (int)result);
512 noti_err = notification_set_tag(noti_handle, tag);
514 if (noti_err != NOTIFICATION_ERROR_NONE) {
515 testapp_print("notification_set_tag failed[%d]\n", noti_err);
519 noti_err = notification_post(noti_handle);
521 if (noti_err != NOTIFICATION_ERROR_NONE) {
522 testapp_print("notification_post failed[%d]", noti_err);
530 notification_free(noti_handle);
535 static int testapp_test_load_by_tag()
537 notification_h noti_handle = NULL;
538 int noti_err = NOTIFICATION_ERROR_NONE;
540 noti_handle = notification_load_by_tag("hfe4fif#$sd$ew");
542 if (noti_handle == NULL) {
543 testapp_print("notification_load_by_tag failed");
549 notification_free(noti_handle);
554 static int testapp_test_get_list()
556 notification_h noti_handle = NULL;
557 notification_list_h noti_list_handle = NULL;
558 notification_list_h noti_list_cursor_handle = NULL;
559 int noti_err = NOTIFICATION_ERROR_NONE;
566 noti_err = notification_get_detail_list("./notification-test-app", NOTIFICATION_PRIV_ID_NONE, NOTIFICATION_GROUP_ID_NONE, 10, ¬i_list_handle);
568 if (noti_err != NOTIFICATION_ERROR_NONE) {
569 testapp_print("notification_get_detail_list failed[%d]\n", noti_err);
573 noti_list_cursor_handle = notification_list_get_head(noti_list_handle);
575 while (noti_list_cursor_handle) {
576 noti_handle = notification_list_get_data(noti_list_cursor_handle);
577 notification_get_id(noti_handle, &group_id, &priv_id);
578 notification_get_type(noti_handle, &type);
579 notification_get_ongoing_flag(noti_handle, &ongoing_flag);
580 notification_get_auto_remove(noti_handle, &auto_remove);
582 testapp_print("priv_id[%d] type[%d] ongoing_flag[%d] auto_remove[%d]\n", priv_id, type, ongoing_flag, auto_remove);
583 noti_list_cursor_handle = notification_list_get_next(noti_list_cursor_handle);
588 if (noti_list_handle)
589 notification_free_list(noti_list_handle);
594 static gboolean testapp_interpret_command_basic_test(int selected_number)
596 gboolean go_to_loop = TRUE;
598 switch (selected_number) {
600 testapp_test_post_notification();
604 testapp_test_post_notifications();
608 testapp_test_post_notification_on_indicator();
612 testapp_test_post_status_message();
616 testapp_test_delete_all_notifications();
620 testapp_test_post_heads_up_notification_with_button();
624 testapp_test_post_notification_with_domain_text();
628 testapp_test_load_by_tag();
632 testapp_test_get_list();
635 testapp_add_a_notification_to_bob();
650 void testapp_notification_main()
652 gboolean go_to_loop = TRUE;
656 testapp_show_menu(TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
657 testapp_show_prompt(TESTAPP_MENU_TYPE_BASIC_TEST_MENU);
659 if (0 >= scanf("%d", &menu_number))
660 testapp_print("Invalid input");
662 go_to_loop = testapp_interpret_command_basic_test(menu_number);
665 /* Basic Test } ---------------------------------------------------------------*/
667 /* Setting Test } ---------------------------------------------------------------*/
669 static int testapp_test_get_setting_list()
671 int err = NOTIFICATION_ERROR_NONE;
674 char *package_name = NULL;
675 bool allow_to_notify = false;
676 bool do_not_disturb_except = false;
677 int visibility_class = false;
678 notification_setting_h setting_array = NULL;
680 notification_setting_get_setting_array(&setting_array, &count);
682 testapp_print("count [%d]\n", count);
684 for (i = 0; i < count; i++) {
685 notification_setting_get_package_name(setting_array + i, &package_name);
686 notification_setting_get_allow_to_notify(setting_array + i, &allow_to_notify);
687 notification_setting_get_do_not_disturb_except(setting_array + i, &do_not_disturb_except);
688 notification_setting_get_visibility_class(setting_array + i, &visibility_class);
690 testapp_print("[%d] : package_name[%s], allow_to_notify[%d], do_not_disturb_except[%d], visibility_class[%d]\n"
691 , i, package_name, allow_to_notify, do_not_disturb_except, visibility_class);
695 notification_setting_free_notification(setting_array);
700 static int testapp_test_update_setting()
702 int err = NOTIFICATION_ERROR_NONE;
703 notification_setting_h setting = NULL;
705 err = notification_setting_get_setting_by_package_name("org.tizen.internet", &setting);
707 if (err != NOTIFICATION_ERROR_NONE || setting == NULL) {
708 testapp_print("notification_setting_get_setting_by_package_name failed [%d]", err);
710 notification_setting_set_allow_to_notify(setting, 0);
711 notification_setting_update_setting(setting);
715 notification_setting_free_notification(setting);
720 static int testapp_test_update_system_setting()
722 int err = NOTIFICATION_ERROR_NONE;
724 int visibility_class;
725 notification_system_setting_h system_setting = NULL;
727 err = notification_system_setting_load_system_setting(&system_setting);
729 if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) {
730 testapp_print("notification_system_setting_load_system_setting failed [%d]\n", err);
734 notification_system_setting_get_do_not_disturb(system_setting, &do_not_disturb);
735 testapp_print("do_not_disturb [%d]\n", do_not_disturb);
736 do_not_disturb = !do_not_disturb;
737 notification_system_setting_set_do_not_disturb(system_setting, do_not_disturb);
739 notification_system_setting_get_visibility_class(system_setting, &visibility_class);
740 testapp_print("visibility_class [%d]\n", visibility_class);
741 visibility_class = !visibility_class;
742 notification_system_setting_set_visibility_class(system_setting, visibility_class);
744 err = notification_system_setting_update_system_setting(system_setting);
746 if (err != NOTIFICATION_ERROR_NONE || system_setting == NULL) {
747 testapp_print("notification_system_setting_update_system_setting failed [%d]\n", err);
753 notification_system_setting_free_system_setting(system_setting);
758 static int testapp_test_refresh_setting_table()
760 int err = NOTIFICATION_ERROR_NONE;
761 err = notification_setting_refresh_setting_table(tzplatform_getuid(TZ_SYS_DEFAULT_USER));
763 if (err != NOTIFICATION_ERROR_NONE) {
764 testapp_print("notification_setting_refresh_setting_table failed [%d]\n", err);
773 static gboolean testapp_interpret_command_setting_test(int selected_number)
775 gboolean go_to_loop = TRUE;
777 switch (selected_number) {
779 testapp_test_get_setting_list();
783 testapp_test_update_setting();
787 testapp_test_update_system_setting();
791 testapp_test_refresh_setting_table();
806 void testapp_setting_main()
808 gboolean go_to_loop = TRUE;
812 testapp_show_menu(TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
813 testapp_show_prompt(TESTAPP_MENU_TYPE_SETTING_TEST_MENU);
815 if (0 >= scanf("%d", &menu_number))
816 testapp_print("Invalid input");
818 go_to_loop = testapp_interpret_command_setting_test(menu_number);
821 /* Setting Test } ---------------------------------------------------------------*/
823 /* Main { ---------------------------------------------------------------------*/
824 static gboolean testapp_interpret_command(int menu_number)
826 gboolean go_to_loop = TRUE;
828 switch (menu_number) {
830 testapp_notification_main();
834 testapp_setting_main();
848 void testapp_show_prompt(testapp_menu_type_e menu)
851 case TESTAPP_MENU_TYPE_MAIN_MENU:
852 testapp_print("[MAIN]# ");
855 case TESTAPP_MENU_TYPE_BASIC_TEST_MENU:
856 testapp_print("[BASIC_TEST]# ");
859 case TESTAPP_MENU_TYPE_SETTING_TEST_MENU:
860 testapp_print("[SETTING_TEST]# ");
865 int main(int argc, char *argv[])
867 gboolean go_to_loop = TRUE;
870 if (testapp_initialize_testing() == FALSE) {
871 testapp_print("Initializing failed.\n");
876 testapp_show_menu(TESTAPP_MENU_TYPE_MAIN_MENU);
877 testapp_show_prompt(TESTAPP_MENU_TYPE_MAIN_MENU);
878 if (0 >= scanf("%d", &menu_number))
879 testapp_print("Invalid input");
880 go_to_loop = testapp_interpret_command(menu_number);
883 testapp_finalize_testing();
887 /* Main } ---------------------------------------------------------------------*/