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-04-23 14:51:28 +1000 |
commit | 33b2d13f8d70105f8f9e89e576983a3a5c20b301 (patch) | |
tree | e3a4a910a282b1b235b0bf65d605049f39cbee0f | |
parent | b6f87c73eaaa3490f335d5bb2152b84279358374 (diff) |
test: add basic test for multiple device check
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Bastien Nocera <hadess@hadess.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..173b762 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) +{ + const WacomMatch **match; + int nmatches = 0; + int found_bus = 0, + found_vendor_id = 0, + found_product_id = 0; + + for (match = libwacom_get_matches(device); *match; match++) + { + nmatches++; + if (libwacom_match_get_bustype(*match) == libwacom_get_bustype(device)) + found_bus = 1; + if (libwacom_match_get_vendor_id(*match) == libwacom_get_vendor_id(device)) + found_vendor_id = 1; + if (libwacom_match_get_product_id(*match) == libwacom_get_product_id(device)) + found_product_id = 1; + } + + assert(nmatches == 2); + 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); |