diff options
| author | Henrik Rydberg <rydberg@euromail.se> | 2010-12-30 19:00:16 +0100 |
|---|---|---|
| committer | Henrik Rydberg <rydberg@euromail.se> | 2011-01-02 09:48:33 +0100 |
| commit | ab67ba5e161c4d65128fc5eada6845a543464759 (patch) | |
| tree | f34d3f985a32418045bcec87a245e23ad378ce03 | |
| parent | a70656bd749b1989cdf564b535c0aede8ebf4666 (diff) | |
Move test program to tools directory
The current test programs are tools rather than automatic tests. To
conform better to the the usage of "make check", move the current
tools over the appropriate directory. Also drop the grail-touch
program, as it will be replaced by the utouch-frame package.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | INSTALL | 7 | ||||
| -rw-r--r-- | Makefile.am | 2 | ||||
| -rw-r--r-- | configure.ac | 1 | ||||
| -rw-r--r-- | test/Makefile.am | 9 | ||||
| -rw-r--r-- | test/grail-touch.c | 97 | ||||
| -rw-r--r-- | tools/Makefile.am | 7 | ||||
| -rw-r--r-- | tools/grail-gesture.c (renamed from test/grail-gesture.c) | 0 |
8 files changed, 10 insertions, 116 deletions
| @@ -78,5 +78,4 @@ core | |||
| 78 | .bzrignore | 78 | .bzrignore |
| 79 | .bzr | 79 | .bzr |
| 80 | patches | 80 | patches |
| 81 | test/grail-gesture | 81 | tools/grail-gesture |
| 82 | test/grail-touch | ||
| @@ -7,13 +7,6 @@ installed. Then, do | |||
| 7 | ./configure | 7 | ./configure |
| 8 | make | 8 | make |
| 9 | 9 | ||
| 10 | To test the touch properties of an MT device at /dev/input/eventX, do | ||
| 11 | |||
| 12 | sudo ./test/grail-touch /dev/input/eventX | ||
| 13 | |||
| 14 | You should be able to see touch events in the terminal. After five | ||
| 15 | seconds of inactivity, the program exits. | ||
| 16 | |||
| 17 | To test gestures, do | 10 | To test gestures, do |
| 18 | 11 | ||
| 19 | sudo ./test/grail-gesture 0xffffffff /dev/input/eventX | 12 | sudo ./test/grail-gesture 0xffffffff /dev/input/eventX |
diff --git a/Makefile.am b/Makefile.am index ec27340..9a16637 100644 --- a/Makefile.am +++ b/Makefile.am | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | SUBDIRS = src test | 1 | SUBDIRS = src test tools |
| 2 | 2 | ||
| 3 | pkgconfigdir = $(libdir)/pkgconfig | 3 | pkgconfigdir = $(libdir)/pkgconfig |
| 4 | pkgconfig_DATA = utouch-grail.pc | 4 | pkgconfig_DATA = utouch-grail.pc |
diff --git a/configure.ac b/configure.ac index 21f070e..0f75818 100644 --- a/configure.ac +++ b/configure.ac | |||
| @@ -26,6 +26,7 @@ PKG_CHECK_MODULES([MTDEV], [mtdev >= 1.0]) | |||
| 26 | 26 | ||
| 27 | AC_CONFIG_FILES([Makefile | 27 | AC_CONFIG_FILES([Makefile |
| 28 | src/Makefile | 28 | src/Makefile |
| 29 | tools/Makefile | ||
| 29 | test/Makefile | 30 | test/Makefile |
| 30 | utouch-grail.pc]) | 31 | utouch-grail.pc]) |
| 31 | AC_OUTPUT | 32 | AC_OUTPUT |
diff --git a/test/Makefile.am b/test/Makefile.am index 8ffbe09..e69de29 100644 --- a/test/Makefile.am +++ b/test/Makefile.am | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | bin_PROGRAMS = grail-touch grail-gesture | ||
| 2 | |||
| 3 | INCLUDES=-I$(top_srcdir)/include/ | ||
| 4 | |||
| 5 | grail_touch_SOURCES = grail-touch.c | ||
| 6 | grail_touch_LDFLAGS = -L$(top_builddir)/src/.libs/ -lutouch-grail -lmtdev -lm | ||
| 7 | |||
| 8 | grail_gesture_SOURCES = grail-gesture.c | ||
| 9 | grail_gesture_LDFLAGS = -L$(top_builddir)/src/.libs/ -lutouch-grail -lmtdev -lm | ||
diff --git a/test/grail-touch.c b/test/grail-touch.c deleted file mode 100644 index c5ecae3..0000000 --- a/test/grail-touch.c +++ /dev/null | |||
| @@ -1,97 +0,0 @@ | |||
| 1 | /***************************************************************************** | ||
| 2 | * | ||
| 3 | * grail - Gesture Recognition And Instantiation Library | ||
| 4 | * | ||
| 5 | * Copyright (C) 2010 Canonical Ltd. | ||
| 6 | * | ||
| 7 | * This program is free software: you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation, either version 3 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, but | ||
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License along | ||
| 18 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | * | ||
| 20 | * Authors: | ||
| 21 | * Henrik Rydberg <rydberg@bitmath.org> | ||
| 22 | * | ||
| 23 | ****************************************************************************/ | ||
| 24 | |||
| 25 | #include <grail-touch.h> | ||
| 26 | #include <string.h> | ||
| 27 | #include <stdio.h> | ||
| 28 | #include <unistd.h> | ||
| 29 | #include <fcntl.h> | ||
| 30 | |||
| 31 | static void tp_event(struct touch_dev *dev, | ||
| 32 | const struct input_event *ev) | ||
| 33 | { | ||
| 34 | fprintf(stderr, "event %d 0x%x %d\n", ev->type, ev->code, ev->value); | ||
| 35 | } | ||
| 36 | |||
| 37 | static void tp_sync(struct touch_dev *dev, | ||
| 38 | const struct input_event *syn) | ||
| 39 | { | ||
| 40 | struct touch_frame *frame = &dev->frame; | ||
| 41 | int i, j; | ||
| 42 | for (i = 0; i < frame->nactive; i++) { | ||
| 43 | struct touch *t = frame->active[i]; | ||
| 44 | fprintf(stderr, "touch %d\n", i); | ||
| 45 | fprintf(stderr, " slot: %d\n", t->slot); | ||
| 46 | fprintf(stderr, " id: %d\n", t->id); | ||
| 47 | fprintf(stderr, " tool_type: %d\n", t->tool_type); | ||
| 48 | fprintf(stderr, " x: %d\n", t->x); | ||
| 49 | fprintf(stderr, " y: %d\n", t->y); | ||
| 50 | fprintf(stderr, " touch_major: %d\n", t->touch_major); | ||
| 51 | fprintf(stderr, " touch_minor: %d\n", t->touch_minor); | ||
| 52 | fprintf(stderr, " width_major: %d\n", t->width_major); | ||
| 53 | fprintf(stderr, " width_minor: %d\n", t->width_minor); | ||
| 54 | fprintf(stderr, " angle: %f\n", | ||
| 55 | touch_angle(dev, t->orientation)); | ||
| 56 | fprintf(stderr, " pressure: %f\n", | ||
| 57 | touch_pressure(dev, t->pressure)); | ||
| 58 | } | ||
| 59 | fprintf(stderr, "sync %d %lld %d %d\n", | ||
| 60 | frame->nactive, frame->time, frame->ncreate, frame->ndestroy); | ||
| 61 | } | ||
| 62 | |||
| 63 | static void loop_device(struct touch_dev *dev, int fd) | ||
| 64 | { | ||
| 65 | dev->event = tp_event; | ||
| 66 | dev->sync = tp_sync; | ||
| 67 | while (!touch_dev_idle(dev, fd, 5000)) | ||
| 68 | touch_dev_pull(dev, fd); | ||
| 69 | } | ||
| 70 | |||
| 71 | int main(int argc, char *argv[]) | ||
| 72 | { | ||
| 73 | struct touch_dev dev; | ||
| 74 | int fd; | ||
| 75 | if (argc < 2) { | ||
| 76 | fprintf(stderr, "Usage: %s <device>\n", argv[0]); | ||
| 77 | return -1; | ||
| 78 | } | ||
| 79 | fd = open(argv[1], O_RDONLY | O_NONBLOCK); | ||
| 80 | if (fd < 0) { | ||
| 81 | fprintf(stderr, "error: could not open device\n"); | ||
| 82 | return -1; | ||
| 83 | } | ||
| 84 | if (ioctl(fd, EVIOCGRAB, 1)) { | ||
| 85 | fprintf(stderr, "error: could not grab the device\n"); | ||
| 86 | return -1; | ||
| 87 | } | ||
| 88 | if (touch_dev_open(&dev, fd)) { | ||
| 89 | fprintf(stderr, "error: could not open touch device\n"); | ||
| 90 | return -1; | ||
| 91 | } | ||
| 92 | loop_device(&dev, fd); | ||
| 93 | touch_dev_close(&dev, fd); | ||
| 94 | ioctl(fd, EVIOCGRAB, 0); | ||
| 95 | close(fd); | ||
| 96 | return 0; | ||
| 97 | } | ||
diff --git a/tools/Makefile.am b/tools/Makefile.am new file mode 100644 index 0000000..ae6866c --- /dev/null +++ b/tools/Makefile.am | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | bin_PROGRAMS = grail-gesture | ||
| 2 | |||
| 3 | INCLUDES=-I$(top_srcdir)/include/ | ||
| 4 | |||
| 5 | grail_gesture_SOURCES = grail-gesture.c | ||
| 6 | grail_gesture_LDFLAGS = -L$(top_builddir)/src/.libs/ \ | ||
| 7 | -lutouch-grail -lmtdev -lm | ||
diff --git a/test/grail-gesture.c b/tools/grail-gesture.c index 614bf1a..614bf1a 100644 --- a/test/grail-gesture.c +++ b/tools/grail-gesture.c | |||
