tests: cover in-process XIM lifecycle

This commit is contained in:
2026-08-14 16:17:27 +09:00
parent f5dc552c08
commit 4eba8c2904
5 changed files with 330 additions and 6 deletions

View File

@@ -2,25 +2,28 @@ CC = 9c
LD = 9l
HOSTCC = cc
CFLAGS = -std=c99 -Wall -Wextra -O2 -g -I.. -I../cutest
TEXT_CFLAGS = $(shell pkg-config --cflags 'pangocairo >= 1.56' 'cairo >= 1.18')
TEXT_LIBS = $(shell pkg-config --libs 'pangocairo >= 1.56' 'cairo >= 1.18')
TEXT_CFLAGS = $(shell pkg-config --cflags pangocairo cairo)
TEXT_LIBS = $(shell pkg-config --libs pangocairo cairo)
DBUS_CFLAGS = $(shell pkg-config --cflags dbus-1)
DBUS_LIBS = $(shell pkg-config --libs dbus-1)
IBUS_CFLAGS = $(shell pkg-config --cflags dbus-1 xkbcommon)
IBUS_LIBS = $(shell pkg-config --libs dbus-1 xkbcommon)
LIBS = -lthread -lbio $(TEXT_LIBS) $(IBUS_LIBS)
XIM_CFLAGS = $(shell pkg-config --cflags xcb-imdkit xkbcommon)
XIM_LIBS = $(shell pkg-config --libs xcb-imdkit xkbcommon)
LIBS = -lthread -lbio $(TEXT_LIBS) $(IBUS_LIBS) $(XIM_LIBS)
PROG = unit_test
LIVE = ibus_live_test ipc_live_test daemon_collision_test daemon_failure_test \
daemon_restart_test
TESTSRC = unit_test.c test_util.c str_test.c hash_test.c trie_test.c \
ko_test.c vi_test.c engine_test.c dict_test.c ipc_test.c \
popup_test.c font_test.c ibus_test.c server_test.c
popup_test.c font_test.c ibus_test.c server_test.c xim_adapter_test.c
TESTOBJ = $(TESTSRC:.c=.o)
PARENTSRC = str.c hash.c trie.c dict.c ko.c vi.c ipc.c popup_layout.c \
font.c
PARENTOBJ = $(PARENTSRC:%.c=unit_%.o)
OBJS = $(TESTOBJ) $(PARENTOBJ)
XIMOBJ = unit_xim_keymap.o unit_ximtext.o
OBJS = $(TESTOBJ) $(PARENTOBJ) $(XIMOBJ)
all: $(PROG) $(LIVE)
@@ -56,9 +59,17 @@ $(TESTOBJ): test.h ../dat.h ../fn.h ../ipc.h ../cutest/cutest.h
engine_test.o: ../strans.c
ibus_test.o: CFLAGS += $(IBUS_CFLAGS)
ibus_test.o: ../ibus.c
xim_adapter_test.o: CFLAGS += $(XIM_CFLAGS)
xim_adapter_test.o: ../xim/xim.c
server_test.o: ../srv.c
unit_font.o: CFLAGS += $(TEXT_CFLAGS)
unit_xim_keymap.o: ../xim/keymap.c
$(CC) $(CFLAGS) $(XIM_CFLAGS) -c -o $@ $<
unit_ximtext.o: ../xim/ximtext.c
$(CC) $(CFLAGS) $(XIM_CFLAGS) -c -o $@ $<
unit_%.o: ../%.c ../dat.h ../fn.h ../ipc.h
$(CC) $(CFLAGS) -c -o $@ $<