summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlokilee73 <changjoo.lee@samsung.com>2019-02-28 11:09:09 (GMT)
committerlokilee73 <changjoo.lee@samsung.com>2019-02-28 11:17:40 (GMT)
commitaa29d5f78ec923d58421952a61e87af862a91b7e (patch)
treeba81e8189fd478a1f777a1e4e52242a69c6a38d1
parent648c70c0d49fc601abf64fb131c66773cda6fd83 (diff)
downloadlibdevice-node-aa29d5f78ec923d58421952a61e87af862a91b7e.zip
libdevice-node-aa29d5f78ec923d58421952a61e87af862a91b7e.tar.gz
libdevice-node-aa29d5f78ec923d58421952a61e87af862a91b7e.tar.bz2
Change-Id: I3a689c679e08401c6d9f5bd5dc2ff66f516671e2 Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
-rw-r--r--unittest/device_haltests.cpp86
1 files changed, 82 insertions, 4 deletions
diff --git a/unittest/device_haltests.cpp b/unittest/device_haltests.cpp
index c654c9d..ee84de6 100644
--- a/unittest/device_haltests.cpp
+++ b/unittest/device_haltests.cpp
@@ -14,6 +14,7 @@
#include "hw/usb_client.h"
#include "hw/usb_gadget.h"
#include "hw/bezel.h"
+#include "hw/touchsensitivity.h"
using namespace std;
@@ -37,6 +38,8 @@ struct usb_gadget *gadget_dev;
struct usb_gadget_id gadget_id;
struct usb_gadget_translator *gadget_translator;
struct bezel_device *bezel_dev;
+struct touchsensitivity_device *touchsensitivity_dev;
+
/* Define Classes */
class BATTERYHalTest : public testing::Test
@@ -164,6 +167,20 @@ class TOUCHSCREENHalTest : public testing::Test
}
};
+class TOUCHSENSITIVITYHalTest : public testing::Test
+{
+ public:
+ virtual void SetUp()
+ {
+
+ }
+
+ virtual void TearDown()
+ {
+
+ }
+};
+
class BEZELHalTest : public testing::Test
{
public:
@@ -871,7 +888,7 @@ TEST_F(TOUCHSCREENHalTest, InitP)
EXPECT_EQ(ret, 0) << "Fail to open touchscreen device (" << ret << ")";
}
-TEST_F(TOUCHSCREENHalTest, SetstateP)
+TEST_F(TOUCHSCREENHalTest, SetStateP)
{
enum touchscreen_state state = TOUCHSCREEN_ON;
int ret;
@@ -897,6 +914,67 @@ TEST_F(TOUCHSCREENHalTest, DeinitP)
}
/*
+ * Testcase for Touchsensitivity
+ */
+TEST_F(TOUCHSENSITIVITYHalTest, InitP)
+{
+ int ret;
+
+ info = NULL;
+ ret = hw_get_info(TOUCHSENSITIVITY_HARDWARE_DEVICE_ID,
+ (const struct hw_info **)&info);
+ if (ret < 0) {
+ cout << "There is no device for touchsensitivity " << ret << endl;
+ return;
+ } else {
+ EXPECT_EQ(ret, 0) << "Fail to get hal for touchsensitivity (" << ret << ")";
+ }
+
+ if (!info || !info->open) {
+ cout << "There is no function for info open" << endl;
+ return;
+ }
+ ret = info->open(info, NULL, (struct hw_common**)&touchsensitivity_dev);
+ EXPECT_EQ(ret, 0) << "Fail to open touchsensitivity device (" << ret << ")";
+}
+
+TEST_F(TOUCHSENSITIVITYHalTest, GetStateP)
+{
+ int ret, state;
+
+ if (!touchsensitivity_dev || !touchsensitivity_dev->glove_mode_get_state) {
+ cout << "There is no function for glove_mode_get_state" << endl;
+ return;
+ }
+ ret = touchsensitivity_dev->glove_mode_get_state(&state);
+ EXPECT_EQ(ret, 0) << "Fail to get glove state (" << ret << ")";
+}
+
+TEST_F(TOUCHSENSITIVITYHalTest, SetStateP)
+{
+ int ret, state = TOUCHSENSITIVITY_GLOVE_MODE_ON;
+
+ if (!touchsensitivity_dev || !touchsensitivity_dev->glove_mode_set_state) {
+ cout << "There is no function for glove_mode_set_state" << endl;
+ return;
+ }
+ ret = touchsensitivity_dev->glove_mode_set_state(state);
+ EXPECT_EQ(ret, 0) << "Fail to set glove mode (" << ret << ")";
+}
+
+TEST_F(TOUCHSENSITIVITYHalTest, DeinitP)
+{
+ int ret;
+
+ if (!info || !info->close) {
+ cout << "There is no function for info close" << endl;
+ return;
+ }
+ ret = info->close((struct hw_common *)touchsensitivity_dev);
+ EXPECT_EQ(ret, 0) << "Fail to close touchscreen device (" << ret << ")";
+}
+
+/*
* Testcase for Bezel
*/
TEST_F(BEZELHalTest, InitP)
@@ -913,7 +991,7 @@ TEST_F(BEZELHalTest, InitP)
cout << "There is no device for bezel" << ret << endl;
return;
} else {
- EXPECT_EQ(ret, 0) << "Fail to get hal for thermal (" << ret << ")";
+ EXPECT_EQ(ret, 0) << "Fail to get hal for bezel (" << ret << ")";
}
if (!info || !info->open) {
@@ -924,7 +1002,7 @@ TEST_F(BEZELHalTest, InitP)
EXPECT_EQ(ret, 0) << "Fail to open bezel device (" << ret << ")";
}
-TEST_F(BEZELHalTest, GetstateP)
+TEST_F(BEZELHalTest, GetStateP)
{
enum bezel_state state;
int ret;
@@ -940,7 +1018,7 @@ TEST_F(BEZELHalTest, GetstateP)
EXPECT_EQ(ret, 0) << "Fail to get_state (" << ret << ")";
}
-TEST_F(BEZELHalTest, SetstateP)
+TEST_F(BEZELHalTest, SetStateP)
{
enum bezel_state state = BEZEL_TURNON;
int ret;