2012-07-12 07:15:08 -06:00
|
|
|
/*
|
2012-09-12 09:54:07 -06:00
|
|
|
* Copyright © 2012 Intel Corporation
|
2012-07-12 07:15:08 -06:00
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the next
|
|
|
|
* paragraph) shall be included in all copies or substantial portions of the
|
|
|
|
* Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Author: Daniel Stone <daniel@fooishbar.org>
|
|
|
|
*/
|
|
|
|
|
2012-09-16 05:45:32 -06:00
|
|
|
#include <assert.h>
|
|
|
|
|
2013-03-18 14:55:18 -06:00
|
|
|
/* Don't use compat names in internal code. */
|
2012-09-21 05:44:17 -06:00
|
|
|
#define _XKBCOMMON_COMPAT_H
|
2012-07-12 07:15:08 -06:00
|
|
|
#include "xkbcommon/xkbcommon.h"
|
2014-01-29 04:46:42 -07:00
|
|
|
#include "xkbcommon/xkbcommon-compose.h"
|
2012-07-24 10:54:14 -06:00
|
|
|
#include "utils.h"
|
2012-07-12 07:15:08 -06:00
|
|
|
|
2013-07-30 06:06:40 -06:00
|
|
|
/* Automake test exit code to signify SKIP (à la PASS, FAIL, etc). */
|
|
|
|
#define SKIP_TEST 77
|
|
|
|
|
2023-11-07 04:58:41 -07:00
|
|
|
#define assert_printf(cond, ...) \
|
|
|
|
if (!(cond)) { \
|
|
|
|
fprintf(stderr, "Assertion failure: " __VA_ARGS__); \
|
|
|
|
assert(cond); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define assert_streq_not_null(test_name, expected, got) \
|
|
|
|
assert_printf(streq_not_null(expected, got), \
|
|
|
|
test_name ". Expected \"%s\", got: \"%s\"\n", expected, got)
|
|
|
|
|
2013-03-18 14:55:18 -06:00
|
|
|
/* The offset between KEY_* numbering, and keycodes in the XKB evdev
|
|
|
|
* dataset. */
|
|
|
|
#define EVDEV_OFFSET 8
|
|
|
|
|
|
|
|
enum key_seq_state {
|
|
|
|
DOWN,
|
|
|
|
REPEAT,
|
|
|
|
UP,
|
|
|
|
BOTH,
|
|
|
|
NEXT,
|
|
|
|
FINISH,
|
|
|
|
};
|
|
|
|
|
|
|
|
int
|
|
|
|
test_key_seq(struct xkb_keymap *keymap, ...);
|
|
|
|
|
2013-03-19 04:59:38 -06:00
|
|
|
int
|
|
|
|
test_key_seq_va(struct xkb_keymap *keymap, va_list args);
|
|
|
|
|
2022-09-24 01:27:51 -06:00
|
|
|
char *
|
|
|
|
test_makedir(const char *parent, const char *path);
|
|
|
|
|
|
|
|
char *
|
|
|
|
test_maketempdir(const char *template);
|
|
|
|
|
2013-07-24 02:05:02 -06:00
|
|
|
char *
|
2012-07-12 07:15:08 -06:00
|
|
|
test_get_path(const char *path_rel);
|
|
|
|
|
|
|
|
char *
|
|
|
|
test_read_file(const char *path_rel);
|
|
|
|
|
2013-03-18 15:02:35 -06:00
|
|
|
enum test_context_flags {
|
|
|
|
CONTEXT_NO_FLAG = 0,
|
2013-03-19 04:29:49 -06:00
|
|
|
CONTEXT_ALLOW_ENVIRONMENT_NAMES = (1 << 0),
|
2013-03-18 15:02:35 -06:00
|
|
|
};
|
|
|
|
|
2012-07-12 07:15:08 -06:00
|
|
|
struct xkb_context *
|
2013-03-18 15:02:35 -06:00
|
|
|
test_get_context(enum test_context_flags flags);
|
2012-07-12 07:15:08 -06:00
|
|
|
|
|
|
|
struct xkb_keymap *
|
|
|
|
test_compile_file(struct xkb_context *context, const char *path_rel);
|
|
|
|
|
|
|
|
struct xkb_keymap *
|
|
|
|
test_compile_string(struct xkb_context *context, const char *string);
|
|
|
|
|
2013-03-11 05:53:39 -06:00
|
|
|
struct xkb_keymap *
|
|
|
|
test_compile_buffer(struct xkb_context *context, const char *buf, size_t len);
|
|
|
|
|
2012-07-12 07:15:08 -06:00
|
|
|
struct xkb_keymap *
|
|
|
|
test_compile_rules(struct xkb_context *context, const char *rules,
|
2012-07-17 03:20:15 -06:00
|
|
|
const char *model, const char *layout, const char *variant,
|
|
|
|
const char *options);
|
2013-07-30 04:38:51 -06:00
|
|
|
|
2019-08-05 06:53:04 -06:00
|
|
|
|
2023-04-11 14:24:47 -06:00
|
|
|
#ifdef _WIN32
|
2019-08-05 06:53:04 -06:00
|
|
|
#define setenv(varname, value, overwrite) _putenv_s((varname), (value))
|
|
|
|
#define unsetenv(varname) _putenv_s(varname, "")
|
|
|
|
#endif
|