engine: look dictionaries up synchronously
The dictionary thread ran in imthread's own proc, so a lookup could only start once the engine blocked, and it was a trie probe anyway; the emoji and Hanja searches already called dictlookup directly. The request/result channels, sequence numbers, staleness checks and the second draw per Japanese key are gone; dictqjp fills the candidates in place. Emit.dict and Lang.dictq only ever triggered lookups for Vietnamese, which has no dictionary. dictlookup(Lang*, key, out, max) returns the count. The Hanja lookup no longer pre-checks for a single syllable; a reading either has an entry or it does not.
This commit is contained in:
@@ -5,33 +5,22 @@ dictionary_candidates(struct ct *t)
|
||||
{
|
||||
char many[512], item[8];
|
||||
char *p;
|
||||
Dictreq req;
|
||||
Dictres res;
|
||||
Str kouho[Maxkouho], key;
|
||||
Trie *saved;
|
||||
Lang *lang;
|
||||
Str key;
|
||||
int i;
|
||||
int i, n;
|
||||
|
||||
lang = getlang(LangJP);
|
||||
saved = lang->dict;
|
||||
lang->dict = trienew();
|
||||
key = mkstr("かな");
|
||||
trieput(lang->dict, "かな", strlen("かな"), " 候補1 かな 候補2 ",
|
||||
strlen(" 候補1 かな 候補2 "));
|
||||
memset(&req, 0, sizeof req);
|
||||
req.key = key;
|
||||
req.pre = mkstr("preedit-one");
|
||||
req.lang = LangJP;
|
||||
req.seq = 17;
|
||||
dictlookup(&req, &res);
|
||||
if(!CT_EQ_INT(t, 2, res.nkouho))
|
||||
goto cleanup;
|
||||
CT_EQ_INT(t, LangJP, res.lang);
|
||||
CT_EQ_UINT(t, 17, res.seq);
|
||||
CT_EQ_INT(t, 0, scmp(&req.pre, &res.key));
|
||||
checkstr(t, "candidate 1", "候補1", &res.kouho[0]);
|
||||
checkstr(t, "candidate 2", "候補2", &res.kouho[1]);
|
||||
key = mkstr("key");
|
||||
key = mkstr("かな");
|
||||
n = dictlookup(lang, &key, kouho, Maxkouho);
|
||||
if(CT_EQ_INT(t, 2, n)){
|
||||
checkstr(t, "candidate 1", "候補1", &kouho[0]);
|
||||
checkstr(t, "candidate 2", "候補2", &kouho[1]);
|
||||
}
|
||||
p = many;
|
||||
for(i = 0; i < Maxkouho+1; i++){
|
||||
snprint(item, sizeof item, "c%02d", i);
|
||||
@@ -42,56 +31,32 @@ dictionary_candidates(struct ct *t)
|
||||
}
|
||||
*p = '\0';
|
||||
trieput(lang->dict, "key", 3, many, strlen(many));
|
||||
req.key = key;
|
||||
req.pre = mkstr("preedit-two");
|
||||
req.seq = 29;
|
||||
dictlookup(&req, &res);
|
||||
if(!CT_EQ_INT(t, Maxkouho, res.nkouho))
|
||||
goto cleanup;
|
||||
CT_EQ_INT(t, LangJP, res.lang);
|
||||
CT_EQ_UINT(t, 29, res.seq);
|
||||
CT_EQ_INT(t, 0, scmp(&req.pre, &res.key));
|
||||
checkstr(t, "first capped candidate", "c00", &res.kouho[0]);
|
||||
checkstr(t, "last capped candidate", "c31", &res.kouho[31]);
|
||||
cleanup:
|
||||
key = mkstr("key");
|
||||
n = dictlookup(lang, &key, kouho, Maxkouho);
|
||||
if(CT_EQ_INT(t, Maxkouho, n)){
|
||||
checkstr(t, "first capped candidate", "c00", &kouho[0]);
|
||||
checkstr(t, "last capped candidate", "c31", &kouho[31]);
|
||||
}
|
||||
CT_EQ_INT(t, 3, dictlookup(lang, &key, kouho, 3));
|
||||
trieclose(lang->dict);
|
||||
lang->dict = saved;
|
||||
}
|
||||
|
||||
void
|
||||
dictionary_misses_clear_result(struct ct *t)
|
||||
dictionary_misses(struct ct *t)
|
||||
{
|
||||
static const struct {
|
||||
char *name;
|
||||
char *key;
|
||||
char *pre;
|
||||
} cases[] = {
|
||||
{ "empty key", "", "empty-preedit" },
|
||||
{ "missing key", "missing", "missing-preedit" },
|
||||
};
|
||||
Dictreq req;
|
||||
Dictres res;
|
||||
Str kouho[Maxkouho], key;
|
||||
Trie *saved;
|
||||
Lang *lang;
|
||||
int i;
|
||||
|
||||
lang = getlang(LangJP);
|
||||
saved = lang->dict;
|
||||
lang->dict = trienew();
|
||||
for(i = 0; i < nelem(cases); i++){
|
||||
memset(&res, 0xa5, sizeof res);
|
||||
req.key = mkstr(cases[i].key);
|
||||
req.pre = mkstr(cases[i].pre);
|
||||
req.lang = LangJP;
|
||||
req.seq = 0xf00d0000U + i;
|
||||
dictlookup(&req, &res);
|
||||
if(res.nkouho != 0)
|
||||
CT_ERRORF(t, "%s: want 0 candidates, got %d",
|
||||
cases[i].name, res.nkouho);
|
||||
CT_EQ_INT(t, LangJP, res.lang);
|
||||
CT_EQ_UINT(t, 0xf00d0000U + i, res.seq);
|
||||
checkstr(t, cases[i].name, cases[i].pre, &res.key);
|
||||
}
|
||||
key = mkstr("");
|
||||
CT_EQ_INT(t, 0, dictlookup(lang, &key, kouho, Maxkouho));
|
||||
key = mkstr("missing");
|
||||
CT_EQ_INT(t, 0, dictlookup(lang, &key, kouho, Maxkouho));
|
||||
CT_EQ_INT(t, 0, dictlookup(getlang(LangKO), &key, kouho, Maxkouho));
|
||||
trieclose(lang->dict);
|
||||
lang->dict = saved;
|
||||
}
|
||||
@@ -99,25 +64,17 @@ dictionary_misses_clear_result(struct ct *t)
|
||||
void
|
||||
dictionary_emoji_identity(struct ct *t)
|
||||
{
|
||||
Dictreq req;
|
||||
Dictres res;
|
||||
Str kouho[Maxkouho], key;
|
||||
Trie *saved;
|
||||
Lang *lang;
|
||||
Str key;
|
||||
|
||||
lang = getlang(LangEMOJI);
|
||||
saved = lang->dict;
|
||||
lang->dict = trienew();
|
||||
key = mkstr("é");
|
||||
trieput(lang->dict, "é", strlen("é"), "é", strlen("é"));
|
||||
memset(&req, 0, sizeof req);
|
||||
req.key = key;
|
||||
req.pre = key;
|
||||
req.lang = LangEMOJI;
|
||||
req.seq = 0;
|
||||
dictlookup(&req, &res);
|
||||
if(CT_EQ_INT(t, 1, res.nkouho))
|
||||
checkstr(t, "emoji identity candidate", "é", &res.kouho[0]);
|
||||
key = mkstr("é");
|
||||
if(CT_EQ_INT(t, 1, dictlookup(lang, &key, kouho, Maxkouho)))
|
||||
checkstr(t, "emoji identity candidate", "é", &kouho[0]);
|
||||
trieclose(lang->dict);
|
||||
lang->dict = saved;
|
||||
}
|
||||
|
||||
@@ -165,37 +165,6 @@ engine_candidate_shortcut_modifiers(struct ct *t)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
engine_dictionary_queue_latest_wins(struct ct *t)
|
||||
{
|
||||
Channel *saved;
|
||||
Dictreq old, got;
|
||||
Str key;
|
||||
|
||||
saved = dictreqc;
|
||||
dictreqc = chancreate(sizeof(Dictreq), 1);
|
||||
memset(&old, 0, sizeof old);
|
||||
old.key = mkstr("old-key");
|
||||
old.pre = mkstr("old-preedit");
|
||||
old.lang = LangJP;
|
||||
old.seq = 0;
|
||||
CT_CHECK(t, channbsend(dictreqc, &old) > 0);
|
||||
init();
|
||||
im.l = getlang(LangJP);
|
||||
im.pre = mkstr("new-preedit");
|
||||
key = mkstr("new-key");
|
||||
dictsend(&im, &key);
|
||||
if(CT_CHECK(t, channbrecv(dictreqc, &got) > 0)){
|
||||
checkstr(t, "newest dictionary key", "new-key", &got.key);
|
||||
checkstr(t, "newest dictionary preedit", "new-preedit", &got.pre);
|
||||
CT_EQ_INT(t, LangJP, got.lang);
|
||||
CT_EQ_UINT(t, dictseq, got.seq);
|
||||
}
|
||||
CT_CHECK(t, channbrecv(dictreqc, &got) <= 0);
|
||||
chanfree(dictreqc);
|
||||
dictreqc = saved;
|
||||
}
|
||||
|
||||
static Keyres
|
||||
ownerrequestatcap(void *owner, int cap, int op, Rune key, u32int mod,
|
||||
Caret *caret)
|
||||
@@ -306,66 +275,6 @@ engine_active_owner_reset(struct ct *t)
|
||||
checkstr(t, "same owner after reset", "ん", &res.preedit);
|
||||
}
|
||||
|
||||
void
|
||||
engine_rejects_stale_dictionary_results(struct ct *t)
|
||||
{
|
||||
Dictreq a, b;
|
||||
Dictres res;
|
||||
Trie *saved;
|
||||
Lang *jp;
|
||||
char one, two;
|
||||
int n;
|
||||
|
||||
jp = getlang(LangJP);
|
||||
saved = jp->dict;
|
||||
jp->dict = trienew();
|
||||
init();
|
||||
im.l = jp;
|
||||
while(channbrecv(dictreqc, &a) > 0)
|
||||
;
|
||||
ownerrequest(&one, Keypress, 'k', 0);
|
||||
ownerrequest(&one, Keypress, 'a', 0);
|
||||
n = 0;
|
||||
while(channbrecv(dictreqc, &a) > 0)
|
||||
n++;
|
||||
if(!CT_CHECK(t, n > 0))
|
||||
goto cleanup;
|
||||
ownerrequest(&one, Keyreset, 0, 0);
|
||||
ownerrequest(&two, Keypress, 'k', 0);
|
||||
ownerrequest(&two, Keypress, 'a', 0);
|
||||
n = 0;
|
||||
while(channbrecv(dictreqc, &b) > 0)
|
||||
n++;
|
||||
if(!CT_CHECK(t, n > 0))
|
||||
goto cleanup;
|
||||
CT_EQ_INT(t, 0, scmp(&a.key, &b.key));
|
||||
CT_EQ_INT(t, 0, scmp(&a.pre, &b.pre));
|
||||
CT_EQ_INT(t, a.lang, b.lang);
|
||||
CT_CHECK(t, a.seq != b.seq);
|
||||
|
||||
memset(&res, 0, sizeof res);
|
||||
res.key = a.pre;
|
||||
res.lang = a.lang;
|
||||
res.seq = a.seq;
|
||||
res.kouho[0] = mkstr("stale");
|
||||
res.nkouho = 1;
|
||||
dictresult(&res);
|
||||
CT_EQ_INT(t, 0, im.nkouho);
|
||||
|
||||
res.key = b.pre;
|
||||
res.lang = b.lang;
|
||||
res.seq = b.seq;
|
||||
res.kouho[0] = mkstr("current");
|
||||
dictresult(&res);
|
||||
if(CT_EQ_INT(t, 1, im.nkouho))
|
||||
checkstr(t, "current dictionary result", "current", &im.kouho[0]);
|
||||
cleanup:
|
||||
while(channbrecv(dictreqc, &a) > 0)
|
||||
;
|
||||
trieclose(jp->dict);
|
||||
jp->dict = saved;
|
||||
}
|
||||
|
||||
void
|
||||
engine_active_owner_caret(struct ct *t)
|
||||
{
|
||||
@@ -660,7 +569,6 @@ engine_direct_language_modes(struct ct *t)
|
||||
CT_EQ_PTR(t, nil, im.l->mapname);
|
||||
CT_EQ_PTR(t, nil, im.l->map);
|
||||
CT_EQ_PTR(t, nil, im.l->dictname);
|
||||
CT_EQ_PTR(t, nil, im.l->dictq);
|
||||
CT_CHECK(t, strcmp(getlang(LangHANJA)->dictname, "hanja") == 0);
|
||||
CT_CHECK(t, keystroke('r', 0, &com));
|
||||
checkstr(t, "Korean without map", "ㄱ", &im.pre);
|
||||
@@ -789,17 +697,16 @@ draindraw(Drawcmd *last)
|
||||
static void
|
||||
setcandidates(int n)
|
||||
{
|
||||
Dictres res;
|
||||
char name[8];
|
||||
int i;
|
||||
|
||||
memset(&res, 0, sizeof res);
|
||||
clearkouho();
|
||||
for(i = 0; i < n; i++){
|
||||
snprint(name, sizeof name, "c%d", i+1);
|
||||
res.kouho[i] = mkstr(name);
|
||||
im.kouho[i] = mkstr(name);
|
||||
}
|
||||
res.nkouho = n;
|
||||
setkouho(&res);
|
||||
im.nkouho = n;
|
||||
selectfirst();
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -929,31 +836,20 @@ void
|
||||
engine_candidate_completion(struct ct *t)
|
||||
{
|
||||
static Rune keys[] = { Kret, Ktab };
|
||||
Dictres res;
|
||||
Str com;
|
||||
int arrived, i;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < nelem(keys); i++)
|
||||
for(arrived = 0; arrived < 2; arrived++){
|
||||
init();
|
||||
im.l = getlang(LangJP);
|
||||
im.pre = mkstr("reading");
|
||||
memset(&res, 0, sizeof res);
|
||||
res.key = im.pre;
|
||||
res.lang = LangJP;
|
||||
res.seq = dictseq;
|
||||
res.kouho[0] = mkstr("candidate");
|
||||
res.nkouho = 1;
|
||||
if(arrived)
|
||||
dictresult(&res);
|
||||
sclear(&com);
|
||||
CT_CHECK(t, keystroke(keys[i], 0, &com));
|
||||
if(!arrived)
|
||||
dictresult(&res);
|
||||
checkstr(t, "unselected candidate commits reading",
|
||||
"reading", &com);
|
||||
CT_EQ_INT(t, 0, im.nkouho);
|
||||
}
|
||||
for(i = 0; i < nelem(keys); i++){
|
||||
init();
|
||||
im.l = getlang(LangJP);
|
||||
im.pre = mkstr("reading");
|
||||
setcandidates(1);
|
||||
sclear(&com);
|
||||
CT_CHECK(t, keystroke(keys[i], 0, &com));
|
||||
checkstr(t, "unselected candidate commits reading",
|
||||
"reading", &com);
|
||||
CT_EQ_INT(t, 0, im.nkouho);
|
||||
}
|
||||
|
||||
candidatebegin(2);
|
||||
im.pre = mkstr("reading");
|
||||
@@ -1047,24 +943,22 @@ searchend(Searchfix *f)
|
||||
void
|
||||
engine_popup_preedit_capability(struct ct *t)
|
||||
{
|
||||
Dictres res;
|
||||
Drawcmd dc;
|
||||
Keyres kres;
|
||||
Lang *jp;
|
||||
Trie *saved;
|
||||
char client, inactive;
|
||||
|
||||
jp = getlang(LangJP);
|
||||
saved = jp->dict;
|
||||
jp->dict = trienew();
|
||||
setdict(jp->dict, "か", "家");
|
||||
init();
|
||||
im.l = getlang(LangJP);
|
||||
im.l = jp;
|
||||
draindraw(nil);
|
||||
ownerrequestcap(&client, Cclientpreedit, Keypress, 'k', 0);
|
||||
ownerrequestcap(&client, Cclientpreedit, Keypress, 'a', 0);
|
||||
memset(&res, 0, sizeof res);
|
||||
res.lang = LangJP;
|
||||
res.key = mkstr("か");
|
||||
res.seq = dictseq;
|
||||
res.kouho[0] = mkstr("家");
|
||||
res.nkouho = 1;
|
||||
dictresult(&res);
|
||||
im.sel = 0;
|
||||
CT_EQ_INT(t, 1, im.nkouho);
|
||||
redraw();
|
||||
if(CT_CHECK(t, draindraw(&dc) > 0)){
|
||||
CT_EQ_INT(t, 0, dc.pre.n);
|
||||
@@ -1115,6 +1009,8 @@ engine_popup_preedit_capability(struct ct *t)
|
||||
|
||||
ownerrequest(&client, Keyrelease, 0, 0);
|
||||
draindraw(nil);
|
||||
trieclose(jp->dict);
|
||||
jp->dict = saved;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1124,9 +1020,6 @@ hanjabegin(Searchfix *f, int lang)
|
||||
f->dictlang->dict = trienew();
|
||||
setdict(f->dictlang->dict, "한", "漢 韓");
|
||||
setdict(f->dictlang->dict, "가", "家");
|
||||
setdict(f->dictlang->dict, "ㄱ", "假");
|
||||
setdict(f->dictlang->dict, "한글", "文");
|
||||
setdict(f->dictlang->dict, "か", "仮");
|
||||
init();
|
||||
im.l = getlang(lang);
|
||||
}
|
||||
@@ -1182,22 +1075,9 @@ engine_japanese_readings(struct ct *t)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
newestrequest(Dictreq *req)
|
||||
{
|
||||
int n;
|
||||
|
||||
n = 0;
|
||||
while(channbrecv(dictreqc, req) > 0)
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
||||
void
|
||||
engine_japanese_candidates(struct ct *t)
|
||||
{
|
||||
Dictreq req;
|
||||
Dictres res;
|
||||
Trie *saved;
|
||||
Lang *jp;
|
||||
Str com, shown;
|
||||
@@ -1213,12 +1093,6 @@ engine_japanese_candidates(struct ct *t)
|
||||
goto cleanup;
|
||||
shown = shownpre(&im);
|
||||
checkstr(t, "complete Japanese reading", "かんじ", &shown);
|
||||
if(!CT_CHECK(t, newestrequest(&req) > 0))
|
||||
goto cleanup;
|
||||
checkstr(t, "dictionary lookup key", "かんじ", &req.key);
|
||||
checkstr(t, "dictionary request identity", "かんじ", &req.pre);
|
||||
dictlookup(&req, &res);
|
||||
dictresult(&res);
|
||||
if(!CT_EQ_INT(t, 2, im.nkouho))
|
||||
goto cleanup;
|
||||
CT_EQ_INT(t, 0, im.sel);
|
||||
@@ -1228,8 +1102,17 @@ engine_japanese_candidates(struct ct *t)
|
||||
CT_EQ_INT(t, 1, im.sel);
|
||||
CT_CHECK(t, keystroke(Kret, 0, &com));
|
||||
checkstr(t, "selected Kanji", "幹事", &com);
|
||||
CT_EQ_INT(t, 0, im.nkouho);
|
||||
/* Backspace looks a complete shorter reading up again. */
|
||||
setdict(jp->dict, "かん", "缶");
|
||||
if(!typekeys(t, "kanji", &com))
|
||||
goto cleanup;
|
||||
CT_CHECK(t, keystroke(Kback, 0, &com));
|
||||
CT_EQ_INT(t, 0, im.nkouho);
|
||||
CT_CHECK(t, keystroke(Kback, 0, &com));
|
||||
if(CT_EQ_INT(t, 1, im.nkouho))
|
||||
checkstr(t, "shorter reading candidate", "缶", &im.kouho[0]);
|
||||
cleanup:
|
||||
newestrequest(&req);
|
||||
trieclose(jp->dict);
|
||||
jp->dict = saved;
|
||||
}
|
||||
@@ -1294,11 +1177,9 @@ engine_katakana_sequences(struct ct *t)
|
||||
{ "xu", "ゥ" },
|
||||
{ "vu", "ヴ" },
|
||||
};
|
||||
Dictreq req;
|
||||
Str com, shown;
|
||||
int i;
|
||||
|
||||
newestrequest(&req);
|
||||
for(i = 0; i < nelem(cases); i++){
|
||||
init();
|
||||
im.l = getlang(LangJPK);
|
||||
@@ -1308,10 +1189,10 @@ engine_katakana_sequences(struct ct *t)
|
||||
checkstr(t, cases[i].keys, "", &com);
|
||||
shown = shownpre(&im);
|
||||
checkstr(t, cases[i].keys, cases[i].want, &shown);
|
||||
CT_EQ_INT(t, 0, im.nkouho);
|
||||
CT_CHECK(t, keystroke(Kret, 0, &com));
|
||||
checkstr(t, "committed Katakana", cases[i].want, &com);
|
||||
}
|
||||
CT_EQ_INT(t, 0, newestrequest(&req));
|
||||
CT_EQ_PTR(t, nil, getlang(LangJPK)->dictname);
|
||||
}
|
||||
|
||||
@@ -1692,48 +1573,6 @@ engine_emoji_start_and_unknown(struct ct *t)
|
||||
searchend(&f);
|
||||
}
|
||||
|
||||
void
|
||||
engine_emoji_dictionary_identity(struct ct *t)
|
||||
{
|
||||
Dictres res;
|
||||
Searchfix f;
|
||||
|
||||
emojibegin(&f, 0);
|
||||
im.pre = mkstr("same");
|
||||
im.kouho[0] = mkstr("old");
|
||||
im.nkouho = 1;
|
||||
im.sel = 0;
|
||||
memset(&res, 0, sizeof res);
|
||||
res.key = im.pre;
|
||||
res.seq = dictseq;
|
||||
res.kouho[0] = mkstr("wrong");
|
||||
res.nkouho = 1;
|
||||
res.lang = LangJP;
|
||||
dictresult(&res);
|
||||
CT_EQ_INT(t, 1, im.nkouho);
|
||||
checkstr(t, "wrong language ignored", "old", &im.kouho[0]);
|
||||
|
||||
res.lang = LangKO;
|
||||
res.key = mkstr("other");
|
||||
dictresult(&res);
|
||||
CT_EQ_INT(t, 1, im.nkouho);
|
||||
checkstr(t, "wrong preedit ignored", "old", &im.kouho[0]);
|
||||
|
||||
res.key = im.pre;
|
||||
search.lang = LangEMOJI;
|
||||
dictresult(&res);
|
||||
CT_EQ_INT(t, 1, im.nkouho);
|
||||
checkstr(t, "search response ignored", "old", &im.kouho[0]);
|
||||
|
||||
search.lang = 0;
|
||||
res.kouho[0] = mkstr("right");
|
||||
dictresult(&res);
|
||||
CT_EQ_INT(t, 1, im.nkouho);
|
||||
CT_EQ_INT(t, 0, im.sel);
|
||||
checkstr(t, "matching response accepted", "right", &im.kouho[0]);
|
||||
searchend(&f);
|
||||
}
|
||||
|
||||
void
|
||||
engine_hanja_search(struct ct *t)
|
||||
{
|
||||
|
||||
@@ -33,10 +33,8 @@ void engine_candidate_page_metadata(struct ct*);
|
||||
void engine_candidate_page_snapshots(struct ct*);
|
||||
void engine_candidate_page_movement(struct ct*);
|
||||
void engine_candidate_completion(struct ct*);
|
||||
void engine_dictionary_queue_latest_wins(struct ct*);
|
||||
void engine_active_owner_lifecycle(struct ct*);
|
||||
void engine_active_owner_reset(struct ct*);
|
||||
void engine_rejects_stale_dictionary_results(struct ct*);
|
||||
void engine_active_owner_caret(struct ct*);
|
||||
void engine_popup_preedit_capability(struct ct*);
|
||||
void engine_vietnamese_client_preedit(struct ct*);
|
||||
@@ -57,7 +55,6 @@ void engine_emoji_navigation(struct ct*);
|
||||
void engine_search_candidate_keys(struct ct*);
|
||||
void engine_emoji_preedit_languages(struct ct*);
|
||||
void engine_emoji_start_and_unknown(struct ct*);
|
||||
void engine_emoji_dictionary_identity(struct ct*);
|
||||
void engine_hanja_search(struct ct*);
|
||||
void engine_hanja_unknown_and_cancel(struct ct*);
|
||||
void engine_hanja_korean_keys(struct ct*);
|
||||
@@ -66,7 +63,7 @@ void engine_hanja_input_languages(struct ct*);
|
||||
void engine_randomized_stress(struct ct*);
|
||||
void engine_full_boundary_passthrough(struct ct*);
|
||||
void dictionary_candidates(struct ct*);
|
||||
void dictionary_misses_clear_result(struct ct*);
|
||||
void dictionary_misses(struct ct*);
|
||||
void dictionary_emoji_identity(struct ct*);
|
||||
void ipc_masks_modifiers(struct ct*);
|
||||
void ipc_control_and_caret_frames(struct ct*);
|
||||
|
||||
@@ -99,13 +99,12 @@ transmap_states(struct ct *t)
|
||||
int eat;
|
||||
char *emit;
|
||||
char *next;
|
||||
char *mapped;
|
||||
} cases[] = {
|
||||
{ "", 'k', 1, "", "k", "" },
|
||||
{ "k", 'a', 1, "", "ka", "か" },
|
||||
{ "ka", 's', 1, "か", "s", "" },
|
||||
{ "ka", 'q', 0, "か", "", "" },
|
||||
{ "k", 'q', 0, "k", "", "" },
|
||||
{ "", 'k', 1, "", "k" },
|
||||
{ "k", 'a', 1, "", "ka" },
|
||||
{ "ka", 's', 1, "か", "s" },
|
||||
{ "ka", 'q', 0, "か", "" },
|
||||
{ "k", 'q', 0, "k", "" },
|
||||
};
|
||||
Emit e;
|
||||
Im state;
|
||||
@@ -125,7 +124,6 @@ transmap_states(struct ct *t)
|
||||
i, cases[i].eat, e.eat);
|
||||
checkstr(t, "emit", cases[i].emit, &e.s);
|
||||
checkstr(t, "next", cases[i].next, &e.next);
|
||||
checkstr(t, "mapped", cases[i].mapped, &e.dict);
|
||||
}
|
||||
trieclose(fixture);
|
||||
state.l->map = saved;
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
|
||||
Channel *drawc;
|
||||
Channel *keyc;
|
||||
Channel *dictreqc;
|
||||
Channel *dictresc;
|
||||
Lang testvi;
|
||||
|
||||
void
|
||||
@@ -88,10 +86,8 @@ static const struct ct_test tests[] = {
|
||||
{ "engine/candidate-page-snapshots", engine_candidate_page_snapshots },
|
||||
{ "engine/candidate-page-movement", engine_candidate_page_movement },
|
||||
{ "engine/candidate-completion", engine_candidate_completion },
|
||||
{ "engine/dictionary-queue-latest", engine_dictionary_queue_latest_wins },
|
||||
{ "engine/active-owner-lifecycle", engine_active_owner_lifecycle },
|
||||
{ "engine/active-owner-reset", engine_active_owner_reset },
|
||||
{ "engine/rejects-stale-dictionary", engine_rejects_stale_dictionary_results },
|
||||
{ "engine/active-owner-caret", engine_active_owner_caret },
|
||||
{ "engine/popup-preedit-capability", engine_popup_preedit_capability },
|
||||
{ "engine/vietnamese-client-preedit", engine_vietnamese_client_preedit },
|
||||
@@ -112,7 +108,6 @@ static const struct ct_test tests[] = {
|
||||
{ "engine/search-candidate-keys", engine_search_candidate_keys },
|
||||
{ "engine/emoji-preedit-languages", engine_emoji_preedit_languages },
|
||||
{ "engine/emoji-start-and-unknown", engine_emoji_start_and_unknown },
|
||||
{ "engine/emoji-dictionary-identity", engine_emoji_dictionary_identity },
|
||||
{ "engine/hanja-search", engine_hanja_search },
|
||||
{ "engine/hanja-unknown-cancel", engine_hanja_unknown_and_cancel },
|
||||
{ "engine/hanja-korean-keys", engine_hanja_korean_keys },
|
||||
@@ -120,7 +115,7 @@ static const struct ct_test tests[] = {
|
||||
{ "engine/hanja-input-languages", engine_hanja_input_languages },
|
||||
{ "engine/full-boundary-passthrough", engine_full_boundary_passthrough },
|
||||
{ "dict/candidates", dictionary_candidates },
|
||||
{ "dict/misses-clear-result", dictionary_misses_clear_result },
|
||||
{ "dict/misses", dictionary_misses },
|
||||
{ "dict/emoji-identity", dictionary_emoji_identity },
|
||||
{ "ipc/masks-modifiers", ipc_masks_modifiers },
|
||||
{ "ipc/control-caret-frames", ipc_control_and_caret_frames },
|
||||
@@ -166,8 +161,6 @@ threadmain(int argc, char **argv)
|
||||
|
||||
drawc = chancreate(sizeof(Drawcmd), 4);
|
||||
keyc = chancreate(sizeof(Keyreq), 0);
|
||||
dictreqc = chancreate(sizeof(Dictreq), 64);
|
||||
dictresc = chancreate(sizeof(Dictres), 0);
|
||||
testmapinit();
|
||||
status = CT_RUN_ARGS(tests, argc, argv);
|
||||
for(i = 0; i < nlang; i++){
|
||||
@@ -178,7 +171,5 @@ threadmain(int argc, char **argv)
|
||||
testvi.map = nil;
|
||||
chanfree(drawc);
|
||||
chanfree(keyc);
|
||||
chanfree(dictreqc);
|
||||
chanfree(dictresc);
|
||||
threadexitsall(status == 0 ? nil : "tests failed");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user