summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlokilee73 <changjoo.lee@samsung.com>2019-02-27 07:11:37 (GMT)
committerlokilee73 <changjoo.lee@samsung.com>2019-02-27 07:12:13 (GMT)
commit648c70c0d49fc601abf64fb131c66773cda6fd83 (patch)
treedae262c68ff5d70e66e8b2fbf9fe927e31e94b9c
parent271c35ba999bd2909d1a352ed6ef9ae54745e377 (diff)
downloadlibdevice-node-648c70c0d49fc601abf64fb131c66773cda6fd83.zip
libdevice-node-648c70c0d49fc601abf64fb131c66773cda6fd83.tar.gz
libdevice-node-648c70c0d49fc601abf64fb131c66773cda6fd83.tar.bz2
Add HAL test for bezelrefs/changes/95/200595/1
Change-Id: I7117b333ae3c17d71d2c0f8197a68ebee0025426 Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
-rw-r--r--unittest/device_haltests.cpp94
-rw-r--r--unittest/unittest.h2
2 files changed, 96 insertions, 0 deletions
diff --git a/unittest/device_haltests.cpp b/unittest/device_haltests.cpp
index 3927d72..c654c9d 100644
--- a/unittest/device_haltests.cpp
+++ b/unittest/device_haltests.cpp
@@ -13,6 +13,7 @@
#include "hw/touchscreen.h"
#include "hw/usb_client.h"
#include "hw/usb_gadget.h"
+#include "hw/bezel.h"
using namespace std;
@@ -35,6 +36,7 @@ struct usb_client *client_dev;
struct usb_gadget *gadget_dev;
struct usb_gadget_id gadget_id;
struct usb_gadget_translator *gadget_translator;
+struct bezel_device *bezel_dev;
/* Define Classes */
class BATTERYHalTest : public testing::Test
@@ -162,6 +164,23 @@ class TOUCHSCREENHalTest : public testing::Test
}
};
+class BEZELHalTest : public testing::Test
+{
+ public:
+ virtual void SetUp()
+ {
+ int ret;
+
+ ret = system_info_get_platform_bool(FEATURE_BEZEL, &supported);
+ EXPECT_EQ(SYSTEM_INFO_ERROR_NONE, ret) << "system_info_get_platform_bool failed";
+ }
+
+ virtual void TearDown()
+ {
+
+ }
+};
+
class USBCLIENTHalTest : public testing::Test
{
public:
@@ -878,6 +897,81 @@ TEST_F(TOUCHSCREENHalTest, DeinitP)
}
/*
+ * Testcase for Bezel
+ */
+TEST_F(BEZELHalTest, InitP)
+{
+ int ret;
+
+ if (!supported)
+ return;
+
+ info = NULL;
+ ret = hw_get_info(BEZEL_HARDWARE_DEVICE_ID,
+ (const struct hw_info **)&info);
+ if (ret < 0) {
+ cout << "There is no device for bezel" << ret << endl;
+ return;
+ } else {
+ EXPECT_EQ(ret, 0) << "Fail to get hal for thermal (" << ret << ")";
+ }
+
+ if (!info || !info->open) {
+ cout << "There is no function for info open" << endl;
+ return;
+ }
+ ret = info->open(info, NULL, (struct hw_common**)&bezel_dev);
+ EXPECT_EQ(ret, 0) << "Fail to open bezel device (" << ret << ")";
+}
+
+TEST_F(BEZELHalTest, GetstateP)
+{
+ enum bezel_state state;
+ int ret;
+
+ if (!supported)
+ return;
+
+ if (!bezel_dev || !bezel_dev->get_state) {
+ cout << "There is no function for get_info" << endl;
+ return;
+ }
+ ret = bezel_dev->get_state(&state);
+ EXPECT_EQ(ret, 0) << "Fail to get_state (" << ret << ")";
+}
+
+TEST_F(BEZELHalTest, SetstateP)
+{
+ enum bezel_state state = BEZEL_TURNON;
+ int ret;
+
+ if (!supported)
+ return;
+
+ if (!bezel_dev || !bezel_dev->set_state) {
+ cout << "There is no function for set_state" << endl;
+ return;
+ }
+ ret = bezel_dev->set_state(state);
+ EXPECT_EQ(ret, 0) << "Fail to get_state (" << ret << ")";
+}
+
+TEST_F(BEZELHalTest, DeinitP)
+{
+ int ret;
+
+ if (!supported)
+ return;
+
+ if (!info || !info->close) {
+ cout << "There is no function for info close" << endl;
+ return;
+ }
+ ret = info->close((struct hw_common *)bezel_dev);
+ EXPECT_EQ(ret, 0) << "Fail to close bezel device (" << ret << ")";
+}
+
+/*
* Testcase for Client
*/
TEST_F(USBCLIENTHalTest, InitP)
diff --git a/unittest/unittest.h b/unittest/unittest.h
index 9a2400b..1e31818 100644
--- a/unittest/unittest.h
+++ b/unittest/unittest.h
@@ -26,6 +26,8 @@ extern "C" {
#define FEATURE_LED "http://tizen.org/feature/led"
#define FEATURE_IR "http://tizen.org/feature/consumer_ir"
#define FEATURE_THERMISTOR "http://tizen.org/feature/thermistor.ap"
+#define FEATURE_BEZEL "http://tizen.org/feature/input.rotating_bezel"
+
bool supported;