[ITC][system-settings][ACR-1318][Added accesibility check code] 16/200516/3
authorPriya Kohli <priya.kohli@samsung.com>
Tue, 26 Feb 2019 05:59:20 +0000 (11:29 +0530)
committerNibha Sharma <nibha.sharma@samsung.com>
Tue, 26 Feb 2019 11:26:11 +0000 (11:26 +0000)
Change-Id: I48494c8b6d6a66f91a9d43c7cca179bcd888520d
Signed-off-by: Priya Kohli <priya.kohli@samsung.com>
src/itc/system-settings/ITs-system-settings.c

index 0367a22b841cbc03b616e29ecf9c57a0859b725a..446a38e703bdd5c1267df4b08772749af12f62e8 100755 (executable)
@@ -31,10 +31,10 @@ bool g_bSystemSettingsNegativeNotSupported = false;
 * @description         Called before each test
 * @parameter           NA
 * @return                      NA
-*/ 
+*/
 void ITs_system_settings_startup(void)
 {
-       struct stat stBuff;   
+       struct stat stBuff;
        if ( stat(ERR_LOG, &stBuff) == 0 )
        {
                remove(ERR_LOG);
@@ -110,7 +110,7 @@ void System_settings_changed_cb_p(system_settings_key_e key, void *user_data)
 *  @{
 */
 
-//& purpose: Get the system settings value associated with the given key as a boolean. 
+//& purpose: Get the system settings value associated with the given key as a boolean.
 //& type: auto
 /**
 * @testcase                    ITc_system_settings_get_value_bool_p
@@ -128,7 +128,7 @@ void System_settings_changed_cb_p(system_settings_key_e key, void *user_data)
 */
 int ITc_system_settings_get_value_bool_p(void)
 {
-       START_TEST;     
+       START_TEST;
        int nRetVal = SYSTEM_SETTINGS_ERROR_NONE;
        system_settings_key_e eSystem_Settings_Key[]=
        {
@@ -234,8 +234,8 @@ int ITc_system_settings_get_value_bool_p(void)
 * @author              SRID(parshant.v)
 * @reviewer            SRID(gupta.sanjay)
 * @type                                auto
-* @description                 Gets the system settings value associated with the given key as a string. 
-* @scenario                            Gets the system settings value associated with the given key as a string. 
+* @description                 Gets the system settings value associated with the given key as a string.
+* @scenario                            Gets the system settings value associated with the given key as a string.
 * @apicovered                  system_settings_get_value_string
 * @passcase                            If system_settings_get_value_string return 0
 * @failcase                            If system_settings_get_value_string return non zero
@@ -307,7 +307,7 @@ int ITc_system_settings_get_value_string_p(void)
        return 0;
 }
 
-//& purpose: Gets the system settings value associated with the given key as an integer. 
+//& purpose: Gets the system settings value associated with the given key as an integer.
 //& type: auto
 /**
 * @testcase                    ITc_system_settings_get_value_int_p
@@ -315,7 +315,7 @@ int ITc_system_settings_get_value_string_p(void)
 * @author              SRID(parshant.v)
 * @reviewer            SRID(gupta.sanjay)
 * @type                                auto
-* @description                 Gets the system settings value associated with the given key as an integer.  
+* @description                 Gets the system settings value associated with the given key as an integer.
 * @scenario                            Gets the system settings value associated with the given key as an integer.
 * @apicovered                  system_settings_get_value_int
 * @passcase                            If system_settings_get_value_int return 0
@@ -377,7 +377,7 @@ int ITc_system_settings_get_value_int_p(void)
 * @author                              SRID(parshant.v)
 * @reviewer                            SRID(gupta.sanjay)
 * @type                                auto
-* @description                 Registers and Unregister a change event callback for the given system settings key 
+* @description                 Registers and Unregister a change event callback for the given system settings key
 * @scenario                            Registers and Unregister a change event callback for the given system settings key
 * @apicovered                  system_settings_set_changed_cb, system_settings_unset_changed_cb
 * @passcase                            If system_settings_set_changed_cb and system_settings_unset_changed_cb return 0
@@ -388,23 +388,38 @@ int ITc_system_settings_get_value_int_p(void)
 int ITc_system_settings_set_unset_changed_cb_p(void)
 {
        START_TEST;
-       
-       system_settings_key_e key = SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION;
+
+       int nRetVal = -1;
        void *pvUserData = "User data";
 
-       int nRetVal = system_settings_set_changed_cb(key,System_settings_changed_cb_p, pvUserData);//target api//register callback
-       if ( nRetVal != SYSTEM_SETTINGS_ERROR_NONE && nRetVal != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED )
+       system_settings_key_e e_System_Settings_Key[]=
        {
-               FPRINTF("\\n[Line : %d][%s] system_settings_set_changed_cb failed , error returned = %s", __LINE__, API_NAMESPACE, SystemSettingsGetError(nRetVal));
-               return 1;
-       }
-       //Unregisters the callback function.
-       nRetVal = system_settings_unset_changed_cb(key);//target api//unregister callback
-       if ( nRetVal != SYSTEM_SETTINGS_ERROR_NONE && nRetVal != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED )
+               SYSTEM_SETTINGS_KEY_MOTION_ACTIVATION,
+               SYSTEM_SETTINGS_KEY_ACCESSIBILITY_GRAYSCALE,
+               SYSTEM_SETTINGS_KEY_ACCESSIBILITY_NEGATIVE_COLOR
+       };
+       int nEnumSize = sizeof(e_System_Settings_Key) / sizeof(e_System_Settings_Key[0]);
+       int enum_counter=0;
+       system_settings_key_e key;
+       for ( enum_counter=0; enum_counter<nEnumSize; enum_counter++ )
        {
-               FPRINTF("\\n[Line : %d][%s] system_settings_unset_changed_cb failed , error returned = %s", __LINE__, API_NAMESPACE, SystemSettingsGetError(nRetVal));
-               return 1;
+               key = e_System_Settings_Key[enum_counter];
+
+               nRetVal = system_settings_set_changed_cb(key,System_settings_changed_cb_p, pvUserData);//target api//register callback
+               if ( nRetVal != SYSTEM_SETTINGS_ERROR_NONE && nRetVal != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED )
+               {
+                       FPRINTF("\\n[Line : %d][%s] system_settings_set_changed_cb failed , error returned = %s", __LINE__, API_NAMESPACE, SystemSettingsGetError(nRetVal));
+                       return 1;
+               }
+               //Unregisters the callback function.
+               nRetVal = system_settings_unset_changed_cb(key);//target api//unregister callback
+               if ( nRetVal != SYSTEM_SETTINGS_ERROR_NONE && nRetVal != SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED )
+               {
+                       FPRINTF("\\n[Line : %d][%s] system_settings_unset_changed_cb failed , error returned = %s", __LINE__, API_NAMESPACE, SystemSettingsGetError(nRetVal));
+                       return 1;
+               }
        }
+
        return 0;
 }
 
@@ -517,5 +532,5 @@ int ITc_system_settings_add_remove_changed_cb_p(void)
        return 0;
 }
 
-/** @} */ 
-/** @} */ 
+/** @} */
+/** @} */