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
*/
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;
*/
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;
*/
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;