From: Youngjae Cho Date: Fri, 4 Mar 2022 06:11:21 +0000 (+0900) Subject: [UTC][device][Non-ACR] Fix ENOTSUP not to be considered as an error X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c60b812a99e6cd2233f5e294321a13ae942c583;p=test%2Ftct%2Fnative%2Fapi.git [UTC][device][Non-ACR] Fix ENOTSUP not to be considered as an error Change-Id: I027ebcd4e611ecb1cc06d1d76a137a88620579d9 Signed-off-by: Youngjae Cho --- diff --git a/src/utc/device/utc-system-device-display.c b/src/utc/device/utc-system-device-display.c index 6142e6e50..bc74119a0 100755 --- a/src/utc/device/utc-system-device-display.c +++ b/src/utc/device/utc-system-device-display.c @@ -33,6 +33,23 @@ static bool g_DisplayStateFeature = false; static int cnt; +/* Do not regard DEVICE_ERROR_NOT_SUPPORTED as an error for brightness operation. + * + * It is likely to return DEVICE_ERROR_NOT_SUPPORTED even though the display feature is true. + * This is mainly in case of headed tizeniot profile, which supports plugin-display. + * If a display is attached, it works properly, returning DEVICE_ERROR_NONE. On the other hand, + * if a display is detached, it returns DEVICE_ERROR_NOT_SUPPORTED and it won't work. This is + * intended behaviour, not an error case. */ +static int assert_except_not_supported(int error, int val) +{ + if (error == DEVICE_ERROR_NOT_SUPPORTED) + return 0; + + assert_eq(error, val); + + return 0; +} + /** * @function utc_system_device_display_startup * @description Called before each test @@ -102,14 +119,16 @@ int utc_system_device_display_get_numbers_n(void) */ int utc_system_device_display_get_max_brightness_p(void) { - int value, error, i; + int value, error, i, ret; for (i = 0; i < cnt; i++) { error = device_display_get_max_brightness(i, &value); if (g_DisplayFeature == false) assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED); - else - assert_eq(error, DEVICE_ERROR_NONE); + + ret = assert_except_not_supported(error, DEVICE_ERROR_NONE); + if (ret != 0) + return ret; } return 0; @@ -160,14 +179,16 @@ int utc_system_device_display_get_max_brightness_n_2(void) */ int utc_system_device_display_get_brightness_p(void) { - int value, error, i; + int value, error, i, ret; for (i = 0; i < cnt; i++) { error = device_display_get_brightness(i, &value); if (g_DisplayFeature == false) assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED); - else - assert_eq(error, DEVICE_ERROR_NONE); + + ret = assert_except_not_supported(error, DEVICE_ERROR_NONE); + if (ret != 0) + return ret; } return 0; @@ -218,20 +239,24 @@ int utc_system_device_display_get_brightness_n_2(void) */ int utc_system_device_display_set_brightness_p(void) { - int max, error, i; + int max, error, i, ret; for (i = 0; i < cnt; i++) { error = device_display_get_max_brightness(i, &max); if (g_DisplayFeature == false) assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED); - else - assert_eq(error, DEVICE_ERROR_NONE); + + ret = assert_except_not_supported(error, DEVICE_ERROR_NONE); + if (ret != 0) + return ret; error = device_display_set_brightness(i, max); if (g_DisplayFeature == false) assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED); - else - assert_eq(error, DEVICE_ERROR_NONE); + + ret = assert_except_not_supported(error, DEVICE_ERROR_NONE); + if (ret != 0) + return ret; } return 0;