diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-29 14:55:01 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-03-29 14:55:01 +1000 |
commit | 406e424ec37a6b0488fdafa068e3b1514d11195f (patch) | |
tree | 47f94ec074a0ee3374659fa69c47bb8eae8350b3 | |
parent | dbeaa96fb09806253104304fc31bcedf3c98b32c (diff) |
test: add basic test for multiple device check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | test/load.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/load.c b/test/load.c index 96479a0..ff4c85f 100644 --- a/test/load.c +++ b/test/load.c @@ -33,6 +33,29 @@ #include "libwacom.h" #include <assert.h> +static void check_multiple_match(WacomDevice *device) +{ + WacomMatch **matches; + int nmatches; + int found_bus = 0, + found_vendor_id = 0, + found_product_id = 0; + + matches = libwacom_get_matches(device, &nmatches); + assert(nmatches == 2); + while(nmatches--) + { + if (libwacom_match_get_bustype(matches[nmatches]) == libwacom_get_bustype(device)) + found_bus = 1; + if (libwacom_match_get_vendor_id(matches[nmatches]) == libwacom_get_vendor_id(device)) + found_vendor_id = 1; + if (libwacom_match_get_product_id(matches[nmatches]) == libwacom_get_product_id(device)) + found_product_id = 1; + } + + assert(found_bus && found_vendor_id && found_product_id); +} + int main(int argc, char **argv) { WacomDeviceDatabase *db; @@ -67,6 +90,9 @@ int main(int argc, char **argv) assert(libwacom_get_width(device) == 8); assert(libwacom_get_height(device) == 5); + /* I4 WL has two matches */ + check_multiple_match(device); + libwacom_destroy(device); device = libwacom_new_from_usbid(db, 0x56a, 0x00b9, NULL); |