From 09111c2c5eb88dd295326add3e80858da69063ae Mon Sep 17 00:00:00 2001 From: taeyoung Date: Thu, 16 Jun 2016 18:39:26 +0900 Subject: [PATCH] [UTC][device][ACR-622][Add battery status api TCs] Signed-off-by: taeyoung Change-Id: I2ff17117c8e7ee4b8a2e6b449a33937a2b35dacb --- src/utc/device/public.list | 4 + src/utc/device/tct-device-core_mobile.h | 16 ++++ src/utc/device/tct-device-core_wearable.h | 16 ++++ src/utc/device/utc-system-device-battery.c | 133 ++++++++++++++++++++++++++++- 4 files changed, 168 insertions(+), 1 deletion(-) diff --git a/src/utc/device/public.list b/src/utc/device/public.list index 2774d08..7f50031 100755 --- a/src/utc/device/public.list +++ b/src/utc/device/public.list @@ -2,6 +2,10 @@ device_add_callback device_battery_get_level_status device_battery_get_percent device_battery_is_charging +device_battery_get_health +device_battery_get_power_source +device_battery_get_status +device_battery_get_property device_display_change_state device_display_get_brightness device_display_get_max_brightness diff --git a/src/utc/device/tct-device-core_mobile.h b/src/utc/device/tct-device-core_mobile.h index b947925..9acab63 100755 --- a/src/utc/device/tct-device-core_mobile.h +++ b/src/utc/device/tct-device-core_mobile.h @@ -30,6 +30,14 @@ extern int utc_system_device_battery_is_charging_p(void); extern int utc_system_device_battery_is_charging_n(void); extern int utc_system_device_battery_get_level_status_p(void); extern int utc_system_device_battery_get_level_status_n(void); +extern int utc_system_device_battery_get_health_p(void); +extern int utc_system_device_battery_get_health_n(void); +extern int utc_system_device_battery_get_power_source_p(void); +extern int utc_system_device_battery_get_power_source_p(void); +extern int utc_system_device_battery_get_status_p(void); +extern int utc_system_device_battery_get_status_n(void); +extern int utc_system_device_battery_get_property_p(void); +extern int utc_system_device_battery_get_property_n(void); extern int utc_system_device_add_callback_p(void); extern int utc_system_device_add_callback_n_1(void); extern int utc_system_device_add_callback_n_2(void); @@ -98,6 +106,14 @@ testcase tc_array[] = { {"utc_system_device_battery_is_charging_n", utc_system_device_battery_is_charging_n, NULL, NULL}, {"utc_system_device_battery_get_level_status_p", utc_system_device_battery_get_level_status_p, NULL, NULL}, {"utc_system_device_battery_get_level_status_n", utc_system_device_battery_get_level_status_n, NULL, NULL}, + {"utc_system_device_battery_get_health_p", utc_system_device_battery_get_health_p, NULL, NULL}, + {"utc_system_device_battery_get_health_n", utc_system_device_battery_get_health_n, NULL, NULL}, + {"utc_system_device_battery_get_power_source_p", utc_system_device_battery_get_power_source_p, NULL, NULL}, + {"utc_system_device_battery_get_power_source_n", utc_system_device_battery_get_power_source_n, NULL, NULL}, + {"utc_system_device_battery_get_status_p", utc_system_device_battery_get_status_p, NULL, NULL}, + {"utc_system_device_battery_get_status_n", utc_system_device_battery_get_status_n, NULL, NULL}, + {"utc_system_device_battery_get_property_p", utc_system_device_battery_get_property_p, NULL, NULL}, + {"utc_system_device_battery_get_property_n", utc_system_device_battery_get_property_n, NULL, NULL}, {"utc_system_device_add_callback_p", utc_system_device_add_callback_p, NULL, NULL}, {"utc_system_device_add_callback_n_1", utc_system_device_add_callback_n_1, NULL, NULL}, {"utc_system_device_add_callback_n_2", utc_system_device_add_callback_n_2, NULL, NULL}, diff --git a/src/utc/device/tct-device-core_wearable.h b/src/utc/device/tct-device-core_wearable.h index b947925..9acab63 100755 --- a/src/utc/device/tct-device-core_wearable.h +++ b/src/utc/device/tct-device-core_wearable.h @@ -30,6 +30,14 @@ extern int utc_system_device_battery_is_charging_p(void); extern int utc_system_device_battery_is_charging_n(void); extern int utc_system_device_battery_get_level_status_p(void); extern int utc_system_device_battery_get_level_status_n(void); +extern int utc_system_device_battery_get_health_p(void); +extern int utc_system_device_battery_get_health_n(void); +extern int utc_system_device_battery_get_power_source_p(void); +extern int utc_system_device_battery_get_power_source_p(void); +extern int utc_system_device_battery_get_status_p(void); +extern int utc_system_device_battery_get_status_n(void); +extern int utc_system_device_battery_get_property_p(void); +extern int utc_system_device_battery_get_property_n(void); extern int utc_system_device_add_callback_p(void); extern int utc_system_device_add_callback_n_1(void); extern int utc_system_device_add_callback_n_2(void); @@ -98,6 +106,14 @@ testcase tc_array[] = { {"utc_system_device_battery_is_charging_n", utc_system_device_battery_is_charging_n, NULL, NULL}, {"utc_system_device_battery_get_level_status_p", utc_system_device_battery_get_level_status_p, NULL, NULL}, {"utc_system_device_battery_get_level_status_n", utc_system_device_battery_get_level_status_n, NULL, NULL}, + {"utc_system_device_battery_get_health_p", utc_system_device_battery_get_health_p, NULL, NULL}, + {"utc_system_device_battery_get_health_n", utc_system_device_battery_get_health_n, NULL, NULL}, + {"utc_system_device_battery_get_power_source_p", utc_system_device_battery_get_power_source_p, NULL, NULL}, + {"utc_system_device_battery_get_power_source_n", utc_system_device_battery_get_power_source_n, NULL, NULL}, + {"utc_system_device_battery_get_status_p", utc_system_device_battery_get_status_p, NULL, NULL}, + {"utc_system_device_battery_get_status_n", utc_system_device_battery_get_status_n, NULL, NULL}, + {"utc_system_device_battery_get_property_p", utc_system_device_battery_get_property_p, NULL, NULL}, + {"utc_system_device_battery_get_property_n", utc_system_device_battery_get_property_n, NULL, NULL}, {"utc_system_device_add_callback_p", utc_system_device_add_callback_p, NULL, NULL}, {"utc_system_device_add_callback_n_1", utc_system_device_add_callback_n_1, NULL, NULL}, {"utc_system_device_add_callback_n_2", utc_system_device_add_callback_n_2, NULL, NULL}, diff --git a/src/utc/device/utc-system-device-battery.c b/src/utc/device/utc-system-device-battery.c index a595b69..f480cbc 100755 --- a/src/utc/device/utc-system-device-battery.c +++ b/src/utc/device/utc-system-device-battery.c @@ -110,4 +110,135 @@ int utc_system_device_battery_get_level_status_n(void) return 0; } -#endif //COMMON_IOT \ No newline at end of file + +/** + * @testcase utc_system_device_battery_get_health_p + * @since_tizen 3.0 + * @description Positive test case of device_battery_get_health. + */ +int utc_system_device_battery_get_health_p(void) +{ + device_battery_health_e health; + int error; + + error = device_battery_get_health(&health); + assert_eq(error, DEVICE_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_system_device_battery_get_health_n + * @since_tizen 3.0 + * @description Negative test case of device_battery_get_health. + */ +int utc_system_device_battery_get_health_n(void) +{ + int error; + + error = device_battery_get_health(NULL); + assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_system_device_battery_get_power_source_p + * @since_tizen 3.0 + * @description Positive test case of device_battery_get_power_source. + */ +int utc_system_device_battery_get_power_source_p(void) +{ + device_battery_power_source_e power; + int error; + + error = device_battery_get_power_source(&power); + assert_eq(error, DEVICE_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_system_device_battery_get_power_source_n + * @since_tizen 3.0 + * @description Negative test case of device_battery_get_power_source. + */ +int utc_system_device_battery_get_power_source_n(void) +{ + int error; + + error = device_battery_get_power_source(NULL); + assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_system_device_battery_get_status_p + * @since_tizen 3.0 + * @description Positive test case of device_battery_get_status. + */ +int utc_system_device_battery_get_status_p(void) +{ + device_battery_status_e status; + int error; + + error = device_battery_get_status(&status); + assert_eq(error, DEVICE_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_system_device_battery_get_status_n + * @since_tizen 3.0 + * @description Negative test case of device_battery_get_status. + */ +int utc_system_device_battery_get_status_n(void) +{ + int error; + + error = device_battery_get_status(NULL); + assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER); + + return 0; +} + +/** + * @testcase utc_system_device_battery_get_property_p + * @since_tizen 3.0 + * @description Positive test case of device_battery_get_property. + */ +int utc_system_device_battery_get_property_p(void) +{ + int value; + int error; + + error = device_battery_get_property(DEVICE_BATTERY_PROPERTY_CAPACITY, &value); + assert_eq(error, DEVICE_ERROR_NONE); + + error = device_battery_get_property(DEVICE_BATTERY_PROPERTY_CURRENT_NOW, &value); + assert_eq(error, DEVICE_ERROR_NONE); + + error = device_battery_get_property(DEVICE_BATTERY_PROPERTY_CURRENT_AVERAGE, &value); + assert_eq(error, DEVICE_ERROR_NONE); + + return 0; +} + +/** + * @testcase utc_system_device_battery_get_property_n + * @since_tizen 3.0 + * @description Negative test case of device_battery_get_property. + */ +int utc_system_device_battery_get_property_n(void) +{ + int error; + + error = device_battery_get_property(DEVICE_BATTERY_PROPERTY_CAPACITY, NULL); + assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER); + + return 0; +} + +#endif //COMMON_IOT -- 2.7.4