changelog shortlog graph tags branches changeset files revisions annotate raw help

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

changeset 696: 38e9c3be2392
parent: 29fe829a7ac3
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 21:11:52 -0400
permissions: -rw-r--r--
description: prep for adding zdict wrapper, change default control stack size of inferior-lisp to 8M
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