summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2012-03-04test: add new test cases to .gitignoreGaetan Nadon2-0/+2
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Keith Packard <keithp@keithp.com>
2012-02-03Namespace list api to reduce conflicts with similar system headersAlan Coopersmith2-72/+72
Rename functions/macros from list_* to xorg_list_* Rename struct from struct list to struct xorg_list. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> In-sed-I-trust: Peter Hutterer <peter.hutterer@who-t.net>
2012-01-15test: Fix linking issues when building unit tests without the Xorg DDXJeremy Huddleston2-4/+144
This allows unit tests to build and run successfully on darwin when only the Xvfb or XQuartz DDX is built. Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2011-12-23test/xi2: Really fix infinite loop in test_convert_XITouchOwnershipEventChase Douglas1-1/+1
long i; for (i = 1; ; i <<= 1) if (i == (1 << 31)) break; (1 << 31) is compiled as an int, and thus is equal to -2147483648. We are trying to compare it against a long, which on 64-bit machines is 2147483648. This results in an infinite loop. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-22test/xi2: Fix infinite loop in test_convert_XITouchOwnershipEventKeith Packard1-1/+3
The touchid test was using a loop like: for(i = 1; i < 0xffffffff; i <<= 1) When 'i' is a 32-bit variable, this infinite loops as it goes from 0x80000000 to 0. 'i' is declared as 'long', which is 32-bit in 32-bit mode. Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-22test: fix grab mode value tests for new XIGrabModeTouchPeter Hutterer1-4/+13
This test checks that last-valid-mode + 1 returns a BadValue. With the addition of XIGrabModeTouch, that value has changed - sync it up again. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-21test: add a basic test for ownership event valuesPeter Hutterer1-0/+94
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-21test: drop printfs from protocol-eventconvert.cPeter Hutterer1-8/+0
The test outputs are noisy enough, no need having these here too. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-12-20dix: add DIX API to create touchpointsPeter Hutterer1-0/+70
The DIX touchpoints are the ones used for event processing. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-20dix: if we run out of space for new touch events, resize the queuePeter Hutterer1-0/+51
The SIGIO handler forces us to drop the current touch and schedule the actual resize for later. Should not happen if the device sets up the TouchClassRec with the correct number of touchpoints. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-19dix: add helper functions to create DDX touch recsPeter Hutterer2-1/+151
DDX touch points are the ones that keep records of the driver-submitted touchpoints. They're unaffected by the grab state and terminate on a TouchEnd submitted by the driver. The client ID assigned is server-global. Since drivers usually submit in the SIGIO handler, we cannot allocate in the these functions. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-16tests: update for touch supportPeter Hutterer2-9/+31
Touch event mask must be set for all three event types. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-13input: replace GRABTYPE_* with the InputLevel enumsPeter Hutterer2-67/+67
They achieve the same thing, re-use the more generic InputLevel so we can convert to/fro easier. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-10Change GetXI2/XI/CoreType to just take a type argumentPeter Hutterer1-3/+3
Avoids the dummy-event dance if we have an event type and need to get the matching XI2 type. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-08Merge remote-tracking branch 'whot/for-keith'Keith Packard4-1/+237
2011-12-09Add a new XI2Mask struct and a few helper functions.Peter Hutterer2-1/+133
The current XI2 mask handling is handy for copying (fixed size arrays) but a pain to deal with otherwise. Add a struct for XI2 masks and the required accessors. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-09dix: switch the syncEvent queue to a struct listPeter Hutterer1-0/+67
No effective functionality change, just cleanup to make this code slightly more sane. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-07test: update .gitignore with xfree86 and sort alphabeticallyGaetan Nadon1-3/+4
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Signed-off-by: Gaetan Nadon <memsize@videotron.ca> Signed-off-by: Keith Packard <keithp@keithp.com>
2011-12-06include: add list_last_entry to get the tail of a listPeter Hutterer1-0/+6
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-06include: add list_append()Peter Hutterer1-0/+31
The existing list_add() prepends to the list, but in some cases we need the list ordered in the way we append the elements. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
2011-12-02Disable building of tests requiring DDX functions when Xorg is not builtAlan Coopersmith1-7/+21
Some test cases require linking with some sort of DDX - ideally we'd have a stub ddx for testing, but for now, since we link with the Xorg ddx, disable those tests when configured with --disable-xorg Fixes https://bugs.freedesktop.org/show_bug.cgi?id=43320 Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-29test: remove unneeded printf statements from misc.cPeter Hutterer1-3/+0
Leftover from debugging, is not really needeed in a test. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-11-23Add fallback implementation of strndup()Alan Coopersmith3-1/+71
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Linux test code fixed by: Keith Packard <keithp@keithp.com>
2011-11-23Enable memory checking during unit testingAlan Coopersmith2-0/+2
If configure is generated with xorg-macros 1.16.0 or newer, and an appropriate memory checking library is found for the platform, use it when running unit tests. If not, then no harm is done. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-23Don't require ld -wrap for tests that don't need itAlan Coopersmith2-2/+9
If configure is generated with xorg-macros 1.16 or later, this allows builders to --enable-unit-test and run the tests other than the xi2 tests which require ld -wrap (and are still wrapped in if HAVE_LD_WRAP in tests/xi2/Makefile). If an older xorg-macros is used, the existing behaviour is preserved of requiring ld -wrap for all unit tests, but no side effects occur, so the minimum xorg-macros version is not raised. If unit testing is enabled without ld -wrap, then we create a bogus "xi2-tests" script just to report that we're skipping them. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-11-02Merge remote-tracking branch 'whot/two-screen-coordinates'Keith Packard1-0/+104
2011-10-31xfree86: fix potential buffer overflowServaas Vandenberghe1-0/+26
The patch below fixes a potential buffer overflow in xf86addComment(). This occurs if curlen > 0 && eol_seen == 0 && iscomment == 0 , as follows from the code: char *xf86addComment(char *cur, char *add) <...> len = strlen(add); endnewline = add[len - 1] == '\n'; len += 1 + iscomment + (!hasnewline) + (!endnewline) + eol_seen; if ((str = realloc(cur, len + curlen)) == NULL) return cur; cur = str; if (eol_seen || (curlen && !hasnewline)) cur[curlen++] = '\n'; if (!iscomment) cur[curlen++] = '#'; strcpy(cur + curlen, add); if (!endnewline) strcat(cur, "\n"); Signed-off-by: Servaas Vandenberghe <vdb@picaros.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> [whot: added buffer overflow test case] Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-27test: fix two more failing FP3232 testsDave Airlie3-6/+5
And put a comment in to explain why we're testing for a frac between .3 and .6. We can't directly compare the frac since the floating/fixed point conversion loses precision. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-24Merge remote-tracking branch 'whot/for-keith'Keith Packard1-4/+23
2011-10-25test: fix test with new double -> fp3232 conversion functionsPeter Hutterer1-4/+3
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Tested-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
2011-10-25dix: add ScrollInfo to DeviceChangedEventsPeter Hutterer1-0/+20
3304bbff9b4ed63f1a47410a5320a136420ba2c6 added smooth scrolling support for pointer events and for XIQueryDevice but didn't add the matching parts to XIDeviceChangedEvents. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-21test: Add unit test for mieqJeremy Huddleston1-0/+69
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-21test: Silence some debug lines from the input unit testsJeremy Huddleston1-6/+9
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-10-19Merge remote-tracking branch 'whot/for-keith'Keith Packard1-1/+14
2011-10-18dix: add valuator_mask_fetch_double()Peter Hutterer1-1/+14
Using this call simplifies callers that don't know if the mask bit is set. Before: if (valuator_mask_isset(mask, valnum)) value = valuator_mask_get_double(mask, valnum)); else value = someothervalue; Now: if (!valuator_mask_fetch_double(mask, valnum, &value)) value = someothervalue; Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-10-15test: fix input testDave Airlie1-11/+11
The test was memsetting the wrong thing, this fixes make check in my tinderbox. Signed-off-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
2011-10-15dix: add utility functions for double to/fro FP1616/FP3232 conversionJeremy Huddleston1-0/+128
Co-authored-by: Jeremy Huddleston <jeremyhu@apple.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Reviewed-by: Mark Kettenis <kettenis@openbsd.org>
2011-10-13Store desktop dimensions in screenInfo.Peter Hutterer1-0/+104
For Zaphod mode screen crossing handling we need to know the size of all screens together (i.e. the whole desktop size). Store that in the screenInfo to have it readily available in events. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-30Input: Add smooth-scrolling support to GetPointerEventsPeter Hutterer3-6/+163
For scroll wheel support, we used to send buttons 4/5 and 6/7 for horizontal/vertical positive/negative scroll events. For touchpads, we really want more fine-grained scroll values. GetPointerEvents now accepts both old-school scroll button presses, and new-style scroll axis events, while emitting both types of events to support both old and new clients. This works with the new XIScrollClass to mark axes as scrolling axes. Drivers mark any valuators that send scroll events with SetScrollValuator. (Currently missing: the XIDeviceChangeEvent being sent when a driver changes a scroll axis at run-time. This can be added later.) Note: the SCROLL_TYPE enums are intentionally different values to the XI2 proto values to avoid copy/overlapping range bugs. Co-authored-by: Daniel Stone <daniel@fooishbar.org> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
2011-09-29Input: Add POINTER_EMULATED flag to GetPointerEventsDaniel Stone1-1/+17
POINTER_EMULATED merely sets XIPointerEmulated in the generated DeviceEvent. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29Input: Make DeviceEvent use doubles internallyDaniel Stone1-4/+3
Change the DeviceEvent InternalEvent to use doubles for its valuators, instead of data and data_frac. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29Input: Make RawDeviceEvent use doubles internallyDaniel Stone1-8/+6
Change RawDeviceEvent to use doubles for valuators internally, rather than data(_raw) and data(_raw)_frac. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29Input: Add double-precision valuator_mask APIDaniel Stone1-6/+15
Add API for valuator_mask that accepts and returns doubles, rather than ints. No double API is provided for set_range at the moment. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
2011-09-29Input: Add flags to RawDeviceEventDaniel Stone1-0/+1
Add a flags member which will be copied wholesale into the resultant xXIRawEvent. Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2011-09-26Merge remote-tracking branch 'whot/next'Keith Packard4-2/+413
2011-09-27xfree86: switch options from pointer to XF86OptionPtrPeter Hutterer1-5/+6
In all cases, the pointer was simply type-cast anyway. Let's get some compile-time type safety going, how about that. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com> Squashed in: xfree86: Move definition of xf86OptionPtr into separate header file The pile of spaghettis that is the xfree86 include dependencies make it rather hard to have a single typedef somewhere that's not interfering with everything else or drags in a whole bunch of other includes. Move the xf86OptionRec and GenericListRec declarations into a separate header. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-09-21Use internal temp variable for swap macrosMatt Turner10-163/+131
Also, fix whitespace, mainly around swaps(&rep.sequenceNumber) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
2011-08-22input: make InputOption opaque, provide interface functions.Peter Hutterer1-0/+90
InputOptions is not switched to use struct list for a future patch to unify it with the XF86OptionRec. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com>
2011-08-22Add null-terminated list interface.Peter Hutterer1-0/+164
This is a set of macros to provide a struct list-alike interface for classic linked lists such as the XF86OptionRec or the DeviceIntRec. The typical format for these is to have a "struct foo *next" pointer in each struct foo and walk through those. These macros provide a few basic functions to add to, remove from and iterate through these lists. While struct list is in some ways more flexible, switching legacy code to use struct list is not alway viable. These macros at least reduce the amount of open-coded lists. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2011-08-22Disable check of double-aligned in test/input.c on Renesas SHNobuhiro Iwamatsu1-1/+1
Renesas SH is not aligned at size of double. When structure has double value, It is aligned in 4byte (long). Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>