1 #include <system_info.h>
4 #include "hal-display.h"
9 class DISPLAY : public testing::Test
16 ret = system_info_get_platform_bool(FEATURE_DISPLAY, &display_supported);
17 EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
20 void TearDown() override
25 bool display_supported;
30 * Testcase for Display
32 TEST_F(DISPLAY, GetBackendP)
36 if (!display_supported) {
37 SKIP_MESSAGE("Display not supported");
41 ret = hal_device_display_get_backend();
42 EXPECT_EQ(ret, 0) << "Fail to get display device (" << ret << ")";
45 TEST_F(DISPLAY, GetMaxBrightnessP)
50 if (!display_supported) {
51 SKIP_MESSAGE("Display not supported");
55 ret = hal_device_display_get_max_brightness(&max);
59 EXPECT_EQ(ret, 0) << "Fail to get max brightness (" << ret << ")";
62 TEST_F(DISPLAY, GetBrightnessP)
67 if (!display_supported) {
68 SKIP_MESSAGE("Display not supported");
72 ret = hal_device_display_get_brightness(&brt);
76 EXPECT_EQ(ret, 0) << "Fail to get brightness (" << ret << ")";
79 TEST_F(DISPLAY, SetBrightnessP)
84 if (!display_supported) {
85 SKIP_MESSAGE("Display not supported");
89 ret = hal_device_display_set_brightness(max);
93 EXPECT_EQ(ret, 0) << "Fail to set_brightness (" << ret << ")";
96 TEST_F(DISPLAY, SetMultiBrightnessP)
99 int brt = 50, step = 5, delay = 10000;
101 if (!display_supported) {
102 SKIP_MESSAGE("Display not supported");
106 ret = hal_device_display_set_multi_brightness(brt, step, delay);
110 EXPECT_EQ(ret, 0) << "Fail to set multi brightness (" << ret << ")";
113 TEST_F(DISPLAY, GetAutoBrightnessP)
117 float lmax = 0, lmin = 0, light = 0;
119 if (!display_supported) {
120 SKIP_MESSAGE("Display not supported");
124 ret = hal_device_display_get_auto_brightness(lmax, lmin, light, &brt);
128 EXPECT_EQ(ret, 0) << "Fail to get auto brightness (" << ret << ")";
131 TEST_F(DISPLAY, GetStateP)
134 enum display_state state;
136 if (!display_supported) {
137 SKIP_MESSAGE("Display not supported");
141 ret = hal_device_display_get_state(&state);
145 EXPECT_EQ(ret, 0) << "Fail to get state (" << ret << ")";
148 TEST_F(DISPLAY, SetStateP)
152 if (!display_supported) {
153 SKIP_MESSAGE("Display not supported");
157 ret = hal_device_display_set_state(DISPLAY_ON);
161 EXPECT_EQ(ret, 0) << "Fail to set state (" << ret << ")";
164 TEST_F(DISPLAY, GetImageEffectP)
166 enum display_image_effect effect;
169 if (!display_supported) {
170 SKIP_MESSAGE("Display not supported");
174 ret = hal_device_display_get_image_effect(&effect);
178 EXPECT_EQ(ret, 0) << "Fail to get image effect (" << ret << ")";
181 TEST_F(DISPLAY, SetImageEffectP)
185 if (!display_supported) {
186 SKIP_MESSAGE("Display not supported");
190 ret = hal_device_display_set_image_effect(DISPLAY_IMAGE_EFFECT_GREY);
194 EXPECT_EQ(ret, 0) << "Fail to set image effect (" << ret << ")";
197 TEST_F(DISPLAY, GetPanelModeP)
199 enum display_panel_mode mode;
202 if (!display_supported) {
203 SKIP_MESSAGE("Display not supported");
207 ret = hal_device_display_get_panel_mode(&mode);
211 EXPECT_EQ(ret, 0) << "Fail to get panel mode (" << ret << ")";
214 TEST_F(DISPLAY, SetPanelModeP)
218 if (!display_supported) {
219 SKIP_MESSAGE("Display not supported");
223 ret = hal_device_display_set_panel_mode(DISPLAY_PANEL_MODE_LOWPOWER);
227 EXPECT_EQ(ret, 0) << "Fail to set panel mode (" << ret << ")";
230 TEST_F(DISPLAY, GetAodModeP)
232 enum display_aod_mode mode;
235 if (!display_supported) {
236 SKIP_MESSAGE("Display not supported");
240 ret = hal_device_display_get_aod_mode(&mode);
244 EXPECT_EQ(ret, 0) << "Fail to get aod mode (" << ret << ")";
247 TEST_F(DISPLAY, GetAodBrightnessP)
249 int max, normal, min, charging;
252 if (!display_supported) {
253 SKIP_MESSAGE("Display not supported");
257 ret = hal_device_display_get_aod_brightness(&max, &normal, &min, &charging);
261 EXPECT_EQ(ret, 0) << "Fail to get aod brightness (" << ret << ")";
265 TEST_F(DISPLAY, GetMaxFrameRateP)
270 if (!display_supported) {
271 SKIP_MESSAGE("Display not supported");
275 ret = hal_device_display_get_max_frame_rate(&max);
279 EXPECT_GE(ret, 0) << "Fail to get max frame_rate (" << ret << ")";
282 TEST_F(DISPLAY, GetMinFrameRateP)
287 if (!display_supported) {
288 SKIP_MESSAGE("Display not supported");
292 ret = hal_device_display_get_min_frame_rate(&min);
296 EXPECT_GE(ret, 0) << "Fail to get min frame rate (" << ret << ")";
299 TEST_F(DISPLAY, GetFrameRateP)
303 if (!display_supported) {
304 SKIP_MESSAGE("Display not supported");
308 ret = hal_device_display_get_frame_rate(&rate);
312 EXPECT_GE(ret, 0) << "Fail to get frame rate (" << ret << ")";
315 TEST_F(DISPLAY, SetFrameRateP)
319 if (!display_supported) {
320 SKIP_MESSAGE("Display not supported");
324 ret = hal_device_display_get_max_frame_rate(&fmax);
328 EXPECT_GE(ret, 0) << "Fail to get max frame rate (" << ret << ")";
330 ret = hal_device_display_set_frame_rate(fmax);
334 EXPECT_GE(ret, 0) << "Fail to set frame rate (" << ret << ")";