/* * Copyright (C) 2010-2011 Daiki Ueno * Copyright (C) 2010-2011 Red Hat, Inc. * Copyright (C) 2019 Purism SPC * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA */ /* For gdk_x11_display_get_xdisplay(). See main(). */ #include #include #include "config.h" #include "eek/eek-xml-layout.h" #include "eek/eek-keyboard.h" #include "src/layout.h" static void test_check_xkb (void) { LevelKeyboard *keyboard = eek_xml_layout_real_create_keyboard("us", NULL); const gchar *keymap_str = squeek_layout_get_keymap(keyboard->layout); struct xkb_context *context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); if (!context) { g_error("No context created"); } struct xkb_keymap *keymap = xkb_keymap_new_from_string(context, keymap_str, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); xkb_context_unref(context); if (!keymap) { g_error("Bad keymap"); } level_keyboard_free(keyboard); } int main (int argc, char **argv) { g_test_init (&argc, &argv, NULL); g_test_add_func ("/test-keymap-generation/check-xkb", test_check_xkb); return g_test_run (); }