SDL Input Method test application

In my effort to familiarise myself with SDL 1.3, I wrote a program
that prints out
the character as you press keyboard keys.
It is based on (it actually just combines) checkkeys.c from SDL 1.3
and showfont.c from SDL_ttf.

It is available from

I wonder if there is a way to write an SDL application so that one
can sent programmatically keystrokes and record the resulting characters.
In order words, something similar to Edgar’s gsoc project but for
input method testing.