aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/test
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-06-11 14:16:16 +0000
committermarha <marha@users.sourceforge.net>2010-06-11 14:16:16 +0000
commitd1e4f4b8546c7955c66dd023bfd6ef437db9d21d (patch)
tree529985e77bfc95aa95fe5b540e8f42b0ef041206 /xorg-server/test
parent13919cf85a6ca41d97238de13344aba59e0f7680 (diff)
parent4c61bf84b11e26e6f22648668c95ea760a379163 (diff)
downloadvcxsrv-d1e4f4b8546c7955c66dd023bfd6ef437db9d21d.tar.gz
vcxsrv-d1e4f4b8546c7955c66dd023bfd6ef437db9d21d.tar.bz2
vcxsrv-d1e4f4b8546c7955c66dd023bfd6ef437db9d21d.zip
svn merge ^/branches/released .
Diffstat (limited to 'xorg-server/test')
-rw-r--r--xorg-server/test/input.c33
-rw-r--r--xorg-server/test/xi2/protocol-common.c12
-rw-r--r--xorg-server/test/xtest.c233
3 files changed, 160 insertions, 118 deletions
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c
index 1271ee683..42435a9db 100644
--- a/xorg-server/test/input.c
+++ b/xorg-server/test/input.c
@@ -801,14 +801,34 @@ static void cmp_attr_fields(InputAttributes *attr1,
} else
g_assert(attr2->device == NULL);
+ if (attr1->pnp_id != NULL)
+ {
+ g_assert(attr1->pnp_id != attr2->pnp_id);
+ g_assert(strcmp(attr1->pnp_id, attr2->pnp_id) == 0);
+ } else
+ g_assert(attr2->pnp_id == NULL);
+
+ if (attr1->usb_id != NULL)
+ {
+ g_assert(attr1->usb_id != attr2->usb_id);
+ g_assert(strcmp(attr1->usb_id, attr2->usb_id) == 0);
+ } else
+ g_assert(attr2->usb_id == NULL);
+
tags1 = attr1->tags;
tags2 = attr2->tags;
+
+ /* if we don't have any tags, skip the tag checking bits */
if (!tags1)
{
g_assert(!tags2);
return;
}
+ /* Don't lug around empty arrays */
+ g_assert(*tags1);
+ g_assert(*tags2);
+
/* check for identical content, but duplicated */
while (*tags1)
{
@@ -818,6 +838,7 @@ static void cmp_attr_fields(InputAttributes *attr1,
tags2++;
}
+ /* ensure tags1 and tags2 have the same no of elements */
g_assert(!*tags2);
/* check for not sharing memory */
@@ -842,7 +863,7 @@ static void dix_input_attributes(void)
g_assert(!new);
new = DuplicateInputAttributes(&orig);
- g_assert(memcpy(&orig, new, sizeof(InputAttributes)));
+ g_assert(memcmp(&orig, new, sizeof(InputAttributes)) == 0);
orig.product = "product name";
new = DuplicateInputAttributes(&orig);
@@ -859,6 +880,16 @@ static void dix_input_attributes(void)
cmp_attr_fields(&orig, new);
FreeInputAttributes(new);
+ orig.pnp_id = "PnPID";
+ new = DuplicateInputAttributes(&orig);
+ cmp_attr_fields(&orig, new);
+ FreeInputAttributes(new);
+
+ orig.usb_id = "USBID";
+ new = DuplicateInputAttributes(&orig);
+ cmp_attr_fields(&orig, new);
+ FreeInputAttributes(new);
+
orig.flags = 0xF0;
new = DuplicateInputAttributes(&orig);
cmp_attr_fields(&orig, new);
diff --git a/xorg-server/test/xi2/protocol-common.c b/xorg-server/test/xi2/protocol-common.c
index a06c5a913..d396a233d 100644
--- a/xorg-server/test/xi2/protocol-common.c
+++ b/xorg-server/test/xi2/protocol-common.c
@@ -27,6 +27,7 @@
#include <stdint.h>
#include "extinit.h" /* for XInputExtensionInit */
+#include "exglobals.h"
#include <glib.h>
#include "protocol-common.h"
@@ -107,7 +108,6 @@ ClientRec init_client(int len, void *data)
/* we store the privates now and reassign it after the memset. this way
* we can share them across multiple test runs and don't have to worry
* about freeing them after each test run. */
- PrivateRec *privates = client.devPrivates;
client.index = CLIENT_INDEX;
client.clientAsMask = CLIENT_MASK;
@@ -115,7 +115,7 @@ ClientRec init_client(int len, void *data)
client.req_len = len;
client.requestBuffer = data;
- client.devPrivates = privates;
+ dixAllocatePrivates(&client.devPrivates, PRIVATE_CLIENT);
return client;
}
@@ -136,6 +136,9 @@ void init_window(WindowPtr window, WindowPtr parent, int id)
g_assert(window->optional);
}
+extern DevPrivateKeyRec miPointerScreenKeyRec;
+extern DevPrivateKeyRec miPointerPrivKeyRec;
+
/* Needed for the screen setup, otherwise we crash during sprite initialization */
static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
static Bool set_cursor_pos(DeviceIntPtr dev, ScreenPtr screen, int x, int y, Bool event) { return TRUE; }
@@ -153,7 +156,12 @@ void init_simple(void)
dixResetPrivates();
InitAtoms();
+ XkbInitPrivates();
+ dixRegisterPrivateKey(&XIClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(XIClientRec));
+ dixRegisterPrivateKey(&miPointerScreenKeyRec, PRIVATE_SCREEN, 0);
+ dixRegisterPrivateKey(&miPointerPrivKeyRec, PRIVATE_DEVICE, 0);
XInputExtensionInit();
+
init_window(&root, NULL, ROOT_WINDOW_ID);
init_window(&window, &root, CLIENT_WINDOW_ID);
diff --git a/xorg-server/test/xtest.c b/xorg-server/test/xtest.c
index cc1188d7d..cd8f23bff 100644
--- a/xorg-server/test/xtest.c
+++ b/xorg-server/test/xtest.c
@@ -1,115 +1,118 @@
-/**
- * Copyright © 2009 Red Hat, Inc.
- *
- * 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_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-#include <stdint.h>
-#include <X11/Xatom.h>
-#include "input.h"
-#include "inputstr.h"
-#include "scrnintstr.h"
-#include "exevents.h"
-#include "xserver-properties.h"
-
-#include <glib.h>
-
-/**
- */
-
-/* from Xext/xtest.c */
-extern DeviceIntPtr xtestpointer, xtestkeyboard;
-
-/* Needed for the screen setup, otherwise we crash during sprite initialization */
-static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
-
-static void xtest_init_devices(void)
-{
- ScreenRec screen;
-
- /* random stuff that needs initialization */
- memset(&screen, 0, sizeof(screen));
- screenInfo.numScreens = 1;
- screenInfo.screens[0] = &screen;
- screen.myNum = 0;
- screen.id = 100;
- screen.width = 640;
- screen.height = 480;
- screen.DeviceCursorInitialize = device_cursor_init;
- dixResetPrivates();
- InitAtoms();
-
- /* this also inits the xtest devices */
- InitCoreDevices();
-
- g_assert(xtestpointer);
- g_assert(xtestkeyboard);
- g_assert(IsXTestDevice(xtestpointer, NULL));
- g_assert(IsXTestDevice(xtestkeyboard, NULL));
- g_assert(IsXTestDevice(xtestpointer, inputInfo.pointer));
- g_assert(IsXTestDevice(xtestkeyboard, inputInfo.keyboard));
- g_assert(GetXTestDevice(inputInfo.pointer) == xtestpointer);
- g_assert(GetXTestDevice(inputInfo.keyboard) == xtestkeyboard);
-}
-
-/**
- * Each xtest devices has a property attached marking it. This property
- * cannot be changed.
- */
-static void xtest_properties(void)
-{
- int rc;
- char value = 1;
- XIPropertyValuePtr prop;
- Atom xtest_prop = XIGetKnownProperty(XI_PROP_XTEST_DEVICE);
-
- rc = XIGetDeviceProperty(xtestpointer, xtest_prop, &prop);
- g_assert(rc == Success);
- g_assert(prop);
-
- rc = XIGetDeviceProperty(xtestkeyboard, xtest_prop, &prop);
- g_assert(rc == Success);
- g_assert(prop != NULL);
-
- rc = XIChangeDeviceProperty(xtestpointer, xtest_prop,
- XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
- g_assert(rc == BadAccess);
- rc = XIChangeDeviceProperty(xtestkeyboard, xtest_prop,
- XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
- g_assert(rc == BadAccess);
-}
-
-
-
-int main(int argc, char** argv)
-{
- g_test_init(&argc, &argv,NULL);
- g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
-
- g_test_add_func("/dix/xtest/init", xtest_init_devices);
- g_test_add_func("/dix/xtest/properties", xtest_properties);
-
- return g_test_run();
-}
-
-
+/**
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ * 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_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+#include <stdint.h>
+#include <X11/Xatom.h>
+#include "input.h"
+#include "inputstr.h"
+#include "scrnintstr.h"
+#include "exevents.h"
+#include "xkbsrv.h"
+#include "xserver-properties.h"
+
+#include <glib.h>
+
+/**
+ */
+
+/* from Xext/xtest.c */
+extern DeviceIntPtr xtestpointer, xtestkeyboard;
+
+/* Needed for the screen setup, otherwise we crash during sprite initialization */
+static Bool device_cursor_init(DeviceIntPtr dev, ScreenPtr screen) { return TRUE; }
+
+static void xtest_init_devices(void)
+{
+ ScreenRec screen;
+
+ /* random stuff that needs initialization */
+ memset(&screen, 0, sizeof(screen));
+ screenInfo.numScreens = 1;
+ screenInfo.screens[0] = &screen;
+ screen.myNum = 0;
+ screen.id = 100;
+ screen.width = 640;
+ screen.height = 480;
+ screen.DeviceCursorInitialize = device_cursor_init;
+ dixResetPrivates();
+ InitAtoms();
+
+ XkbInitPrivates();
+
+ /* this also inits the xtest devices */
+ InitCoreDevices();
+
+ g_assert(xtestpointer);
+ g_assert(xtestkeyboard);
+ g_assert(IsXTestDevice(xtestpointer, NULL));
+ g_assert(IsXTestDevice(xtestkeyboard, NULL));
+ g_assert(IsXTestDevice(xtestpointer, inputInfo.pointer));
+ g_assert(IsXTestDevice(xtestkeyboard, inputInfo.keyboard));
+ g_assert(GetXTestDevice(inputInfo.pointer) == xtestpointer);
+ g_assert(GetXTestDevice(inputInfo.keyboard) == xtestkeyboard);
+}
+
+/**
+ * Each xtest devices has a property attached marking it. This property
+ * cannot be changed.
+ */
+static void xtest_properties(void)
+{
+ int rc;
+ char value = 1;
+ XIPropertyValuePtr prop;
+ Atom xtest_prop = XIGetKnownProperty(XI_PROP_XTEST_DEVICE);
+
+ rc = XIGetDeviceProperty(xtestpointer, xtest_prop, &prop);
+ g_assert(rc == Success);
+ g_assert(prop);
+
+ rc = XIGetDeviceProperty(xtestkeyboard, xtest_prop, &prop);
+ g_assert(rc == Success);
+ g_assert(prop != NULL);
+
+ rc = XIChangeDeviceProperty(xtestpointer, xtest_prop,
+ XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
+ g_assert(rc == BadAccess);
+ rc = XIChangeDeviceProperty(xtestkeyboard, xtest_prop,
+ XA_INTEGER, 8, PropModeReplace, 1, &value, FALSE);
+ g_assert(rc == BadAccess);
+}
+
+
+
+int main(int argc, char** argv)
+{
+ g_test_init(&argc, &argv,NULL);
+ g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
+
+ g_test_add_func("/dix/xtest/init", xtest_init_devices);
+ g_test_add_func("/dix/xtest/properties", xtest_properties);
+
+ return g_test_run();
+}
+
+