diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-11-29 13:12:21 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-11-29 13:12:21 +1000 |
commit | 658456b7f98e13f6c14cc07ab3a1f68873feae09 (patch) | |
tree | e1920d7afbdcca09a39a87c4e3c645b7b8f20cdc /test |
Initial revision - a base library for querying information about tablets
Only one data file shipped so far, for a I4 wireless model.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 7 | ||||
-rw-r--r-- | test/load.c | 70 |
2 files changed, 77 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..3cf2e88 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,7 @@ +noinst_PROGRAMS=load + +TESTS=$(noinst_PROGRAMS) + +INCLUDES=-I$(top_srcdir)/libwacom + +load_LDADD=$(top_builddir)/libwacom/libwacom.la diff --git a/test/load.c b/test/load.c new file mode 100644 index 0000000..1b7a6c4 --- /dev/null +++ b/test/load.c @@ -0,0 +1,70 @@ +/* + * Copyright © 2011 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software + * and its documentation for any purpose is hereby granted without + * fee, provided that the above copyright notice appear in all copies + * and that both that copyright notice and this permission notice + * appear in supporting documentation, and that the name of Red Hat + * not be used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. Red + * Hat makes no representations about the suitability of this software + * for any purpose. It is provided "as is" without express or implied + * warranty. + * + * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: + * Peter Hutterer (peter.hutterer@redhat.com) + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <stdio.h> +#include <string.h> +#include "libwacom.h" +#include <assert.h> + +int main(int argc, char **argv) +{ + WacomDevice *device; + const char *str; + + device = libwacom_new_from_usbid(0, 0, NULL); + assert(!device); + + device = libwacom_new_from_usbid(0x56a, 0x00bc, NULL); + assert(device); + + str = libwacom_get_vendor(device); + assert(strcmp(str, "Wacom") == 0); + assert(libwacom_get_class(device) == WCLASS_INTUOS4); + assert(libwacom_get_vendor_id(device) == 0x56a); + assert(libwacom_get_product_id(device) == 0xbc); + assert(libwacom_get_bustype(device) == WBUSTYPE_USB); + assert(libwacom_get_num_buttons(device) == 9); + assert(libwacom_has_stylus(device)); + assert(!libwacom_has_touch(device)); + assert(libwacom_has_ring(device)); + assert(!libwacom_has_ring2(device)); + assert(!libwacom_has_vstrip(device)); + assert(!libwacom_has_hstrip(device)); + assert(!libwacom_is_builtin(device)); + assert(libwacom_get_width(device) == 9); + assert(libwacom_get_height(device) == 6); + + libwacom_destroy(&device); + assert(!device); + + return 0; +} + +/* vim: set noexpandtab tabstop=8 shiftwidth=8: */ |