Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net> --- test/integration/xorg-conf-input-tests.cpp | 71 ++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
diff --git a/test/integration/xorg-conf-input-tests.cpp b/test/integration/xorg-conf-input-tests.cpp index 1a9871e..76512ca 100644 --- a/test/integration/xorg-conf-input-tests.cpp +++ b/test/integration/xorg-conf-input-tests.cpp @@ -109,3 +109,74 @@ TEST_F(XOrgConfigInputTest, DefaultDevices) XIFreeDeviceInfo(info); } + + +class XOrgConfigInputDriverTest : public XOrgConfigInputTest, + public ::testing::WithParamInterface<const char*> { + void AddDriverSection(const char *param) { + std::ofstream conffile(config_file.c_str(), std::ios_base::app); + conffile.exceptions(std::ofstream::failbit | std::ofstream::badbit); + + std::string driver(param); + + conffile << "" +" Section \"InputDevice\"" +" Identifier \"--device--\"" +" Driver \"" << driver << "\"" +" EndSection"; + server.SetOption("-config", config_file); + } + + virtual void SetUp() + { + const char *param = GetParam(); + + WriteConfig(param); + AddDriverSection(param); + StartServer(); + } +}; + +/** + * AutoAddDevices is off, InputDevice sections are present but unreferenced, + * with those drivers that are elevated to core device status if found. + */ +TEST_P(XOrgConfigInputDriverTest, DriverDevice) +{ + const char *param; + int ndevices; + XIDeviceInfo *info; + + param = GetParam(); + info = XIQueryDevice(Display(), XIAllDevices, &ndevices); + /* VCP, VCK, 2 test devices, forced mouse/keyboard */ + ASSERT_EQ(ndevices, 6) << "Drivers required for this test: mouse, " + "keyboard, " << param; + + bool found = false; + while(ndevices--) { + if (strcmp(info[ndevices].name, "--device--") == 0) { + ASSERT_EQ(found, false) << "Duplicate device" << std::endl; + found = true; + } + } + + ASSERT_EQ(found, true); + + XIFreeDeviceInfo(info); +} + +int main(int argc, char **argv) { + + testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} + +/* mouse, keyboard, void, evdev, synaptics and vmmouse have special status, + they are picked as core devices if AAD is off and any section is found + in the xorg.conf. + mouse, keyboard and void auto-pick their device + */ +INSTANTIATE_TEST_CASE_P(, XOrgConfigInputDriverTest, + ::testing::Values("mouse", "keyboard", "void")); -- 1.7.10.4 _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel