From: jinwang.an Date: Mon, 3 Dec 2018 08:17:15 +0000 (+0900) Subject: [ACR-1318] Add SYSTEM_SETTINGS_KEYS to support accessibility. X-Git-Tag: submit/tizen/20190218.081330~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0bd024b7032ea742c71422d497abe493836d728f;p=platform%2Fcore%2Fapi%2Fsystem-settings.git [ACR-1318] Add SYSTEM_SETTINGS_KEYS to support accessibility. Change-Id: Ib0e63617c75a1688906f9cfaea11131c55a83345 Signed-off-by: jinwang.an --- diff --git a/doc/system_settings_doc.h b/doc/system_settings_doc.h index e153dbc..77d62b3 100644 --- a/doc/system_settings_doc.h +++ b/doc/system_settings_doc.h @@ -40,6 +40,8 @@ * - http://tizen.org/feature/systemsetting.font * - http://tizen.org/feature/network.wifi * - http://tizen.org/feature/network.telephony +* - http://tizen.org/feature/accessibility.grayscale +* - http://tizen.org/feature/accessibility.negative * * It is recommended to design feature related codes in your application for reliability. * @@ -65,5 +67,7 @@ * http://tizen.org/feature/network.telephony #SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE * #SYSTEM_SETTINGS_KEY_ULTRA_DATA_SAVE_PKG_LIST * #SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE +* http://tizen.org/feature/accessibility.grayscale #SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE +* http://tizen.org/feature/accessibility.negative #SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR * */ diff --git a/include/system_settings.h b/include/system_settings.h index 51c9a95..c2ecb5f 100644 --- a/include/system_settings.h +++ b/include/system_settings.h @@ -1,4 +1,5 @@ -/* * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +/* + * Copyright (c) 2011 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. @@ -91,6 +92,8 @@ typedef enum { SYSTEM_SETTINGS_KEY_VIBRATION, /**< (bool) Indicates whether vibration is enabled on the device. (Since 4.0) */ SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE, /**< (bool) Indicates whether updating time automatically is enabled on the device. (Since 5.0) */ SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE, /**< (bool) Indicates whether developer option state is enabled on the device. (Since 5.0) */ + SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, /**< (bool) Indicates whether accessibility grayscale is enabled on the device. (Since 5.5) */ + SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, /**< (bool) Indicates whether accessibility negative color is enabled on the device. (Since 5.5) */ SYSTEM_SETTINGS_KEY_MAX, } system_settings_key_e; diff --git a/include/system_settings_private.h b/include/system_settings_private.h index 2568db6..4d5b4be 100644 --- a/include/system_settings_private.h +++ b/include/system_settings_private.h @@ -27,6 +27,15 @@ extern "C" #include #include +#ifndef VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST +#define VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST "db/setting/accessibility/high_contrast" +#endif + +#ifndef VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE +#define VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE "db/setting/accessibility/greyscale" +#endif + + #ifdef LOG_TAG #undef LOG_TAG #endif @@ -71,6 +80,8 @@ extern "C" #define SETTING_WIFI_PATH "tizen.org/feature/network.wifi" #define SETTING_FONT_PATH "tizen.org/feature/systemsetting.font" #define SETTING_TELEPHONY_PATH "tizen.org/feature/network.telephony" +#define SETTING_ACCESSIBILITY_GRAYSCALE_PATH "tizen.org/feature/accessibility.grayscale" +#define SETTING_ACCESSIBILITY_NEGATIVE_PATH "tizen.org/feature/accessibility.negative" /** * @internal @@ -1597,6 +1608,86 @@ int system_setting_set_changed_callback_developer_option_state(system_settings_k */ int system_setting_unset_changed_callback_developer_option_state(system_settings_key_e key); +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_get_accessibility_grayscale(system_settings_key_e key, void **value); + +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_set_accessibility_grayscale(system_settings_key_e key, void *value); + +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_set_changed_callback_accessibility_grayscale(system_settings_key_e key, system_settings_changed_cb callback, void *user_data); + +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_unset_changed_callback_accessibility_grayscale(system_settings_key_e key); + +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_get_accessibility_negative_color(system_settings_key_e key, void **value); + +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_set_accessibility_negative_color(system_settings_key_e key, void *value); + +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_set_changed_callback_accessibility_negative_color(system_settings_key_e key, system_settings_changed_cb callback, void *user_data); + +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED Permission violation error + */ +int system_setting_unset_changed_callback_accessibility_negative_color(system_settings_key_e key); + /** * @internal * @since_tizen 3.0 @@ -1667,7 +1758,6 @@ int system_setting_feature_check_wifi(void * value); */ int system_setting_feature_check_telephony(void *value); - /** * @internal * @since_tizen 4.0 @@ -1678,6 +1768,26 @@ int system_setting_feature_check_telephony(void *value); */ int system_setting_feature_check_font(void *value); +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + */ +int system_setting_feature_check_accessibility_grayscale(void *value); + +/** + * @internal + * @since_tizen 5.5 + * @return 0 on success, otherwise a negative error value + * @retval #SYSTEM_SETTINGS_ERROR_NONE Successful + * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error + * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API + */ +int system_setting_feature_check_accessibility_negative(void *value); + /*// */ #ifdef __cplusplus diff --git a/src/system_setting_platform.c b/src/system_setting_platform.c index 6963237..4e212a3 100644 --- a/src/system_setting_platform.c +++ b/src/system_setting_platform.c @@ -2161,7 +2161,7 @@ int system_settings_feature_check_bool(char *path) } -int system_setting_feature_check_incoming_call(void * value) +int system_setting_feature_check_incoming_call(void *value) { static bool first_query = true; static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; @@ -2174,7 +2174,7 @@ int system_setting_feature_check_incoming_call(void * value) return ret; } -int system_setting_feature_check_home_screen(void * value) +int system_setting_feature_check_home_screen(void *value) { static bool first_query = true; static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; @@ -2187,7 +2187,7 @@ int system_setting_feature_check_home_screen(void * value) return ret; } -int system_setting_feature_check_lock_screen(void * value) +int system_setting_feature_check_lock_screen(void *value) { static bool first_query = true; static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; @@ -2200,7 +2200,7 @@ int system_setting_feature_check_lock_screen(void * value) return ret; } -int system_setting_feature_check_notification_email(void * value) +int system_setting_feature_check_notification_email(void *value) { static bool first_query = true; static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; @@ -2213,7 +2213,7 @@ int system_setting_feature_check_notification_email(void * value) return ret; } -int system_setting_feature_check_wifi(void * value) +int system_setting_feature_check_wifi(void *value) { static bool first_query = true; static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; @@ -2226,7 +2226,7 @@ int system_setting_feature_check_wifi(void * value) return ret; } -int system_setting_feature_check_telephony(void * value) +int system_setting_feature_check_telephony(void *value) { static bool first_query = true; static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; @@ -2240,7 +2240,7 @@ int system_setting_feature_check_telephony(void * value) } -int system_setting_feature_check_font(void * value) +int system_setting_feature_check_font(void *value) { static bool first_query = true; static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; @@ -2253,6 +2253,32 @@ int system_setting_feature_check_font(void * value) return ret; } +int system_setting_feature_check_accessibility_grayscale(void *value) +{ + static bool first_query = true; + static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + if (first_query == true) { + ret = system_settings_feature_check_bool(SETTING_ACCESSIBILITY_GRAYSCALE_PATH); + first_query = false; + } + + return ret; +} + +int system_setting_feature_check_accessibility_negative(void *value) +{ + static bool first_query = true; + static int ret = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; + + if (first_query == true) { + ret = system_settings_feature_check_bool(SETTING_ACCESSIBILITY_NEGATIVE_PATH); + first_query = false; + } + + return ret; +} + /* LCOV_EXCL_START */ int system_setting_get_uds_state(system_settings_key_e key, void **value) { @@ -2486,3 +2512,83 @@ int system_setting_unset_changed_callback_developer_option_state(system_settings return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, 2); } +/* SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE */ +int system_setting_get_accessibility_grayscale(system_settings_key_e key, void **value) +{ + SETTING_TRACE_BEGIN; + bool vconf_value; + + if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, &vconf_value)) { + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + *value = (void *)vconf_value; + + return SYSTEM_SETTINGS_ERROR_NONE; +} + +/* LCOV_EXCL_START */ +int system_setting_set_accessibility_grayscale(system_settings_key_e key, void *value) +{ + SETTING_TRACE_BEGIN; + bool *vconf_value; + vconf_value = (bool *)value; + if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, *vconf_value)) { + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + + return SYSTEM_SETTINGS_ERROR_NONE; +} +/* LCOV_EXCL_STOP */ + +int system_setting_set_changed_callback_accessibility_grayscale(system_settings_key_e key, system_settings_changed_cb callback, void *user_data) +{ + SETTING_TRACE_BEGIN; + return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, 2, user_data); +} + +int system_setting_unset_changed_callback_accessibility_grayscale(system_settings_key_e key) +{ + SETTING_TRACE_BEGIN; + return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, 2); +} + +/* SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR */ +int system_setting_get_accessibility_negative_color(system_settings_key_e key, void **value) +{ + SETTING_TRACE_BEGIN; + bool vconf_value; + + if (system_setting_vconf_get_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, &vconf_value)) { + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + *value = (void *)vconf_value; + + return SYSTEM_SETTINGS_ERROR_NONE; +} + +/* LCOV_EXCL_START */ +int system_setting_set_accessibility_negative_color(system_settings_key_e key, void *value) +{ + SETTING_TRACE_BEGIN; + bool *vconf_value; + vconf_value = (bool *)value; + if (system_setting_vconf_set_value_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, *vconf_value)) { + return SYSTEM_SETTINGS_ERROR_IO_ERROR; + } + + return SYSTEM_SETTINGS_ERROR_NONE; +} +/* LCOV_EXCL_STOP */ + +int system_setting_set_changed_callback_accessibility_negative_color(system_settings_key_e key, system_settings_changed_cb callback, void *user_data) +{ + SETTING_TRACE_BEGIN; + return system_setting_vconf_set_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, 2, user_data); +} + +int system_setting_unset_changed_callback_accessibility_negative_color(system_settings_key_e key) +{ + SETTING_TRACE_BEGIN; + return system_setting_vconf_unset_changed_cb(VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, 2); +} + diff --git a/src/system_settings.c b/src/system_settings.c index 621b230..1be3687 100644 --- a/src/system_settings.c +++ b/src/system_settings.c @@ -566,6 +566,36 @@ system_setting_s system_setting_table[] = { { NULL, 0 }, /* changed callabck list */ NULL, /* user data */ }, + { + SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, + SYSTEM_SETTING_DATA_TYPE_BOOL, + system_setting_get_accessibility_grayscale, + system_setting_set_accessibility_grayscale, + system_setting_set_changed_callback_accessibility_grayscale, + system_setting_unset_changed_callback_accessibility_grayscale, + NULL, + NULL, /* ADD */ + NULL, /* DEL */ + NULL, /* LIST */ + system_setting_feature_check_accessibility_grayscale, /* feature check */ + { NULL, 0 }, /* changed callabck list */ + NULL, /* user data */ + }, + { + SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, + SYSTEM_SETTING_DATA_TYPE_BOOL, + system_setting_get_accessibility_negative_color, + system_setting_set_accessibility_negative_color, + system_setting_set_changed_callback_accessibility_negative_color, + system_setting_unset_changed_callback_accessibility_negative_color, + NULL, + NULL, /* ADD */ + NULL, /* DEL */ + NULL, /* LIST */ + system_setting_feature_check_accessibility_negative, /* feature check */ + { NULL, 0 }, /* changed callabck list */ + NULL, /* user data */ + }, { SYSTEM_SETTINGS_MAX, -1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, { NULL, 0 }, NULL } diff --git a/src/system_settings_vconf.c b/src/system_settings_vconf.c index 3285ea6..ba70046 100644 --- a/src/system_settings_vconf.c +++ b/src/system_settings_vconf.c @@ -30,7 +30,7 @@ #define LOG_TAG "TIZEN_N_SYSTEM_SETTINGS" -static char* _system_settings_vconf_table[38] = { +static char* _system_settings_vconf_table[SYSTEM_SETTINGS_KEY_MAX] = { VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, VCONFKEY_BGSET, VCONFKEY_IDLE_LOCK_BGSET, @@ -67,6 +67,8 @@ static char* _system_settings_vconf_table[38] = { VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, VCONFKEY_SETAPPL_STATE_AUTOMATIC_TIME_UPDATE_BOOL, VCONFKEY_SETAPPL_DEVELOPER_OPTION_STATE, + VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE, + VCONFKEY_SETAPPL_ACCESSIBILITY_HIGH_CONTRAST, "MAX" }; diff --git a/unit_test/src/unit_test.c b/unit_test/src/unit_test.c index 5fc363a..71446dd 100644 --- a/unit_test/src/unit_test.c +++ b/unit_test/src/unit_test.c @@ -67,12 +67,21 @@ void unit_test_callback59(system_settings_key_e key, void *user_data) { } static int my_assert_ret(int retcode) { - if (retcode == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) { - assert(retcode == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); - } else { + if (retcode != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) { + if (retcode != SYSTEM_SETTINGS_ERROR_NONE) + printf("Error!!\n"); + assert(retcode == SYSTEM_SETTINGS_ERROR_NONE); + } + return 1; +} + +static int my_assert_ret_eq_bool(int retcode, bool a, bool b) +{ + if (retcode != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) { if (retcode != SYSTEM_SETTINGS_ERROR_NONE) printf("Error!!\n"); assert(retcode == SYSTEM_SETTINGS_ERROR_NONE); + assert_eq(a, b); } return 1; } @@ -639,6 +648,36 @@ RETTYPE utc_system_settings_get_value_bool_p11(void) RETURN(0); } +/** + * @testcase utc_system_settings_get_value_bool_p12 + * @since_tizen 5.5 + * @description check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE is able to get the property + */ +RETTYPE utc_system_settings_get_value_bool_p12(void) +{ + bool value = false; + + int retcode = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, &value); + my_assert_ret(retcode); + + RETURN(0); +} + +/** + * @testcase utc_system_settings_get_value_bool_p13 + * @since_tizen 5.5 + * @description check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR is able to get the property + */ +RETTYPE utc_system_settings_get_value_bool_p13(void) +{ + bool value = false; + + int retcode = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, &value); + my_assert_ret(retcode); + + RETURN(0); +} + /** * @testcase utc_system_settings_set_changed_cb_p1 @@ -2045,22 +2084,23 @@ RETTYPE utc_system_settings_set_value_int_n2(void) RETTYPE utc_system_settings_set_value_bool_p3(void) { int ret; - bool state = true; - ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, state); - my_assert_ret(ret); bool ret_state = false; - ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &ret_state); + bool cur_state = false; + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &cur_state); my_assert_ret(ret); - //assert_eq(state, ret_state); - - /* roll back */ - ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, !state); + bool state = !cur_state; + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, state); my_assert_ret(ret); + /* check current state */ ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, &ret_state); - //assert_eq(ret_state, !state); + my_assert_ret_eq_bool(ret, state, ret_state); + + /* roll back */ + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_LOCALE_TIMEFORMAT_24HOUR, cur_state); + my_assert_ret(ret); RETURN(0); } @@ -2077,21 +2117,23 @@ RETTYPE utc_system_settings_set_value_bool_p4(void) int ret; /* get current state */ + bool cur_state = false; bool ret_state = false; - ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, &ret_state); + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, &cur_state); my_assert_ret(ret); - - bool state = !ret_state; + bool state = !cur_state; ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, state); my_assert_ret(ret); + /* check current state */ + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, &ret_state); + my_assert_ret_eq_bool(ret, state, ret_state); + /* roll back */ - ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, ret_state); + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, cur_state); my_assert_ret(ret); - assert(state != ret_state); - RETURN(0); } @@ -2107,21 +2149,23 @@ RETTYPE utc_system_settings_set_value_bool_p5(void) int ret; /* get current state */ + bool cur_state = false; bool ret_state = false; - ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, &ret_state); + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, &cur_state); my_assert_ret(ret); - - bool state = !ret_state; + bool state = !cur_state; ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, state); my_assert_ret(ret); + /* check current state */ + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, &ret_state); + my_assert_ret_eq_bool(ret, state, ret_state); /* roll back */ - ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, ret_state); + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION, cur_state); my_assert_ret(ret); - assert(state != ret_state); RETURN(0); } @@ -2137,21 +2181,23 @@ RETTYPE utc_system_settings_set_value_bool_p6(void) int ret; /* get current state */ + bool cur_state = false; bool ret_state = false; - ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, &ret_state); + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, &cur_state); my_assert_ret(ret); - - bool state = !ret_state; + bool state = !cur_state; ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, state); my_assert_ret(ret); + /* check current state */ + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, &ret_state); + my_assert_ret_eq_bool(ret, state, ret_state); /* roll back */ - ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, ret_state); + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_VIBRATION, cur_state); my_assert_ret(ret); - assert(state != ret_state); RETURN(0); } @@ -2166,21 +2212,23 @@ RETTYPE utc_system_settings_set_value_bool_p7(void) int ret; /* get current state */ + bool cur_state = false; bool ret_state = false; - ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE, &ret_state); + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE, &cur_state); my_assert_ret(ret); - - bool state = !ret_state; + bool state = !cur_state; ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE, state); my_assert_ret(ret); + /* check current state */ + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE, &ret_state); + my_assert_ret_eq_bool(ret, state, ret_state); /* roll back */ - ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE, ret_state); + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_AUTOMATIC_TIME_UPDATE, cur_state); my_assert_ret(ret); - assert(state != ret_state); RETURN(0); } @@ -2196,21 +2244,85 @@ RETTYPE utc_system_settings_set_value_bool_p8(void) int ret; /* get current state */ + bool cur_state = false; bool ret_state = false; + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE, &cur_state); + my_assert_ret(ret); + + bool state = !cur_state; + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE, state); + my_assert_ret(ret); + + /* check current state */ ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE, &ret_state); + my_assert_ret_eq_bool(ret, state, ret_state); + + /* roll back */ + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE, cur_state); my_assert_ret(ret); + RETURN(0); +} - bool state = !ret_state; - ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE, state); +/** + * @testcase utc_system_settings_set_value_bool_p9 + * @since_tizen 5.5 + * @description check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE is able to set the property. + * check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE is able to get the property. + */ +RETTYPE utc_system_settings_set_value_bool_p9(void) +{ + int ret; + + /* get current state */ + bool cur_state = false; + bool ret_state = false; + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, &cur_state); my_assert_ret(ret); + bool state = !cur_state; + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, state); + my_assert_ret(ret); + + /* check current state */ + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, &ret_state); + my_assert_ret_eq_bool(ret, state, ret_state); /* roll back */ - ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_DEVELOPER_OPTION_STATE, ret_state); + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, cur_state); + my_assert_ret(ret); + + RETURN(0); +} + +/** + * @testcase utc_system_settings_set_value_bool_p10 + * @since_tizen 5.5 + * @description check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR is able to set the property. + * check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR is able to get the property. + */ +RETTYPE utc_system_settings_set_value_bool_p10(void) +{ + int ret; + + /* get current state */ + bool cur_state = false; + bool ret_state = false; + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, &cur_state); + my_assert_ret(ret); + + bool state = !cur_state; + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, state); + my_assert_ret(ret); + + /* check current state */ + ret = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, &ret_state); + my_assert_ret_eq_bool(ret, state, ret_state); + + /* roll back */ + ret = system_settings_set_value_bool(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, cur_state); my_assert_ret(ret); - assert(state != ret_state); RETURN(0); } /** @@ -2751,6 +2863,76 @@ RETTYPE utc_system_settings_unset_changed_cb_p36(void) RETURN(0); } + + +/** + * @testcase utc_system_settings_set_changed_cb_p39 + * @since_tizen 5.5 + * @description check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE is able to set the callback for change-notification. + */ +RETTYPE utc_system_settings_set_changed_cb_p39(void) +{ + system_settings_changed_cb callback = get_system_settings_test_callback(); + int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, + callback, NULL); + my_assert_ret(retcode); + + RETURN(0); +} + + +/** + * @testcase utc_system_settings_unset_changed_cb_p38 + * @since_tizen 5.5 + * @description check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE is able to set the callback for change-notification. + * check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE is able to unset the callback for change-notification. + */ +RETTYPE utc_system_settings_unset_changed_cb_p38(void) +{ + system_settings_changed_cb callback = get_system_settings_test_callback(); + int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE, + callback, NULL); + + retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE); + my_assert_ret(retcode); + + RETURN(0); +} + +/** + * @testcase utc_system_settings_set_changed_cb_p41 + * @since_tizen 5.5 + * @description check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR is able to set the callback for change-notification. + */ +RETTYPE utc_system_settings_set_changed_cb_p41(void) +{ + system_settings_changed_cb callback = get_system_settings_test_callback(); + int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, + callback, NULL); + my_assert_ret(retcode); + + RETURN(0); +} + + +/** + * @testcase utc_system_settings_unset_changed_cb_p40 + * @since_tizen 5.5 + * @description check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR is able to set the callback for change-notification. + * check if SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR is able to unset the callback for change-notification. + */ +RETTYPE utc_system_settings_unset_changed_cb_p40(void) +{ + system_settings_changed_cb callback = get_system_settings_test_callback(); + int retcode = system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR, + callback, NULL); + + retcode = system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR); + my_assert_ret(retcode); + + RETURN(0); +} + void unittest_api() { /* hook up your test functions */ @@ -2780,12 +2962,14 @@ void unittest_api() add_test_func("/utc_system_settings_get_value_bool_p8", utc_system_settings_get_value_bool_p8); add_test_func("/utc_system_settings_get_value_bool_p9", utc_system_settings_get_value_bool_p9); add_test_func("/utc_system_settings_get_value_bool_p10", utc_system_settings_get_value_bool_p10); + add_test_func("/utc_system_settings_get_value_bool_p11", utc_system_settings_get_value_bool_p11); + add_test_func("/utc_system_settings_get_value_bool_p12", utc_system_settings_get_value_bool_p12); + add_test_func("/utc_system_settings_get_value_bool_p13", utc_system_settings_get_value_bool_p13); add_test_func("/utc_system_settings_get_value_bool_n", utc_system_settings_get_value_bool_n); add_test_func("/utc_system_settings_get_value_int_p1", utc_system_settings_get_value_int_p1); add_test_func("/utc_system_settings_get_value_int_p2", utc_system_settings_get_value_int_p2); add_test_func("/utc_system_settings_get_value_n", utc_system_settings_get_value_n); add_test_func("/utc_system_settings_get_value_int_p3", utc_system_settings_get_value_int_p3); - add_test_func("/utc_system_settings_get_value_bool_p11", utc_system_settings_get_value_bool_p11); add_test_func("/utc_system_settings_get_value_int_p4", utc_system_settings_get_value_int_p4); g_test_add_func("/utc_system_settings_set_value_string_n2", utc_system_settings_set_value_string_n2); g_test_add_func("/utc_system_settings_set_value_string_n3", utc_system_settings_set_value_string_n3); @@ -2855,6 +3039,10 @@ void unittest_api() g_test_add_func("/utc_system_settings_unset_changed_cb_p34", utc_system_settings_unset_changed_cb_p34); g_test_add_func("/utc_system_settings_set_changed_cb_p37", utc_system_settings_set_changed_cb_p37); g_test_add_func("/utc_system_settings_unset_changed_cb_p36", utc_system_settings_unset_changed_cb_p36); + g_test_add_func("/utc_system_settings_set_changed_cb_p39", utc_system_settings_set_changed_cb_p39); + g_test_add_func("/utc_system_settings_unset_changed_cb_p38", utc_system_settings_unset_changed_cb_p38); + g_test_add_func("/utc_system_settings_set_changed_cb_p41", utc_system_settings_set_changed_cb_p41); + g_test_add_func("/utc_system_settings_unset_changed_cb_p40", utc_system_settings_unset_changed_cb_p40); g_test_add_func("/utc_system_settings_add_ringtone_list_p1", utc_system_settings_add_ringtone_list_p1); g_test_add_func("/utc_system_settings_delete_ringtone_list_p1", utc_system_settings_delete_ringtone_list_p1); add_test_func("/utc_system_settings_set_value_string_p1", utc_system_settings_set_value_string_p1); @@ -2862,8 +3050,6 @@ void unittest_api() g_test_add_func("/utc_system_settings_set_value_string_p3", utc_system_settings_set_value_string_p3); g_test_add_func("/utc_system_settings_set_value_string_p4", utc_system_settings_set_value_string_p4); add_test_func("/utc_system_settings_set_value_bool_n1", utc_system_settings_set_value_bool_n1); - add_test_func("/utc_system_settings_set_value_bool_n2", utc_system_settings_set_value_bool_n2); - add_test_func("/utc_system_settings_set_value_bool_n3", utc_system_settings_set_value_bool_n3); add_test_func("/utc_system_settings_set_value_bool_n4", utc_system_settings_set_value_bool_n4); add_test_func("/utc_system_settings_set_value_bool_n5", utc_system_settings_set_value_bool_n5); add_test_func("/utc_system_settings_set_value_bool_n6", utc_system_settings_set_value_bool_n6); @@ -2879,6 +3065,8 @@ void unittest_api() add_test_func("/utc_system_settings_set_value_bool_p6", utc_system_settings_set_value_bool_p6); add_test_func("/utc_system_settings_set_value_bool_p7", utc_system_settings_set_value_bool_p7); add_test_func("/utc_system_settings_set_value_bool_p8", utc_system_settings_set_value_bool_p8); + add_test_func("/utc_system_settings_set_value_bool_p9", utc_system_settings_set_value_bool_p9); + add_test_func("/utc_system_settings_set_value_bool_p10", utc_system_settings_set_value_bool_p10); add_test_func("/utc_system_settings_set_value_int_p2", utc_system_settings_set_value_int_p2); add_test_func("/utc_system_settings_set_value_string_n6", utc_system_settings_set_value_string_n6); g_test_add_func("/utc_system_settings_unset_changed_cb_n", utc_system_settings_unset_changed_cb_n);