Commit Graph

26 Commits (9308a460395679aa3cb403211146e4ff9b920992)

Author SHA1 Message Date
Daniel Stone 9308a46039 Run source tree through uncrustify
.uncrustify.cfg committed for future reference also, but had to manually
fix up a few things: it really likes justifying struct initialisers.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-17 10:20:15 +01:00
Daniel Stone 3e86ebca06 Add a library of common test functions
Including creating a context (will come in useful soon), opening and
reading files, and compiling keymaps.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-12 14:48:22 +01:00
Daniel Stone 059c1842ef Move test data files to test/data/keymaps
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-07-12 14:14:50 +01:00
Ran Benita b89b8e7023 Change xkb_map_new_from_fd to use FILE*
i.e. xkb_map_new_from_file. The reason is that flex only works with
FILE's, so we must use fdopen on the file descriptor; but to avoid a
memory leak, we must also fclose() it, which, in turn, closes the file
descriptor itself.

Either way is not acceptable, so we can either:
* dup() the fd and use fdopen on that, or
* have the user call fdopen on his own, and accept a FILE* instead of an
  fd.

The second one seems better, and is standard C, so why not. We must add
stdio.h to xkbcommon.h though, which is regrettable, but not a big deal.

Signed-off-by: Ran Benita <ran234@gmail.com>
2012-05-18 20:54:33 +03:00
Daniel Stone 7b00485a6b Rename 'ctx' back to 'context' in external API
Still keep things as 'ctx' internally so we don't have to worry about
typing it too often, but rename the user-visible API back as it was
kinda ugly.

This partially reverts e7bb1e5f.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-11 15:03:43 +01:00
Ran Benita e7bb1e5fd9 Shorten context to ctx
(This breaks the API.)

"context" is really annoying to type all the time (and we're going to
type it a lot more :). "ctx" is clear, concise and common in many other
libraries. Use it!

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

[daniels: Fix for xkb -> keymap change.]
2012-05-09 17:52:26 +01:00
Daniel Stone 38cb639082 Change all 'xkb' xkb_keymap names to 'keymap'
To make it a bit more clear what it actually is.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-09 15:17:25 +01:00
Daniel Stone c358428009 Add flags to context creation
None defined as yet, but why not.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 17:51:16 +01:00
Daniel Stone b537b5524a Add flags to keymap compilation entrypoints
No use as yet, but might as well ...

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-05-08 17:48:29 +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
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
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 3077e97e7c tests: Free returned XKB map
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
2012-02-15 16:38:17 +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
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 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
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