[PATCH 09/10] test/integration: Add default mouse/keyboard driver behaviour
Peter Hutterer
peter.hutterer at who-t.net
Mon Jul 2 23:59:26 PDT 2012
Signed-off-by: Peter Hutterer <peter.hutterer at 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
More information about the xorg-devel
mailing list