From: lokilee73 Date: Thu, 21 Feb 2019 02:20:26 +0000 (+0900) Subject: [UTC][device][ACR-1343][Add device_thermal_get_temperature] X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F60%2F200260%2F5;p=test%2Ftct%2Fnative%2Fapi.git [UTC][device][ACR-1343][Add device_thermal_get_temperature] Change-Id: Id3cf2074d27496388c3d1e817cbb90cf6fe3f05c Signed-off-by: lokilee73 --- diff --git a/src/utc/device/CMakeLists.txt b/src/utc/device/CMakeLists.txt old mode 100644 new mode 100755 index 2b09999a2..d9610a294 --- a/src/utc/device/CMakeLists.txt +++ b/src/utc/device/CMakeLists.txt @@ -11,6 +11,7 @@ SET(TC_SOURCES utc-system-device-callback.c utc-system-device-display.c utc-system-device-power.c + utc-system-device-thermal.c ) ENDIF() @@ -20,6 +21,7 @@ SET(TC_SOURCES ${TC_SOURCES} utc-system-device-haptic.c utc-system-device-led.c utc-system-device-ir.c + utc-system-device-thermal.c ) ENDIF() @@ -29,7 +31,6 @@ PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED capi-system-info glib-2.0 dlog - ) INCLUDE_DIRECTORIES( diff --git a/src/utc/device/public.list b/src/utc/device/public.list old mode 100755 new mode 100644 index 7f50031bd..ad4904b50 --- a/src/utc/device/public.list +++ b/src/utc/device/public.list @@ -1,4 +1,4 @@ -device_add_callback +device_add_callback device_battery_get_level_status device_battery_get_percent device_battery_is_charging @@ -7,23 +7,24 @@ 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 -device_display_get_numbers +device_display_get_brightness +device_display_get_max_brightness +device_display_get_numbers device_display_get_state -device_display_set_brightness -device_flash_get_brightness -device_flash_get_max_brightness -device_flash_set_brightness -device_haptic_close -device_haptic_get_count -device_haptic_open -device_haptic_stop -device_haptic_vibrate -device_led_play_custom -device_led_stop_custom -device_power_release_lock -device_power_request_lock -device_power_wakeup -device_remove_callback +device_display_set_brightness +device_flash_get_brightness +device_flash_get_max_brightness +device_flash_set_brightness +device_haptic_close +device_haptic_get_count +device_haptic_open +device_haptic_stop +device_haptic_vibrate +device_led_play_custom +device_led_stop_custom +device_power_release_lock +device_power_request_lock +device_power_wakeup +device_remove_callback +device_thermal_get_temperature diff --git a/src/utc/device/tct-device-core_mobile.h b/src/utc/device/tct-device-core_mobile.h index 257d1bce3..d7c3bb950 100755 --- a/src/utc/device/tct-device-core_mobile.h +++ b/src/utc/device/tct-device-core_mobile.h @@ -26,6 +26,8 @@ extern void utc_system_haptic_cleanup(void); extern void utc_system_device_ir_startup(void); extern void utc_system_device_battery_startup(void); extern void utc_system_device_battery_cleanup(void); +extern void utc_system_device_thermal_startup(void); +extern void utc_system_device_thermal_cleanup(void); extern int utc_system_device_add_callback_p(void); extern int utc_system_device_add_callback_n_1(void); @@ -99,6 +101,8 @@ extern int utc_system_device_ir_is_available_n(void); extern int utc_system_device_ir_transmit_p(void); extern int utc_system_device_ir_transmit_n_1(void); extern int utc_system_device_ir_transmit_n_2(void); +extern int utc_system_device_thermal_get_temperature_p(void); +extern int utc_system_device_thermal_get_temperature_n(void); testcase tc_array[] = { {"utc_system_device_add_callback_p",utc_system_device_add_callback_p,NULL,NULL}, @@ -173,6 +177,8 @@ testcase tc_array[] = { {"utc_system_device_ir_transmit_p",utc_system_device_ir_transmit_p,utc_system_device_ir_startup,NULL}, {"utc_system_device_ir_transmit_n_1",utc_system_device_ir_transmit_n_1,utc_system_device_ir_startup,NULL}, {"utc_system_device_ir_transmit_n_2",utc_system_device_ir_transmit_n_2,utc_system_device_ir_startup,NULL}, + {"utc_system_device_thermal_get_temperature_p",utc_system_device_thermal_get_temperature_p,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup}, + {"utc_system_device_thermal_get_temperature_n",utc_system_device_thermal_get_temperature_n,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup}, {NULL, NULL} }; diff --git a/src/utc/device/tct-device-core_tizeniot.h b/src/utc/device/tct-device-core_tizeniot.h index 257d1bce3..d7c3bb950 100755 --- a/src/utc/device/tct-device-core_tizeniot.h +++ b/src/utc/device/tct-device-core_tizeniot.h @@ -26,6 +26,8 @@ extern void utc_system_haptic_cleanup(void); extern void utc_system_device_ir_startup(void); extern void utc_system_device_battery_startup(void); extern void utc_system_device_battery_cleanup(void); +extern void utc_system_device_thermal_startup(void); +extern void utc_system_device_thermal_cleanup(void); extern int utc_system_device_add_callback_p(void); extern int utc_system_device_add_callback_n_1(void); @@ -99,6 +101,8 @@ extern int utc_system_device_ir_is_available_n(void); extern int utc_system_device_ir_transmit_p(void); extern int utc_system_device_ir_transmit_n_1(void); extern int utc_system_device_ir_transmit_n_2(void); +extern int utc_system_device_thermal_get_temperature_p(void); +extern int utc_system_device_thermal_get_temperature_n(void); testcase tc_array[] = { {"utc_system_device_add_callback_p",utc_system_device_add_callback_p,NULL,NULL}, @@ -173,6 +177,8 @@ testcase tc_array[] = { {"utc_system_device_ir_transmit_p",utc_system_device_ir_transmit_p,utc_system_device_ir_startup,NULL}, {"utc_system_device_ir_transmit_n_1",utc_system_device_ir_transmit_n_1,utc_system_device_ir_startup,NULL}, {"utc_system_device_ir_transmit_n_2",utc_system_device_ir_transmit_n_2,utc_system_device_ir_startup,NULL}, + {"utc_system_device_thermal_get_temperature_p",utc_system_device_thermal_get_temperature_p,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup}, + {"utc_system_device_thermal_get_temperature_n",utc_system_device_thermal_get_temperature_n,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup}, {NULL, NULL} }; diff --git a/src/utc/device/tct-device-core_wearable.h b/src/utc/device/tct-device-core_wearable.h index 257d1bce3..d7c3bb950 100755 --- a/src/utc/device/tct-device-core_wearable.h +++ b/src/utc/device/tct-device-core_wearable.h @@ -26,6 +26,8 @@ extern void utc_system_haptic_cleanup(void); extern void utc_system_device_ir_startup(void); extern void utc_system_device_battery_startup(void); extern void utc_system_device_battery_cleanup(void); +extern void utc_system_device_thermal_startup(void); +extern void utc_system_device_thermal_cleanup(void); extern int utc_system_device_add_callback_p(void); extern int utc_system_device_add_callback_n_1(void); @@ -99,6 +101,8 @@ extern int utc_system_device_ir_is_available_n(void); extern int utc_system_device_ir_transmit_p(void); extern int utc_system_device_ir_transmit_n_1(void); extern int utc_system_device_ir_transmit_n_2(void); +extern int utc_system_device_thermal_get_temperature_p(void); +extern int utc_system_device_thermal_get_temperature_n(void); testcase tc_array[] = { {"utc_system_device_add_callback_p",utc_system_device_add_callback_p,NULL,NULL}, @@ -173,6 +177,8 @@ testcase tc_array[] = { {"utc_system_device_ir_transmit_p",utc_system_device_ir_transmit_p,utc_system_device_ir_startup,NULL}, {"utc_system_device_ir_transmit_n_1",utc_system_device_ir_transmit_n_1,utc_system_device_ir_startup,NULL}, {"utc_system_device_ir_transmit_n_2",utc_system_device_ir_transmit_n_2,utc_system_device_ir_startup,NULL}, + {"utc_system_device_thermal_get_temperature_p",utc_system_device_thermal_get_temperature_p,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup}, + {"utc_system_device_thermal_get_temperature_n",utc_system_device_thermal_get_temperature_n,utc_system_device_thermal_startup,utc_system_device_thermal_cleanup}, {NULL, NULL} }; diff --git a/src/utc/device/utc-system-device-thermal.c b/src/utc/device/utc-system-device-thermal.c new file mode 100644 index 000000000..7f208a830 --- /dev/null +++ b/src/utc/device/utc-system-device-thermal.c @@ -0,0 +1,104 @@ +// +// Copyright (c) 2019 Samsung Electronics Co., Ltd. +// +// Licensed under the Apache License, Version 2.0 (the License); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +#include "assert.h" +#include + +//& set: DeviceTemperature +#define THERMAL_AP_FEATURE "http://tizen.org/feature/thermistor.AP" +#define THERMAL_CP_FEATURE "http://tizen.org/feature/thermistor.CP" +#define THERMAL_BATTERY_FEATURE "http://tizen.org/feature/thermistor.Battery" + +static bool ap_supported; +static bool cp_supported; +static bool battery_supported; + + +/** + * @testcase utc_system_device_temperature_startup + * @since_tizen 5.5 + * @description Called before each test + */ +void utc_system_device_thermal_startup(void) +{ + int ret; + + ret = system_info_get_platform_bool(THERMAL_AP_FEATURE, &ap_supported); + ret = system_info_get_platform_bool(THERMAL_CP_FEATURE, &cp_supported); + ret = system_info_get_platform_bool(THERMAL_BATTERY_FEATURE, &battery_supported); + + return; +} + +/** + * @testcase utc_system_device_temperature_cleanup + * @since_tizen 5.5 + * @description Called before each test + */ +void utc_system_device_thermal_cleanup(void) +{ + + return; +} + +/** + * @testcase utc_system_device_thermal_get_temperature_p + * @since_tizen 5.5 + * @description Positive test case of utc_system_device_thermal_get_temperature. + */ +int utc_system_device_thermal_get_temperature_p(void) +{ + int value; + int error; + + if(!ap_supported && !cp_supported && !battery_supported) + return 0; + + if (ap_supported) { + error = device_thermal_get_temperature(DEVICE_THERMAL_AP, &value); + assert_eq(error, DEVICE_ERROR_NONE); + } + + if (cp_supported) { + error = device_thermal_get_temperature(DEVICE_THERMAL_CP, &value); + assert_eq(error, DEVICE_ERROR_NONE); + } + + if (battery_supported) { + error = device_thermal_get_temperature(DEVICE_THERMAL_BATTERY, &value); + assert_eq(error, DEVICE_ERROR_NONE); + } + + return 0; +} + +/** + * @testcase utc_system_device_thermal_get_temperature_n + * @since_tizen 5.5 + * @description Negative test case of utc_system_device_thermal_get_temperature. + */ +int utc_system_device_thermal_get_temperature_n(void) +{ + int value; + int error; + + if(!ap_supported && !cp_supported && !battery_supported) + return 0; + + error = device_thermal_get_temperature(1000, &value); + assert_eq(error, DEVICE_ERROR_INVALID_PARAMETER); + + return 0; +}