-
-#include <iostream>
-#include <gtest/gtest.h>
#include <system_info.h>
+
#include "haltest.h"
#include "hal-display.h"
/* Define Classes */
class DISPLAY : public testing::Test
{
- public:
- virtual void SetUp()
+ protected:
+ void SetUp() override
{
int ret;
- ret = system_info_get_platform_bool(FEATURE_DISPLAY, &supported);
+ ret = system_info_get_platform_bool(FEATURE_DISPLAY, &display_supported);
EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
-
}
- virtual void TearDown()
+ void TearDown() override
{
}
+
+ bool display_supported;
};
+
/*
* Testcase for Display
*/
{
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_backend();
EXPECT_EQ(ret, 0) << "Fail to get display device (" << ret << ")";
int ret;
int max;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_max_brightness(&max);
if (ret == -ENODEV)
int ret;
int brt;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_brightness(&brt);
if (ret == -ENODEV)
int ret;
int max = 100;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_set_brightness(max);
if (ret == -ENODEV)
int ret;
int brt = 50, step = 5, delay = 10000;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_set_multi_brightness(brt, step, delay);
if (ret == -ENODEV)
int brt;
float lmax = 0, lmin = 0, light = 0;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_auto_brightness(lmax, lmin, light, &brt);
if (ret == -ENODEV)
int ret;
enum display_state state;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_state(&state);
if (ret == -ENODEV)
{
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_set_state(DISPLAY_ON);
if (ret == -ENODEV)
enum display_image_effect effect;
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_image_effect(&effect);
if (ret == -ENODEV)
{
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_set_image_effect(DISPLAY_IMAGE_EFFECT_GREY);
if (ret == -ENODEV)
enum display_panel_mode mode;
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_panel_mode(&mode);
if (ret == -ENODEV)
{
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_set_panel_mode(DISPLAY_PANEL_MODE_LOWPOWER);
if (ret == -ENODEV)
enum display_aod_mode mode;
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_aod_mode(&mode);
if (ret == -ENODEV)
int max, normal, min, charging;
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_aod_brightness(&max, &normal, &min, &charging);
if (ret == -ENODEV)
int ret;
int max;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_max_frame_rate(&max);
if (ret == -ENODEV)
int ret;
int min;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_min_frame_rate(&min);
if (ret == -ENODEV)
{
int ret, rate;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_frame_rate(&rate);
if (ret == -ENODEV)
{
int ret, fmax;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_get_max_frame_rate(&fmax);
if (ret == -ENODEV)
{
int ret;
- if (!supported)
+ if (!display_supported) {
+ SKIP_MESSAGE("Display not supported");
return;
+ }
ret = hal_device_display_put_backend();
EXPECT_GE(ret, 0) << "Fail to close display device (" << ret << ")";