From 4c61bf84b11e26e6f22648668c95ea760a379163 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 11 Jun 2010 12:14:52 +0000 Subject: xserver git update 11/6/2010 --- xorg-server/test/input.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'xorg-server/test/input.c') 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); -- cgit v1.2.3