fix: retain the newest dictionary request
This commit is contained in:
@@ -108,6 +108,53 @@ engine_selects_visible_candidate(struct ct *t)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
engine_candidate_shortcut_modifiers(struct ct *t)
|
||||
{
|
||||
static u32int mods[] = { Mctrl, Malt, Msuper };
|
||||
Str com;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < nelem(mods); i++){
|
||||
init();
|
||||
im.kouho[0] = mkstr("must-not-select");
|
||||
im.nkouho = 1;
|
||||
im.sel = -1;
|
||||
sclear(&com);
|
||||
CT_CHECK(t, !keystroke('1', mods[i], &com));
|
||||
CT_CHECK(t, scmp(&com, &im.kouho[0]) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
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_CHECK(t, channbrecv(dictreqc, &got) <= 0);
|
||||
chanfree(dictreqc);
|
||||
dictreqc = saved;
|
||||
}
|
||||
|
||||
void
|
||||
engine_commit_contract(struct ct *t)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user