[UTC][runtime-info][NON-ACR] check more feature support 61/249761/1
authorYunmi Ha <yunmi.ha@samsung.com>
Wed, 16 Dec 2020 10:47:02 +0000 (19:47 +0900)
committerYunmi Ha <yunmi.ha@samsung.com>
Wed, 16 Dec 2020 10:50:28 +0000 (10:50 +0000)
- In some cases, allow 'Not supported' error depending on feature value.
 (Packet data, Data roaming, Vibration and TV out)

- Related API change:
 https://review.tizen.org/gerrit/#/c/platform/core/api/runtime-info/+/219933/

Change-Id: I0e961eba1a7e7488528594a7039bdd780db6949b
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
src/utc/runtime-info/utc-runtime-info.c

index 50125bad11e71e8260bf45ec093a09bb6a12912c..8a2be87a974374f1ad5c618dd1907ae048ff0afb 100755 (executable)
@@ -659,8 +659,7 @@ int utc_runtime_info_DATA_ROAMING_ENABLED_p1(void)
 
     retcode = runtime_info_get_value_bool(key, &value);
 
-    assert_eq(retcode, RUNTIME_INFO_ERROR_NONE);
-    return 0;
+    return compare_retcode_with_feature_support(retcode, "http://tizen.org/feature/network.telephony");
 }
 
 
@@ -675,12 +674,10 @@ int utc_runtime_info_DATA_ROAMING_ENABLED_p2(void)
     runtime_info_key_e key = RUNTIME_INFO_KEY_DATA_ROAMING_ENABLED;
 
     retcode = runtime_info_set_changed_cb(key, runtime_info_changed, NULL);
+    if (retcode == RUNTIME_INFO_ERROR_NONE)
+        runtime_info_unset_changed_cb(key);
 
-    assert_eq(retcode, RUNTIME_INFO_ERROR_NONE);
-
-    runtime_info_unset_changed_cb(key);
-
-    return 0;
+    return compare_retcode_with_feature_support(retcode, "http://tizen.org/feature/network.telephony");
 }
 
 
@@ -907,8 +904,7 @@ int utc_runtime_info_PACKET_DATA_ENABLED_p1(void)
 
     retcode = runtime_info_get_value_bool(key, &value);
 
-    assert_eq(retcode, RUNTIME_INFO_ERROR_NONE);
-    return 0;
+    return compare_retcode_with_feature_support(retcode, "http://tizen.org/feature/network.telephony");
 }
 
 
@@ -924,11 +920,10 @@ int utc_runtime_info_PACKET_DATA_ENABLED_p2(void)
 
     retcode = runtime_info_set_changed_cb(key, runtime_info_changed, NULL);
 
-    assert_eq(retcode, RUNTIME_INFO_ERROR_NONE);
-
-    runtime_info_unset_changed_cb(key);
+    if (retcode == RUNTIME_INFO_ERROR_NONE)
+        runtime_info_unset_changed_cb(key);
 
-    return 0;
+    return compare_retcode_with_feature_support(retcode, "http://tizen.org/feature/network.telephony");
 }
 
 
@@ -1253,8 +1248,7 @@ int utc_runtime_info_VIBRATION_ENABLED_p1(void)
 
     retcode = runtime_info_get_value_bool(key, &value);
 
-    assert_eq(retcode, RUNTIME_INFO_ERROR_NONE);
-    return 0;
+    return compare_retcode_with_feature_support(retcode, "http://tizen.org/feature/feedback.vibration");
 }
 
 
@@ -1270,11 +1264,10 @@ int utc_runtime_info_VIBRATION_ENABLED_p2(void)
 
     retcode = runtime_info_set_changed_cb(key, runtime_info_changed, NULL);
 
-    assert_eq(retcode, RUNTIME_INFO_ERROR_NONE);
-
-    runtime_info_unset_changed_cb(key);
+    if (retcode == RUNTIME_INFO_ERROR_NONE)
+        runtime_info_unset_changed_cb(key);
 
-    return 0;
+    return compare_retcode_with_feature_support(retcode, "http://tizen.org/feature/feedback.vibration");
 }
 
 
@@ -1473,11 +1466,21 @@ int utc_runtime_info_TV_OUT_CONNECTED_p1(void)
 {
     bool value;
     int retcode;
+    bool support = false;
+
     runtime_info_key_e key = RUNTIME_INFO_KEY_TV_OUT_CONNECTED;
 
     retcode = runtime_info_get_value_bool(key, &value);
 
-    assert_eq(retcode, RUNTIME_INFO_ERROR_NONE);
+    system_info_get_platform_bool("http://tizen.org/feature/screen.output.hdmi", &support);
+    if (!support)
+        system_info_get_platform_bool("http://tizen.org/feature/screen.output.rca", &support);
+
+    if (support)
+        assert_eq(retcode, SYSTEM_INFO_ERROR_NONE);
+    else
+        assert_eq(retcode, RUNTIME_INFO_ERROR_NOT_SUPPORTED);
+
     return 0;
 }
 
@@ -1490,11 +1493,19 @@ int utc_runtime_info_TV_OUT_CONNECTED_p1(void)
 int utc_runtime_info_TV_OUT_CONNECTED_p2(void)
 {
     int retcode;
+    bool support = false;
     runtime_info_key_e key = RUNTIME_INFO_KEY_TV_OUT_CONNECTED;
 
     retcode = runtime_info_set_changed_cb(key, runtime_info_changed, NULL);
 
-    assert_eq(retcode, RUNTIME_INFO_ERROR_NONE);
+    system_info_get_platform_bool("http://tizen.org/feature/screen.output.hdmi", &support);
+    if (!support)
+        system_info_get_platform_bool("http://tizen.org/feature/screen.output.rca", &support);
+
+    if (support)
+        assert_eq(retcode, SYSTEM_INFO_ERROR_NONE);
+    else
+        assert_eq(retcode, RUNTIME_INFO_ERROR_NOT_SUPPORTED);
 
     runtime_info_unset_changed_cb(key);