Some model lines don't have tool ids, but for the ones that do check that we
have the correct styli in the database.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
Not sure about the Graphire series - shouldn't that have a tool ID? Same
with the ISDV4, I think some of them have a tool ID, isn't it?

 test/tablet-validity.c |   27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/test/tablet-validity.c b/test/tablet-validity.c
index 195fa4e..664e605 100644
--- a/test/tablet-validity.c
+++ b/test/tablet-validity.c
@@ -43,6 +43,7 @@
 static void verify_tablet(WacomDevice *device)
 {
        const char *name;
+       const int *styli;
        int nstyli;
        unsigned int product;
 
@@ -66,7 +67,9 @@ static void verify_tablet(WacomDevice *device)
                assert(libwacom_get_height(device) > 0);
        }
        assert(libwacom_get_num_buttons(device) >= 0);
-       assert(libwacom_get_supported_styli(device, &nstyli) != NULL);
+
+       styli = libwacom_get_supported_styli(device, &nstyli);
+       assert(styli != NULL);
 
        product = libwacom_get_vendor_id(device) << 16 | 
libwacom_get_product_id(device);
        switch(product) {
@@ -79,6 +82,28 @@ static void verify_tablet(WacomDevice *device)
                        break;
        }
 
+       switch(libwacom_get_class(device)) {
+               case WCLASS_BAMBOO:
+               case WCLASS_ISDV4:
+               case WCLASS_PEN_DISPLAYS:
+               case WCLASS_GRAPHIRE:
+                       break;
+               case WCLASS_INTUOS:
+               case WCLASS_INTUOS2:
+               case WCLASS_INTUOS3:
+               case WCLASS_INTUOS4:
+               case WCLASS_CINTIQ:
+                       {
+                               int i;
+                               for (i = 0; i < nstyli; i++) {
+                                       assert(styli[i] != 
WACOM_STYLUS_FALLBACK_ID);
+                                       assert(styli[i] != 
WACOM_ERASER_FALLBACK_ID);
+                               }
+                       }
+               default:
+                       assert(1); /* don't get here */
+       }
+
        assert(libwacom_get_ring_num_modes(device) >= 0);
        assert(libwacom_get_ring2_num_modes(device) >= 0);
        assert(libwacom_get_num_strips(device) >= 0);
-- 
1.7.10


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to