diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-10-26 14:28:53 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-10-26 15:14:47 +1000 |
commit | 106e2b714927e3b77ecada10fc8b44edd5447e14 (patch) | |
tree | ba16e55c5ed410f97882c4e96028aac39fe408db | |
parent | 641895b90bc7c58e8551d82ef2a41bbf455a910e (diff) |
input/legacy-drivers: aiptek tests can be parameter-based
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | tests/input/legacy-drivers.cpp | 90 |
1 files changed, 17 insertions, 73 deletions
diff --git a/tests/input/legacy-drivers.cpp b/tests/input/legacy-drivers.cpp index 0ab12f3..5e04ed6 100644 --- a/tests/input/legacy-drivers.cpp +++ b/tests/input/legacy-drivers.cpp @@ -135,53 +135,25 @@ TEST(AcecadDriverTest, InputDeviceSectionWithOptionDevice) * * ***********************************************************************/ -TEST(AiptekDriverTest, InputDeviceSectionWithTypeStylus) -{ - XOrgConfig config; - xorg::testing::XServer server; - - config.AddInputSection("aiptek", "--device--", - "Option \"CorePointer\" \"on\"\n" - "Option \"Device\" \"/dev/input/event0\"\n" - "Option \"Type\" \"stylus\""); - config.AddDefaultScreenWithDriver(); - StartServer("aiptek-type-stylus", server, config); - - ::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str()); - int major = 2; - int minor = 0; - ASSERT_EQ(Success, XIQueryVersion(dpy, &major, &minor)); - - /* VCP, VCK, xtest, mouse, keyboard, aiptek */ - int expected_devices = 7; - - /* xserver git 1357cd7251, no <default pointer> */ - if (server.GetVersion().compare("1.11.0") > 0) - expected_devices--; +class AiptekDriverTest : public InputDriverTest, + public ::testing::WithParamInterface<std::string> { + virtual void SetUpConfigAndLog() { + InitDefaultLogFiles(server, &config); - ASSERT_EQ(count_devices(dpy), expected_devices); - ASSERT_EQ(FindInputDeviceByName(dpy, "--device--"), 1); + std::string type = GetParam(); - config.RemoveConfig(); - server.RemoveLogFile(); -} + config.AddInputSection("aiptek", "--device--", + "Option \"CorePointer\" \"on\"\n" + "Option \"Device\" \"/dev/input/event0\"\n" + "Option \"Type\" \"" + type + "\""); + config.AddDefaultScreenWithDriver(); + config.WriteConfig(); + } +}; -TEST(AiptekDriverTest, InputDeviceSectionWithTypeCursor) +TEST_P(AiptekDriverTest, InputDeviceSectionWithType) { - XOrgConfig config; - xorg::testing::XServer server; - - config.AddInputSection("aiptek", "--device--", - "Option \"CorePointer\" \"on\"\n" - "Option \"Device\" \"/dev/input/event0\"\n" - "Option \"Type\" \"cursor\""); - config.AddDefaultScreenWithDriver(); - StartServer("aiptek-type-cursor", server, config); - - ::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str()); - int major = 2; - int minor = 0; - ASSERT_EQ(Success, XIQueryVersion(dpy, &major, &minor)); + ::Display *dpy = Display(); /* VCP, VCK, xtest, mouse, keyboard, aiptek */ int expected_devices = 7; @@ -197,36 +169,8 @@ TEST(AiptekDriverTest, InputDeviceSectionWithTypeCursor) server.RemoveLogFile(); } -TEST(AiptekDriverTest, InputDeviceSectionWithTypeEraser) -{ - XOrgConfig config; - xorg::testing::XServer server; - - config.AddInputSection("aiptek", "--device--", - "Option \"CorePointer\" \"on\"\n" - "Option \"Device\" \"/dev/input/event0\"\n" - "Option \"Type\" \"eraser\""); - config.AddDefaultScreenWithDriver(); - StartServer("aiptek-type-eraser", server, config); - - ::Display *dpy = XOpenDisplay(server.GetDisplayString().c_str()); - int major = 2; - int minor = 0; - ASSERT_EQ(Success, XIQueryVersion(dpy, &major, &minor)); - - /* VCP, VCK, xtest, mouse, keyboard, aiptek */ - int expected_devices = 7; - - /* xserver git 1357cd7251, no <default pointer> */ - if (server.GetVersion().compare("1.11.0") > 0) - expected_devices--; - - ASSERT_EQ(count_devices(dpy), expected_devices); - ASSERT_EQ(FindInputDeviceByName(dpy, "--device--"), 1); - - config.RemoveConfig(); - server.RemoveLogFile(); -} +INSTANTIATE_TEST_CASE_P(, AiptekDriverTest, + ::testing::Values("stylus", "cursor", "eraser")); /*********************************************************************** * * |