summaryrefslogtreecommitdiff
path: root/unittest/device_haltests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/device_haltests.cpp')
-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;