diff options
Diffstat (limited to 'unittest/gtest_hal_display.cpp')
-rwxr-xr-x | unittest/gtest_hal_display.cpp | 215 |
1 files changed, 0 insertions, 215 deletions
diff --git a/unittest/gtest_hal_display.cpp b/unittest/gtest_hal_display.cpp deleted file mode 100755 index bb21cb2..0000000 --- a/unittest/gtest_hal_display.cpp +++ /dev/null @@ -1,215 +0,0 @@ - -#include <iostream> -#include <gtest/gtest.h> -#include "hw/display.h" - -using namespace std; - -/* - * main class - */ - -#define LOWBATTERY "LowBattery" - -struct hw_info *info; -struct display_device *display_dev; - -class DISPLAYHalTest : public testing::Test -{ - public: - virtual void SetUp() - { - - } - - virtual void TearDown() - { - - } -}; - -/* - * testcase - */ -TEST_F(DISPLAYHalTest, InitP) -{ - int ret; - - ret = hw_get_info(DISPLAY_HARDWARE_DEVICE_ID, - (const struct hw_info **)&info); - if (ret < 0) { - cout << "There is no device for display" << ret << endl; - return; - } else { - EXPECT_EQ(ret, 0) << "Fail to load display hal (" << ret << ")"; - } - - if (!info || !info->open) { - cout << "There is no function for info open" << endl; - return; - } - ret = info->open(info, NULL, (struct hw_common**)&display_dev); - EXPECT_EQ(ret, 0) << "Fail to open display device (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, GetMaxBrightnessP) -{ - int ret; - int max; - - if (!display_dev || !display_dev->get_max_brightness) { - cout << "There is no function for get_max_brightness" << endl; - return; - } - ret = display_dev->get_max_brightness(&max); - EXPECT_EQ(ret, 0) << "Fail to get_max_brightness (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, GetBrightnessP) -{ - int ret; - int brt; - - if (!display_dev || !display_dev->get_brightness) { - cout << "There is no function for get_brightness" << endl; - return; - } - ret = display_dev->get_brightness(&brt); - EXPECT_EQ(ret, 0) << "Fail to get_brightness (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, SetBrightnessP) -{ - int ret; - int max; - - if (!display_dev || !display_dev->get_max_brightness) { - cout << "There is no function for get_max_brightness" << endl; - return; - } - ret = display_dev->get_max_brightness(&max); - EXPECT_EQ(ret, 0) << "Fail to get_max_brightness (" << ret << ")"; - - if (!display_dev || !display_dev->set_brightness) { - cout << "There is no function for set_brightness" << endl; - return; - } - ret = display_dev->set_brightness(max); - EXPECT_EQ(ret, 0) << "Fail to set_brightness (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, GetAutoBrightnessP) -{ - int ret; - int brt; - float lmax = 0, lmin = 0, light = 0; - - if (!display_dev || !display_dev->get_auto_brightness) { - cout << "There is no function for get_auto_brightness" << endl; - return; - } - ret = display_dev->get_auto_brightness(lmax, lmin, light, &brt); - EXPECT_GE(ret, 0) << "Fail to set_brightness (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, GetStateP) -{ - int ret; - enum display_state state; - - if (!display_dev || !display_dev->get_state) { - cout << "There is no function for get_state" << endl; - return; - } - ret = display_dev->get_state(&state); - EXPECT_GE(ret, 0) << "Fail to get_state (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, SetStateP) -{ - int ret; - - if (!display_dev || !display_dev->set_state) { - cout << "There is no function for set_state" << endl; - return; - } - ret = display_dev->set_state(DISPLAY_ON); - EXPECT_GE(ret, 0) << "Fail to set_state (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, GetMaxFrameRateP) -{ - int ret; - int max; - - if (!display_dev || !display_dev->get_max_frame_rate) { - cout << "There is no function for get_max_frame_rate" << endl; - return; - } - ret = display_dev->get_max_frame_rate(&max); - EXPECT_GE(ret, 0) << "Fail to get_max_frame_rate (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, GetMinFrameRateP) -{ - int ret; - int min; - - if (!display_dev || !display_dev->get_min_frame_rate) { - cout << "There is no function for get_min_frame_rate" << endl; - return; - } - ret = display_dev->get_min_frame_rate(&min); - EXPECT_GE(ret, 0) << "Fail to get_min_frame_rate (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, GetFrameRateP) -{ - int ret, rate; - - if (!display_dev || !display_dev->get_frame_rate) { - cout << "There is no function for get_frame_rate" << endl; - return; - } - ret = display_dev->get_frame_rate(&rate); - EXPECT_GE(ret, 0) << "Fail to get frame rate (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, SetFrameRateP) -{ - int ret; - int max; - - if (!display_dev || !display_dev->get_max_frame_rate) { - cout << "There is no function for get_max_frame_rate" << endl; - return; - } - ret = display_dev->get_max_frame_rate(&max); - EXPECT_GE(ret, 0) << "Fail to get_max_frame_rate (" << ret << ")"; - - if (!display_dev->set_frame_rate) { - cout << "There is no function for set_frame_rate" << endl; - return; - } - ret = display_dev->set_frame_rate(max); - EXPECT_GE(ret, 0) << "Fail to set_frame_rate (" << ret << ")"; -} - -TEST_F(DISPLAYHalTest, DeinitP) -{ - int ret; - - if (!info || !info->close) { - cout << "There is no function for info close" << endl; - return; - } - ret = info->close((struct hw_common *)display_dev); - EXPECT_GE(ret, 0) << "Fail to close display device (" << ret << ")"; -} - -int main(int argc, char **argv) -{ - testing::InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -} |