[ITC][UTC][device][Non-ACR][Add Exception handling for unavailable display state] 18/304118/3
authorYunhee Seo <yuni.seo@samsung.com>
Wed, 10 Jan 2024 06:41:38 +0000 (15:41 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Fri, 12 Jan 2024 05:55:55 +0000 (14:55 +0900)
The availability of DISPLAY_STATE_SCREEN_DIM state varies depending on the profile and usage.
Thus, DISPLAY_STATE_SCREEN_DIM state handling code has been added to enable
testing without profile dependence.

Change-Id: I932ac0128f80be8e2cb3c671540f65acbf16a4da
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
src/itc/device/ITs-device.c
src/itc/device/ITs-device_display.c
src/utc/device/utc-system-device-display.c

index e0c165c6f6b3eed5e58e2463e23fbe3495e00048..b3ebcfa50eda05bae7d4cd234addb12669544ea7 100644 (file)
@@ -226,14 +226,13 @@ int ITc_device_add_remove_callback_p(void)
 
                        //Get current display state
                        device_display_get_state(&display_state);
-#if (defined(MOBILE) || defined(TIZENIOT)) //Starts MOBILE or TIZENIOT
                        display_state_e display_states[] = { DISPLAY_STATE_NORMAL, DISPLAY_STATE_SCREEN_DIM, DISPLAY_STATE_SCREEN_OFF };
-#endif  // End MOBILE or TIZENIOT
-#if defined(TV) || defined(WEARABLE)
-                       display_state_e display_states[] = { DISPLAY_STATE_NORMAL, DISPLAY_STATE_SCREEN_OFF };
-#endif
-                       int states_size = sizeof(display_states) / sizeof(display_states[0]);
+                       int states_size = 3;
                        int states_counter = 0;
+                       int dim_supported = 0;
+
+                       dim_supported = device_display_change_state(DISPLAY_STATE_SCREEN_DIM);
+
                        for ( states_counter = 0; states_counter < states_size; states_counter++ )
                        {
                                // Make change to the current display state
@@ -241,6 +240,8 @@ int ITc_device_add_remove_callback_p(void)
                                //{
                                //      break;
                                //}
+                               if ( display_states[states_counter] == DISPLAY_STATE_SCREEN_DIM && dim_supported == DEVICE_ERROR_INVALID_PARAMETER)
+                                       continue;
 
                                if ( display_state != display_states[states_counter] )
                                {
index 5999bbe94b4a5af802de7a79bd248035d965aee5..69b73cc4162a37886e08dfae8670d4b7e582ff50 100644 (file)
@@ -225,19 +225,21 @@ int ITc_device_display_change_get_state_p(void)
        START_TEST;
 
        display_state_e getDisplayState;
-#if (defined(MOBILE) || defined(TIZENIOT)) //Starts MOBILE or TIZENIOT
        display_state_e display_states[] = { DISPLAY_STATE_NORMAL,DISPLAY_STATE_SCREEN_DIM,DISPLAY_STATE_SCREEN_OFF};
-#endif   // End MOBILE or TIZENIOT
-#if defined(TV) || defined(WEARABLE)
-       display_state_e display_states[] = { DISPLAY_STATE_NORMAL,DISPLAY_STATE_SCREEN_OFF};
-#endif
-       int enum_size = sizeof(display_states) / sizeof(display_states[0]);
+       int enum_size = 3;
        int enum_counter = 0;
+       int dim_supported = 0;
+
+       dim_supported = device_display_change_state(DISPLAY_STATE_SCREEN_DIM);
 
        for ( enum_counter=0; enum_counter<enum_size; enum_counter++)
        {
+               if (display_states[enum_counter] == DISPLAY_STATE_SCREEN_DIM && dim_supported == DEVICE_ERROR_INVALID_PARAMETER)
+                       continue;
+
                // Target API
                int nRet = device_display_change_state(display_states[enum_counter]);
+
                if (false == bIsDisplayFeatureSupported)
                {
                        PRINT_RESULT(DEVICE_ERROR_NOT_SUPPORTED, nRet, "device_display_change_state", DeviceGetError(nRet));
index bc74119a0eb724579bbc2755cef2157bd0160cc2..3aca4e29198b0ba4a62100eacee5afc37585feeb 100755 (executable)
@@ -24,12 +24,7 @@ static bool g_DisplayStateFeature = false;
 #define DISPLAY_FEATURE        "http://tizen.org/feature/display"
 #define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
 
-#if (defined(MOBILE) || defined(TIZENIOT)) //Starts MOBILE or TIZENIOT
-       display_state_e display_states[] = { DISPLAY_STATE_NORMAL,DISPLAY_STATE_SCREEN_DIM,DISPLAY_STATE_SCREEN_OFF};
-#endif   // End MOBILE or TIZENIOT
-#if defined(TV) || defined(WEARABLE)
-       display_state_e display_states[] = { DISPLAY_STATE_NORMAL,DISPLAY_STATE_SCREEN_OFF};
-#endif
+static display_state_e display_states[] = { DISPLAY_STATE_NORMAL,DISPLAY_STATE_SCREEN_DIM,DISPLAY_STATE_SCREEN_OFF};
 
 static int cnt;
 
@@ -371,8 +366,15 @@ int utc_system_device_display_get_state_n(void)
 int utc_system_device_display_change_state_p(void)
 {
        int error, i;
+       int dim_supported = 0;
+
+       dim_supported = device_display_change_state(DISPLAY_STATE_SCREEN_DIM);
 
        for (i = 0; i < ARRAY_SIZE(display_states); i++) {
+
+               if (display_states[i] == DISPLAY_STATE_SCREEN_DIM && dim_supported == DEVICE_ERROR_INVALID_PARAMETER)
+                       continue;
+
                error = device_display_change_state(display_states[i]);
                if (g_DisplayFeature == true && g_DisplayStateFeature == true)
                        assert_eq(error, DEVICE_ERROR_NONE);