summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-05-05 17:07:17 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-05-05 18:25:17 -0700
commit58e6058462aa0de727ac887d414c18bdab02ac74 (patch)
tree8a7475ce8fa527418bfafd6648bebd85e4cfb83d /tests
parent93e62128b33b8fefa96e3a7e474ed01edd551228 (diff)
Move Xkb extension setup to tests/libX11/xhiv-Xkb.h header
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/libX11/Makefile.am2
-rw-r--r--tests/libX11/XkbGetDeviceInfo.c37
-rw-r--r--tests/libX11/xhiv-Xkb.h70
3 files changed, 73 insertions, 36 deletions
diff --git a/tests/libX11/Makefile.am b/tests/libX11/Makefile.am
index 08b9434..ecc470d 100644
--- a/tests/libX11/Makefile.am
+++ b/tests/libX11/Makefile.am
@@ -29,6 +29,8 @@ noinst_PROGRAMS += XListHosts
noinst_PROGRAMS += XQueryFont
noinst_PROGRAMS += XkbGetDeviceInfo
+noinst_HEADERS = xhiv-Xkb.h
+
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/include
AM_CFLAGS = $(CWARNFLAGS) $(LIBX11_CFLAGS)
LDADD = -L$(top_builddir)/src -lXhiv $(LIBX11_LIBS)
diff --git a/tests/libX11/XkbGetDeviceInfo.c b/tests/libX11/XkbGetDeviceInfo.c
index ca612cf..0b3a6eb 100644
--- a/tests/libX11/XkbGetDeviceInfo.c
+++ b/tests/libX11/XkbGetDeviceInfo.c
@@ -25,6 +25,7 @@
#endif
#include "xhiv.h"
+#include "xhiv-Xkb.h"
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/Xproto.h>
@@ -32,45 +33,9 @@
#include <assert.h>
#include <stdio.h>
-#define MY_XKB_EXT_CODE 200
-
static void
testOverflowFields(void)
{
- /* Report that XKB is present */
- const xQueryExtensionReply qext_reply = {
- .type = X_Reply,
- .length = 0,
- .present = xTrue,
- .major_opcode = MY_XKB_EXT_CODE,
- .first_event = 100,
- .first_error = 150
- };
- xhiv_response qext_response = {
- .reqType = X_QueryExtension,
- .reqMinor = XHIV_REQ_IGNORE,
- .sequence = XHIV_SEQ_MATCHDATA,
- .match_data = XkbName,
- .length = (SIZEOF(xQueryExtensionReply) >> 2),
- .response_data = &qext_reply,
- .response_datalen = sizeof(qext_reply)
- };
- /* Report which version of XKB we support */
- const xkbUseExtensionReply xkb_use_reply = {
- .type = X_Reply,
- .supported = xTrue,
- .serverMajor = 1,
- .serverMinor = 0
- };
- xhiv_response xkb_use_response = {
- .next = &qext_response,
- .reqType = MY_XKB_EXT_CODE,
- .reqMinor = X_kbUseExtension,
- .sequence = XHIV_SEQ_IGNORE,
- .length = (SIZEOF(xkbUseExtensionReply) >> 2),
- .response_data = &xkb_use_reply,
- .response_datalen = sizeof(xkb_use_reply)
- };
/* xkbGetDeviceInfo requires a length-counted name string follows */
struct {
uint16_t length;
diff --git a/tests/libX11/xhiv-Xkb.h b/tests/libX11/xhiv-Xkb.h
new file mode 100644
index 0000000..eb6238a
--- /dev/null
+++ b/tests/libX11/xhiv-Xkb.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "xhiv.h"
+#include <X11/Xproto.h>
+#include <X11/extensions/XKBproto.h>
+
+/* Common definitions for XKB extension tests */
+
+#define MY_XKB_EXT_CODE 200
+
+/* Report that XKB is present */
+static const xQueryExtensionReply xkb_qext_reply = {
+ .type = X_Reply,
+ .length = 0,
+ .present = xTrue,
+ .major_opcode = MY_XKB_EXT_CODE,
+ .first_event = 100,
+ .first_error = 150
+};
+static xhiv_response xkb_qext_response = {
+ .next = NULL,
+ .reqType = X_QueryExtension,
+ .reqMinor = XHIV_REQ_IGNORE,
+ .sequence = XHIV_SEQ_MATCHDATA,
+ .match_data = XkbName,
+ .length = (SIZEOF(xQueryExtensionReply) >> 2),
+ .response_data = &xkb_qext_reply,
+ .response_datalen = sizeof(xkb_qext_reply)
+};
+
+/* Report which version of XKB we support */
+static const xkbUseExtensionReply xkb_use_reply = {
+ .type = X_Reply,
+ .supported = xTrue,
+ .serverMajor = 1,
+ .serverMinor = 0
+};
+static xhiv_response xkb_use_response = {
+ .next = &xkb_qext_response,
+ .reqType = MY_XKB_EXT_CODE,
+ .reqMinor = X_kbUseExtension,
+ .sequence = XHIV_SEQ_IGNORE,
+ .length = (SIZEOF(xkbUseExtensionReply) >> 2),
+ .response_data = &xkb_use_reply,
+ .response_datalen = sizeof(xkb_use_reply)
+};