[NativeTCT][Device][NonACR][6.5 Apply display feature for iot profile] 38/254138/8
authorlokilee73 <changjoo.lee@samsung.com>
Wed, 24 Feb 2021 04:48:42 +0000 (13:48 +0900)
committerlokilee73 <changjoo.lee@samsung.com>
Wed, 24 Feb 2021 09:18:07 +0000 (18:18 +0900)
Change-Id: I23eb3ae83c75c06d4b91f1969d779ff87431c2c3
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
src/itc/device/ITs-device.c [changed mode: 0755->0644]
src/itc/device/ITs-device_display.c [changed mode: 0755->0644]
src/itc/device/ITs-device_power.c [changed mode: 0755->0644]
src/utc/device/tct-device-core_mobile.h [changed mode: 0755->0644]
src/utc/device/tct-device-core_tizeniot.h [changed mode: 0755->0644]
src/utc/device/tct-device-core_tv.h [changed mode: 0755->0644]
src/utc/device/tct-device-core_wearable.h [changed mode: 0755->0644]
src/utc/device/utc-system-device-power.c [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index de5d170..c94717d
 
 //& set: Device
 
-bool g_ReturnValueState;
-bool g_bDeviceChangedCallback;
-bool bIsBATTERYFeatureSupported;
-bool bIsDisplayStateFeatureSupported;
-bool bIsDisplayFeatureSupported;
-int nDeviceTimeoutId;
+static bool g_ReturnValueState;
+static bool g_bDeviceChangedCallback;
+static bool bIsBATTERYFeatureSupported;
+static bool bIsDisplayStateFeatureSupported;
+static bool bIsDisplayFeatureSupported;
+static int nDeviceTimeoutId;
 
 //Add  related feature here
 #define BATTERY_FEATURE                                "http://tizen.org/feature/battery"
old mode 100755 (executable)
new mode 100644 (file)
index a27d236..5999bbe
@@ -21,8 +21,8 @@
 */
 
 //& set: Device
-bool bIsDisplayStateFeatureSupported;
-bool bIsDisplayFeatureSupported;
+static bool bIsDisplayStateFeatureSupported;
+static bool bIsDisplayFeatureSupported;
 
 /**
 * @function            ITs_device_display_startup
old mode 100755 (executable)
new mode 100644 (file)
index ba858e1..bbbd8af
@@ -21,7 +21,8 @@
 */
 
 //& set: Device
-bool bIsDisplayStateFeatureSupported;
+static bool bIsDisplayFeatureSupported;
+static bool bIsDisplayStateFeatureSupported;
 
 /**
 * @function            ITs_device_power_startup
@@ -40,6 +41,9 @@ void ITs_device_power_startup(void)
 #if DEBUG
        FPRINTF("[Line : %d][%s] TEST SUIT start-up: ITs_Device_p\\n", __LINE__, API_NAMESPACE);
 #endif
+       bIsDisplayFeatureSupported = false;
+       IS_FEATURE_SUPPORTED(DISPLAY_FEATURE_MAIN, bIsDisplayFeatureSupported, API_NAMESPACE);
+
        bIsDisplayStateFeatureSupported = false;
        IS_FEATURE_SUPPORTED(DISPLAY_STATE_FEATURE, bIsDisplayStateFeatureSupported, API_NAMESPACE);
        return;
@@ -95,6 +99,22 @@ int ITc_device_power_request_release_lock_p(void)
        {
                // Target API
                int nRet = device_power_request_lock(power_locks[enum_counter], 10);
+               if ((bIsDisplayFeatureSupported == false) ||
+                       (bIsDisplayStateFeatureSupported == false))
+               {
+                       if ((power_locks[enum_counter] == POWER_LOCK_DISPLAY) ||
+                               (power_locks[enum_counter] == POWER_LOCK_DISPLAY_DIM))
+                       {
+                               assert_eq(nRet, DEVICE_ERROR_NOT_SUPPORTED);
+                               return 0;
+                       }
+                       else if (power_locks[enum_counter] == POWER_LOCK_CPU)
+                       {
+                               assert_eq(nRet, DEVICE_ERROR_NONE);
+                               return 0;
+                       }
+               }
+
                if ( nRet != DEVICE_ERROR_NONE )
                {
                        FPRINTF("[Line : %d][%s] device_power_request_lock failed for enum = %s, error returned = %s\\n",
@@ -104,6 +124,22 @@ int ITc_device_power_request_release_lock_p(void)
 
                // Target API
                nRet  = device_power_release_lock(power_locks[enum_counter]);
+               if ((bIsDisplayFeatureSupported == false) ||
+                       (bIsDisplayStateFeatureSupported == false))
+               {
+                       if ((power_locks[enum_counter] == POWER_LOCK_DISPLAY) ||
+                               (power_locks[enum_counter] == POWER_LOCK_DISPLAY_DIM))
+                       {
+                               assert_eq(nRet, DEVICE_ERROR_NOT_SUPPORTED);
+                               return 0;
+                       }
+                       else if (power_locks[enum_counter] == POWER_LOCK_CPU)
+                       {
+                               assert_eq(nRet, DEVICE_ERROR_NONE);
+                               return 0;
+                       }
+               }
+
                if ( nRet != DEVICE_ERROR_NONE )
                {
                        FPRINTF("[Line : %d][%s] device_power_release_lock failed for enum = %s, error returned = %s\\n",
old mode 100755 (executable)
new mode 100644 (file)
index d7c3bb9..3c9d9ef
@@ -21,6 +21,8 @@
 
 extern void utc_system_device_display_startup(void);
 extern void utc_system_device_display_cleanup(void);
+extern void utc_system_device_power_startup(void);
+extern void utc_system_device_power_cleanup(void);
 extern void utc_system_haptic_startup(void);
 extern void utc_system_haptic_cleanup(void);
 extern void utc_system_device_ir_startup(void);
@@ -127,13 +129,13 @@ testcase tc_array[] = {
        {"utc_system_device_display_get_state_n",utc_system_device_display_get_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
        {"utc_system_device_display_change_state_p",utc_system_device_display_change_state_p,utc_system_device_display_startup,utc_system_device_display_cleanup},
        {"utc_system_device_display_change_state_n",utc_system_device_display_change_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
-       {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,NULL,NULL},
-       {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,NULL,NULL},
-       {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,NULL,NULL},
-       {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,NULL,NULL},
-       {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,NULL,NULL},
-       {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,NULL,NULL},
-       {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,NULL,NULL},
+       {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
        {"utc_system_device_battery_get_percent_p",utc_system_device_battery_get_percent_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
        {"utc_system_device_battery_get_percent_n",utc_system_device_battery_get_percent_n,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
        {"utc_system_device_battery_is_charging_p",utc_system_device_battery_is_charging_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
old mode 100755 (executable)
new mode 100644 (file)
index d7c3bb9..3c9d9ef
@@ -21,6 +21,8 @@
 
 extern void utc_system_device_display_startup(void);
 extern void utc_system_device_display_cleanup(void);
+extern void utc_system_device_power_startup(void);
+extern void utc_system_device_power_cleanup(void);
 extern void utc_system_haptic_startup(void);
 extern void utc_system_haptic_cleanup(void);
 extern void utc_system_device_ir_startup(void);
@@ -127,13 +129,13 @@ testcase tc_array[] = {
        {"utc_system_device_display_get_state_n",utc_system_device_display_get_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
        {"utc_system_device_display_change_state_p",utc_system_device_display_change_state_p,utc_system_device_display_startup,utc_system_device_display_cleanup},
        {"utc_system_device_display_change_state_n",utc_system_device_display_change_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
-       {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,NULL,NULL},
-       {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,NULL,NULL},
-       {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,NULL,NULL},
-       {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,NULL,NULL},
-       {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,NULL,NULL},
-       {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,NULL,NULL},
-       {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,NULL,NULL},
+       {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
        {"utc_system_device_battery_get_percent_p",utc_system_device_battery_get_percent_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
        {"utc_system_device_battery_get_percent_n",utc_system_device_battery_get_percent_n,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
        {"utc_system_device_battery_is_charging_p",utc_system_device_battery_is_charging_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
old mode 100755 (executable)
new mode 100644 (file)
index d7c3bb9..3c9d9ef
@@ -21,6 +21,8 @@
 
 extern void utc_system_device_display_startup(void);
 extern void utc_system_device_display_cleanup(void);
+extern void utc_system_device_power_startup(void);
+extern void utc_system_device_power_cleanup(void);
 extern void utc_system_haptic_startup(void);
 extern void utc_system_haptic_cleanup(void);
 extern void utc_system_device_ir_startup(void);
@@ -127,13 +129,13 @@ testcase tc_array[] = {
        {"utc_system_device_display_get_state_n",utc_system_device_display_get_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
        {"utc_system_device_display_change_state_p",utc_system_device_display_change_state_p,utc_system_device_display_startup,utc_system_device_display_cleanup},
        {"utc_system_device_display_change_state_n",utc_system_device_display_change_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
-       {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,NULL,NULL},
-       {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,NULL,NULL},
-       {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,NULL,NULL},
-       {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,NULL,NULL},
-       {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,NULL,NULL},
-       {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,NULL,NULL},
-       {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,NULL,NULL},
+       {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
        {"utc_system_device_battery_get_percent_p",utc_system_device_battery_get_percent_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
        {"utc_system_device_battery_get_percent_n",utc_system_device_battery_get_percent_n,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
        {"utc_system_device_battery_is_charging_p",utc_system_device_battery_is_charging_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
old mode 100755 (executable)
new mode 100644 (file)
index d7c3bb9..3c9d9ef
@@ -21,6 +21,8 @@
 
 extern void utc_system_device_display_startup(void);
 extern void utc_system_device_display_cleanup(void);
+extern void utc_system_device_power_startup(void);
+extern void utc_system_device_power_cleanup(void);
 extern void utc_system_haptic_startup(void);
 extern void utc_system_haptic_cleanup(void);
 extern void utc_system_device_ir_startup(void);
@@ -127,13 +129,13 @@ testcase tc_array[] = {
        {"utc_system_device_display_get_state_n",utc_system_device_display_get_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
        {"utc_system_device_display_change_state_p",utc_system_device_display_change_state_p,utc_system_device_display_startup,utc_system_device_display_cleanup},
        {"utc_system_device_display_change_state_n",utc_system_device_display_change_state_n,utc_system_device_display_startup,utc_system_device_display_cleanup},
-       {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,NULL,NULL},
-       {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,NULL,NULL},
-       {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,NULL,NULL},
-       {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,NULL,NULL},
-       {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,NULL,NULL},
-       {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,NULL,NULL},
-       {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,NULL,NULL},
+       {"utc_system_device_power_request_lock_p_1",utc_system_device_power_request_lock_p_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_p_2",utc_system_device_power_request_lock_p_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_n_1",utc_system_device_power_request_lock_n_1,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_request_lock_n_2",utc_system_device_power_request_lock_n_2,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_release_lock_p",utc_system_device_power_release_lock_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_release_lock_n",utc_system_device_power_release_lock_n,utc_system_device_power_startup,utc_system_device_power_cleanup},
+       {"utc_system_device_power_wakeup_p",utc_system_device_power_wakeup_p,utc_system_device_power_startup,utc_system_device_power_cleanup},
        {"utc_system_device_battery_get_percent_p",utc_system_device_battery_get_percent_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
        {"utc_system_device_battery_get_percent_n",utc_system_device_battery_get_percent_n,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
        {"utc_system_device_battery_is_charging_p",utc_system_device_battery_is_charging_p,utc_system_device_battery_startup,utc_system_device_battery_cleanup},
old mode 100755 (executable)
new mode 100644 (file)
index 0d39fc9..c66b3b5
 
 //& set: DevicePower
 
-#define DISPLAY_STATE_FEATURE        "http://tizen.org/feature/display.state"
+#define DISPLAY_FEATURE        "http://tizen.org/feature/display"
+#define DISPLAY_STATE_FEATURE  "http://tizen.org/feature/display.state"
 #define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
 
 power_lock_e locks[] = {
        POWER_LOCK_CPU,
 };
 
+static bool bIsDisplayFeatureSupported;
+static bool bIsDisplayStateFeatureSupported;
+
+/**
+ * @function           utc_system_device_power_startup
+ * @description                Called before each test
+ * @parameter          NA
+ * @return                     NA
+ */
+void utc_system_device_power_startup(void)
+{
+       int ret;
+
+       ret = system_info_get_platform_bool(DISPLAY_FEATURE, &bIsDisplayFeatureSupported);
+       ret = system_info_get_platform_bool(DISPLAY_STATE_FEATURE, &bIsDisplayStateFeatureSupported);
+}
+
+/**
+ * @function           utc_system_device_power_cleanup
+ * @description                Called after each test
+ * @parameter          NA
+ * @return                     NA
+ */
+void utc_system_device_power_cleanup(void)
+{
+
+}
+
 /**
  * @testcase           utc_system_device_power_request_lock_p_1
  * @since_tizen                2.3
@@ -36,6 +65,17 @@ int utc_system_device_power_request_lock_p_1(void)
 
        for (i = 0; i < ARRAY_SIZE(locks); i++) {
                error = device_power_request_lock(locks[i], 0);
+               if ((bIsDisplayFeatureSupported == false) ||
+                       (bIsDisplayStateFeatureSupported == false))     {
+                       if ((locks[i] == POWER_LOCK_DISPLAY) ||
+                               (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
+                               assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
+                               return 0;
+                       } else if (locks[i] == POWER_LOCK_CPU) {
+                               assert_eq(error, DEVICE_ERROR_NONE);
+                               return 0;
+                       }
+               }
                assert_eq(error, DEVICE_ERROR_NONE);
                device_power_release_lock(locks[i]);
        }
@@ -54,6 +94,17 @@ int utc_system_device_power_request_lock_p_2(void)
 
        for (i = 0; i < ARRAY_SIZE(locks); i++) {
                error = device_power_request_lock(locks[i], 10);
+               if ((bIsDisplayFeatureSupported == false) ||
+                       (bIsDisplayStateFeatureSupported == false))     {
+                       if ((locks[i] == POWER_LOCK_DISPLAY) ||
+                               (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
+                               assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
+                               return 0;
+                       } else if (locks[i] == POWER_LOCK_CPU) {
+                               assert_eq(error, DEVICE_ERROR_NONE);
+                               return 0;
+                       }
+               }
                assert_eq(error, DEVICE_ERROR_NONE);
                device_power_release_lock(locks[i]);
        }
@@ -88,6 +139,17 @@ int utc_system_device_power_request_lock_n_2(void)
 
        for (i = 0; i < ARRAY_SIZE(locks); i++) {
                error = device_power_request_lock(locks[i], -1);
+               if ((bIsDisplayFeatureSupported == false) ||
+                       (bIsDisplayStateFeatureSupported == false)) {
+                       if ((locks[i] == POWER_LOCK_DISPLAY) ||
+                               (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
+                               assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
+                               return 0;
+                       } else if (locks[i] == POWER_LOCK_CPU) {
+                               assert_eq(error, DEVICE_ERROR_NONE);
+                               return 0;
+                       }
+               }
                assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER);
        }
 
@@ -106,6 +168,17 @@ int utc_system_device_power_release_lock_p(void)
        for (i = 0; i < ARRAY_SIZE(locks); i++) {
                device_power_request_lock(locks[i], 0);
                error = device_power_release_lock(locks[i]);
+               if ((bIsDisplayFeatureSupported == false) ||
+                       (bIsDisplayStateFeatureSupported == false)) {
+                       if ((locks[i] == POWER_LOCK_DISPLAY) ||
+                               (locks[i] == POWER_LOCK_DISPLAY_DIM)) {
+                               assert_eq(error, DEVICE_ERROR_NOT_SUPPORTED);
+                               return 0;
+                       } else if (locks[i] == POWER_LOCK_CPU) {
+                               assert_eq(error, DEVICE_ERROR_NONE);
+                               return 0;
+                       }
+               }
                assert_eq(error, DEVICE_ERROR_NONE);
        }
 
@@ -124,6 +197,7 @@ int utc_system_device_power_release_lock_n(void)
        for (i = 0; i < ARRAY_SIZE(locks); i++) {
                device_power_request_lock(locks[i], 0);
                error = device_power_release_lock(-1);
+
                assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER);
                device_power_release_lock(locks[i]);
        }