From: dyamy-lee Date: Wed, 21 Apr 2021 06:44:40 +0000 (+0900) Subject: Add SetUp/TearDown in libinput haltests X-Git-Tag: accepted/tizen/unified/20230227.152727~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e6f91d1276bbfc528040d8f2866f0c4c265f1a87;p=platform%2Fupstream%2Flibinput.git Add SetUp/TearDown in libinput haltests Every test creates libinput and udev, and removes them. So, executing common logic as using SetUp/TearDown. Change-Id: I445db460c282a6f929ac8db5a70c0aa67302f32a --- diff --git a/haltests/test_hal_libinput.cpp b/haltests/test_hal_libinput.cpp index 487ef878..bfbc237e 100644 --- a/haltests/test_hal_libinput.cpp +++ b/haltests/test_hal_libinput.cpp @@ -21,24 +21,26 @@ static const struct libinput_interface simple_interface = { .close_restricted = close_restricted, }; -TEST_F(LibInputHalTest, UdevCreateTest) +void LibInputHalTest::SetUp(void) { - struct libinput *li; - struct udev *udev_context; - udev_context = udev_new(); - EXPECT_TRUE(udev_context != NULL); - li = libinput_udev_create_context(&simple_interface, NULL, udev_context); - EXPECT_TRUE(li != NULL); - libinput_udev_assign_seat(li, "seat0"); - EXPECT_TRUE(li != NULL); +} +void LibInputHalTest::TearDown(void) +{ libinput_unref(li); udev_unref(udev_context); } +TEST_F(LibInputHalTest, UdevCreateTest) +{ + EXPECT_TRUE(udev_context != NULL); + EXPECT_TRUE(li != NULL); + EXPECT_TRUE(true); +} + TEST_F(LibInputHalTest, GetDeviceListsTest) { EXPECT_TRUE(true); diff --git a/haltests/test_hal_libinput.h b/haltests/test_hal_libinput.h index 3f424b71..7f009841 100644 --- a/haltests/test_hal_libinput.h +++ b/haltests/test_hal_libinput.h @@ -16,6 +16,12 @@ class LibInputHalTest : public ::testing::Test public: LibInputHalTest() {}; virtual ~LibInputHalTest(); + + void SetUp(void); + void TearDown(void); + + struct libinput *li; + struct udev *udev_context; }; #endif // __LIBINPUT_TESTS_H__