test: one engine pump and one preedit check for the white-box suites
server_test, ibus_test and xim_adapter_test each ran their own copy of the same alt loop that stands in for imthread, and two of them had private checkstr/checkenginepreedit variants. test_util.c now provides Pump (trace, optional hold on a chosen op, stop) in its own proc so a test may block in socket I/O while the engine runs, and test.h declares the engine hooks once; every .c includes dat.h and fn.h itself as the rest of the tree does. server_test's three copies of fixture setup and teardown became serverbegin/serverend.
This commit is contained in:
36
tests/test.h
36
tests/test.h
@@ -1,11 +1,43 @@
|
||||
/* Included after dat.h and fn.h (or after the source under test). */
|
||||
#include "cutest/cutest.h"
|
||||
#include "dat.h"
|
||||
#include "fn.h"
|
||||
|
||||
extern Lang testvi;
|
||||
|
||||
/*
|
||||
* A test's stand-in for imthread: handles engine requests from keyc,
|
||||
* tracing each one first. Requests whose op is holdop (every request
|
||||
* when holdop is Pumpall) wait on go before the engine sees them.
|
||||
*/
|
||||
typedef struct Pump Pump;
|
||||
struct Pump
|
||||
{
|
||||
Channel *trace;
|
||||
Channel *go;
|
||||
Channel *stop;
|
||||
Channel *done;
|
||||
int holdop;
|
||||
int active;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
Pumpnone = -1,
|
||||
Pumpall = -2,
|
||||
};
|
||||
|
||||
Str mkstr(char*);
|
||||
int checkstr(struct ct*, char*, char*, Str*);
|
||||
void checkenginepreedit(struct ct*, char*);
|
||||
void pumpstart(Pump*, int);
|
||||
void pumphold(Pump*, int);
|
||||
void pumpstop(Pump*);
|
||||
|
||||
/* Engine internals reached through engine_test.c. */
|
||||
void testengineinit(int);
|
||||
void testenginehandle(Keyreq*);
|
||||
void* testengineowner(void);
|
||||
void testenginepreedit(Str*);
|
||||
void testenginecaret(Caret*);
|
||||
|
||||
void str_init_utf8(struct ct*);
|
||||
void str_edit_and_alias(struct ct*);
|
||||
|
||||
Reference in New Issue
Block a user