Commit Graph

112 Commits (9308a460395679aa3cb403211146e4ff9b920992)

Author SHA1 Message Date
Ran Benita fbfbf0aa4b Remove left over filecomp.sh file
Should have removed it in a previous commit.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:53 +01:00
Ran Benita 40b56b0fe3 Update .gitignore for automake 1.12
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:52 +01:00
Ran Benita a1e07fb6f6 Uncomment sections of test/rulescomp.c
Fixes an 'unused' warning. There seems to be nothing wrong with these
sections though, all the tests pass.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-08 17:28:50 +01:00
Ran Benita 12b3495ddf Remove unused 'which' and 'merge' arguments
Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_desc -> xkb_keymap changes.]
2012-05-01 13:57:31 +01:00
Ran Benita 4b49e0a117 Overhaul test suite
Rewrite all of the current tests in the following ways:
- Instead of the current mix of C and shell, just use single-process
  pure C file per test. All of the .sh files are removed, but everything
  that was tested is ported.
- Instead of handling the test logs ourselves, use Automake's
  "parallel-test" mechanism. This will create a single log file for each
  test with it's stdout+stderr, and a top level "test-suite.log" file
  for all the failed tests.
- The "parallel-tests" directive also makes the test run in parallel,
  so "make check" runs faster.
- Also use the "color-tests" directive to have the "make check" output
  colorized. Who doesn't like to see PASS in green?
- All of the test data files are moved into the test/data subdirectory.
  That way we can just put the directory in EXTRA_DIST and forget about
  it.
- The test/Makefile.am file is consolidated into the main Makefile.am,
  for a completely non-recursive build.

Right now the tests are completely independent and just use simple
assert()'s. More sophistication can be added as needed.

It should also be noted that it's still possible to use shell, python,
etc. if a test wants more flexibility than C can provide, just do as
before.

Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: Updated for xkb_keymap changes.]
2012-04-09 14:21:47 +01:00
Daniel Stone ef88c7efab Rename xkb_desc to xkb_keymap
struct xkb_desc was just a hangover from the old XkbDescRec, which isn't
a very descriptive name.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-04-09 13:47:23 +01:00
Daniel Stone 9b14e0c311 Tests: Release context on failure to build keymap
No practical effect since they exit(1) regardless, but it keeps valgrind
happy.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-29 17:38:44 +01:00
Daniel Stone 034ffce664 Use xkb_contexts in keymap compilation
Primarily for the include path, but also for the logging in future.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 17:22:35 +01:00
Daniel Stone 3e9dd7512c Add new context API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 16:59:01 +01:00
Daniel Stone 21f1bff4af Fix distcheck with non-recursive Makefiles
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 15:56:06 +01:00
Ran Benita b5efe41f19 Make build non-recursive
Unify all the different Makefile.am into a single short top level one
(the test/Makefile.am file is left intact though).

This makes the build system simpler to look and should encourage
unifying more currently-disparate code.

Some further motivation can be found in this page:
http://www.flameeyes.eu/autotools-mythbuster/automake/nonrecursive.html

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:17:34 +01:00
Ran Benita 602e87805b Define our own NoSymbol value and use it
Since we have our own xkb_keysym_t type, it makes sense to have our own
NoSymbol value instead of the one from X11/X.h.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:16:36 +01:00
Ran Benita d3908b631c Define our own None atom value
Since we define our own xkb_atom_t type, it makes sense not to use the
X11/X.h None value. This way we can also remove a lot of X11 includes.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 14:16:11 +01:00
Ran Benita 0480f427ad Remove useless stuff from utils
Signed-off-by: Ran Benita <ran234@gmail.com>

[daniels: fixed conflicts from strcasecmp, added includes to make
          filecomp build again]
2012-03-27 14:09:27 +01:00
Ran Benita d22b8dbbd0 Move utils.{c,h} to be used by the entire project
This is a first step for making consistent use of utils.h also outside
of xkbcomp/ .

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:51 +01:00
Ran Benita f52671a4d1 Remove a few remaining uses of the KeySym type
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:22 +01:00
Ran Benita 8b3e2b9b00 Add xkb test file to EXTRA_DIST
To appease make distcheck.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:19 +01:00
Ran Benita eeb0a21448 Update gitignore for 'state' test
Signed-off-by: Ran Benita <ran234@gmail.com>
2012-03-27 13:59:15 +01:00
Daniel Stone ede8473490 Add enum xkb_key_direction instead of bool
Use XKB_KEY_UP instead of 0 and XKB_KEY_DOWN instead of 1.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reported-by: Ran Benita <ran234@gmail.com>
2012-03-27 12:18:41 +01:00
Daniel Stone 7f471a702e Add state serialisation API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-27 12:11:27 +01:00
Daniel Stone d039622a65 Rename keymap allocation API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-22 17:39:12 +00:00
Daniel Stone 3d672fcfea Add LED state API
And also convert state.c to use the state API for mods and groups,
rather than testing the state members directly.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-22 14:32:53 +00:00
Daniel Stone edcaab6512 Round out new state API
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 15:25:45 +00:00
Daniel Stone ecea0d71b2 Add new state API
Add new API to deal with xkb_state objects, including
xkb_state_update_key, which runs the XKB action machinery internally to
calculate what exactly happens to the state when a given key is pressed
or released.

The canonical way to deal with keys is now:
    struct xkb_state *state = xkb_state_new(xkb);
    xkb_keysym_t *syms;
    int num_syms;

    xkb_state_update_key(state, key, is_down);
    num_syms = xkb_key_get_syms(state, key, &syms);

More state handling API, including a way to get at or ignore preserved
modifiers, is on its way.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-21 02:22:04 +00:00
Daniel Stone 7e2dd12142 Add geometry test
Add the dump of my full current X11/XKB keymap as a test for filecomp,
being as it also includes geometry.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-15 09:44:55 +00:00
Daniel Stone b8e950defd filecomp: Fix xkbcomp warning
Ironically, the test for named.xkb included a call that relied on the
default keymap, without the file naming an explicit default.  Go figure.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:31 +00:00
Daniel Stone ed5c6c1796 Remove geometry support, again
It still parses geometry, but happily throws it away.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-03-09 19:30:30 +00:00
Ran Benita 0d8874d01c makekeys: update to match the rest of libX11 makekeys
This integrates two commits from libX11:

ebd6ef0a4db0ddef0ae17ad14571518ccdeea5ba
   XStringToKeysym: Special case for XF86 keysyms

    Some XFree86 keysyms were in XKeysymDB as XF86_foo, despite really being
    XF86foo.  So, if we get to the bottom of XStringToKeysym and haven't
    found our XF86_foo, try it again as XF86foo.

    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>

00175397480b76d32bf82b0c7c94c91a2a95954e
    makekeys: Scan vendor keysyms as well as core

    Since we can't really live without vendor keysyms, scan them all in to
    generate ks_tables.h, rather than only doing the core ones, and leaving
    the vendor syms to be manually synchronised with XKeysymDB.

    Signed-off-by: Daniel Stone <daniel@fooishbar.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>

Notice that the xkey.sh test is changed to match libX11 behavior, i.e.
XKeysymToString(0x1008FE20) -> "XF86Ungrab" as opposed to "XF86_Ungrab".

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-02-26 21:09:37 +02:00
Daniel Stone 3077e97e7c tests: Free returned XKB map
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:38:17 +00:00
Daniel Stone 4e22851141 Introduce xkb_keycode_t for keycodes
And use it consistently everywhere, including with a special long-safe
internal keycode type, to ease the transition to large keycodes.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:24:50 +00:00
Daniel Stone ead9d0cb62 Move include path from X11/extensions/ to xkbcommon/
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:24:50 +00:00
Gaetan Nadon 5e43e7b46c config: distribute the .sh test programs and test data
The test programs and the test data are required in the tarball
and needed for distcheck.

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-18 11:19:57 -05:00
Gaetan Nadon f424bd8f5f config: make it easier to add TEST programs
LDADD is a Makefile wide variable.
Automake matches prog name with .c file by default

Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-18 11:19:57 -05:00
Gaetan Nadon 63e2719a8f config: replace deprecated INCLUDES with AM_CPPFLAGS
Fixes automake warning.

Acked-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-08 15:24:21 -05:00
Gaetan Nadon ceba14dc3e config: update subdirs .gitignore
Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2010-12-07 10:23:18 -05:00
Kristian Høgsberg a84c08795e Use flex for generating the scanner, add support for parsing from strings
Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
2010-10-20 14:03:53 -04:00
Kristian Høgsberg e879828717 Don't return a static buffer in public API 2010-10-08 15:33:18 -04:00
Kristian Høgsberg 97fbc348b0 Rename XkbRMLVOSet to struct xkb_rule_names 2010-07-02 14:21:52 -04:00
Kristian Høgsberg 3f0034a990 Rename public entry points to lowercase and underscore 2010-07-02 12:20:59 -04:00
Kristian Høgsberg 5669e1a82d Compile with -fvisibility=hidden when possible 2010-07-02 12:20:59 -04:00
Kristian Høgsberg 9f6026867a Pull in enough structs and defines from XKBstr.h to only need XKB.h
We want to move away from sharing implementation structs and let libX11
and libxkbcommon use each their own set of structs.
2010-07-02 12:20:54 -04:00
Kristian Høgsberg d95b289367 Make XkbcInitAtoms() call optional 2010-06-30 17:13:21 -04:00
Daniel Stone 2c4a045aca Allow external atom databases
Allow people to plug in an external atom database (e.g. the X server's),
so we don't have to migrate our own atoms over later.  We are a bit
over-keen on atoms at the moment, so it does pollute the atom database a
bit though.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:57:16 +01:00
Daniel Stone 5140250273 Add testcase for XkbcCanonicaliseComponents
Should be reasonably thorough; the shell part is, however, quite
unpleasant.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone a8bb86a48a Test: Keysym: Add tests for new keysym <-> string conversions
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2010-06-22 15:56:55 +01:00
Daniel Stone 8e3239a78f KeySym: Actually handle NoSymbol
Add NoSymbol into the keysym table, so keysym <-> string conversion works for
that, too; also eliminate special-casing of VoidSymbol.

This will require special-casing in libX11 to preserve its API.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-04-25 14:56:57 +10:00
Daniel Stone a5ce9754dc test: Fix srcdir != objdir build and test failures
filecomp would fail because it couldn't find the input files, after
compilation failed due to missing includes.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2009-04-25 14:56:47 +10:00
Dan Nicholson c728d91bde Program and files for testing CompileKeymapFromFile
A few simple test cases for verifying the operation of parsing a keymap
file and compiling a keyboard description from it.
2009-04-10 12:33:31 -07:00
Dan Nicholson e98eb80509 test: Remove extraneous includes
These programs don't actually use the internal API.
2009-04-09 20:52:26 -07:00
Dan Nicholson babae38935 Change CompileKeymapFromRules to take XkbRMLVOSet
Let's use a nice interface now that it's available from XKBrulescommon.h.
2009-04-08 17:54:55 -07:00
Dan Nicholson 6a84a34d86 Remove all non-public API from XKBcommon.h header
The noble intention was to expose all the new API and new generic types
in the split out kbproto headers through XKBcommon.h. It turns out that
would be a massive amount of work in the server. Someday, but first just
wedging in XkbCompileKeymap* would be good.

Most of the API is in new internal xkb*.h headers. In order to allow the
XKBcommon.h header to be used from the server, we can't pull in other
headers from kbproto since the server has its own copies. However, types
that are different (XkbDescRec, XkbAction) still have Xkbc equivalents
here, and I think they should be used in the server.
2009-04-08 07:46:25 -07:00
Dan Nicholson 713c8f418f test: Exercise compiling from components
This could probably use a lot more real world test cases, but it does
the job for now.
2009-04-04 12:54:44 -07:00
Dan Nicholson 4f736db995 test: Minor refactor to allow $EXEEXT in program names 2009-04-04 11:04:35 -07:00
Dan Nicholson 8f9a612990 test: Add logging and some intentionally failing cases
We want to log the output of the tests rather than letting them go to
stderr. This allows tests we expect to fail to be run.
2009-04-04 11:01:58 -07:00
Dan Nicholson 95dbbb8a7b rulescomp: Remove unneeded API 2009-04-04 09:37:53 -07:00
Dan Nicholson 5cc55d7cbb Test compiler to simulate xkbcomp usage
Added a test program, rulescomp, which takes a RMLVO set and generates a
XkbcDescPtr. This is essentially what the xserver will do, except that we
still need to access some xkbcomp internal API to make it work.
2009-04-04 09:14:20 -07:00
Dan Nicholson 1ff77ecd36 Rename headers to XKBcommon* and install in extensions directory
Following the kbproto convention, the headers will be named XKBcommon.h
and XKBcommonint.h. Furthermore, they'll be installed in X11/extensions
directory with the rest of the XKB headers.
2009-03-25 19:40:57 -07:00
Dan Nicholson ffa0ccfad9 Use XORG_CWARNFLAGS for more warnings 2009-03-19 16:25:34 -07:00
Dan Nicholson ba0b312ac8 test: Add tests for XFree86 special keys
Since the XFree86 special keysyms contain an underscore after the XF86
prefix, check to make sure they're handled correctly.
2009-03-19 11:51:10 -07:00
Dan Nicholson 176b9cf524 test: Consistently use upper case hex 2009-03-19 11:51:10 -07:00
Dan Nicholson 49a06f926d test: Add convenience functions for xkey.sh 2009-03-19 11:51:10 -07:00
Dan Nicholson b2737e9bfb Testing harness for keysym functions
A test program and script have been added for checking the XkbCommon
keysym functions. This has already highlighted an error in handling of
keysyms from XF86keysym.h.
2009-03-19 11:51:09 -07:00