changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/ffi/xkb/tests.lisp

changeset 684: 29fe829a7ac3
parent: 2d1fe1d7b738
child: 38e9c3be2392
author: Richard Westhaver <ellis@rwest.io>
date: Sun, 29 Sep 2024 00:31:24 -0400
permissions: -rw-r--r--
description: evdev and io/kbd
1 (defpackage :xkb/tests
2  (:use :cl :rt :std :xkb))
3 (in-package :xkb/tests)
4 (defsuite :xkb)
5 (in-suite :xkb)
6 
7 (load-xkbcommon)
8 
9 (deftest xkb-basic ()
10  (is (= xkb:xkb-keysym-max 536870911))
11  (let* ((ctx (xkb:xkb-context-new (xkb-context-flags :no-flags)))
12  (map (xkb::xkb-keymap-new-from-names ctx nil (xkb::xkb-keymap-compile-flags :no-flags)))
13  (state (xkb::xkb-state-new map)))
14  (sb-alien:with-alien ((buf (* sb-alien:char) (sb-alien:make-alien char 64)))
15  (xkb::xkb-keysym-get-name (xkb::xkb-state-key-get-one-sym state 10) buf 64)
16  (is (string= "1" (sb-alien:cast buf sb-alien:c-string))))
17  (sb-alien:with-alien ((syms (* (* xkb-keysym)) (sb-alien:make-alien (* xkb-keysym) 20)))
18  (is (= 1 (xkb::xkb-state-key-get-syms state 10 syms)))
19  (is (= 49 (sb-alien:deref (sb-alien:deref syms 0)))))))
20