void test_del_bopomofo_as_mode_switch() { ChewingContext *ctx; clean_userphrase(); ctx = chewing_new(); start_testcase(ctx, fd); type_keystroke_by_string(ctx, "2k"); /* ㄉㄜ */ ok_bopomofo_buffer(ctx, "\xe3\x84\x89\xe3\x84\x9c" /* ㄉㄜ */ ); ok_preedit_buffer(ctx, ""); chewing_set_ChiEngMode(ctx, SYMBOL_MODE); ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, ""); chewing_set_ChiEngMode(ctx, CHINESE_MODE); type_keystroke_by_string(ctx, "ji"); /* ㄨㄛ */ ok_bopomofo_buffer(ctx, "\xe3\x84\xa8\xe3\x84\x9b" /* ㄨㄛ */ ); ok_preedit_buffer(ctx, ""); chewing_set_ChiEngMode(ctx, SYMBOL_MODE); ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, ""); chewing_delete(ctx); }
void test_select_candidate_4_bytes_utf8() { ChewingContext *ctx; remove( TEST_HASH_DIR PLAT_SEPARATOR HASH_FILE ); ctx = chewing_new(); chewing_set_maxChiSymbolLen( ctx, 16 ); chewing_set_phraseChoiceRearward( ctx, 1 ); chewing_set_autoShiftCur( ctx, 1 ); type_keystroke_by_string( ctx, "2k62k6" ); /* ㄉㄜˊ ㄉㄜˊ */ ok_preedit_buffer( ctx, "\xE5\xBE\x97\xE5\xBE\x97" /* 得得 */ ); type_keystroke_by_string( ctx, "<H>" ); type_keystroke_by_string( ctx, "<D>8" ); ok_preedit_buffer( ctx, "\xF0\xA2\x94\xA8\xE5\xBE\x97" /* 𢔨得 */ ); type_keystroke_by_string( ctx, "<D>8" ); ok_preedit_buffer( ctx, "\xF0\xA2\x94\xA8\xF0\xA2\x94\xA8" /* 𢔨𢔨 */ ); chewing_delete( ctx ); }
void test_Capslock() { ChewingContext *ctx; int mode; ctx = chewing_new(); start_testcase(ctx, fd); mode = chewing_get_ChiEngMode(ctx); ok(mode == CHINESE_MODE, "mode shall be CHINESE_MODE"); type_keystroke_by_string(ctx, "ji"); /* ㄨㄛ */ ok_bopomofo_buffer(ctx, "\xe3\x84\xa8\xe3\x84\x9b" /* ㄨㄛ */ ); ok_preedit_buffer(ctx, ""); ok_commit_buffer(ctx, ""); type_keystroke_by_string(ctx, "<CB>"); mode = chewing_get_ChiEngMode(ctx); ok(mode == SYMBOL_MODE, "mode shall change to SYMBOL_MODE"); ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, ""); ok_commit_buffer(ctx, ""); chewing_delete(ctx); }
void test_select_candidate_4_bytes_utf8() { ChewingContext *ctx; clean_userphrase(); ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_maxChiSymbolLen(ctx, 16); chewing_set_phraseChoiceRearward(ctx, 1); chewing_set_autoShiftCur(ctx, 1); type_keystroke_by_string(ctx, "2k62k6"); /* ㄉㄜˊ ㄉㄜˊ */ ok_preedit_buffer(ctx, "\xE5\xBE\x97\xE5\xBE\x97" /* 得得 */ ); type_keystroke_by_string(ctx, "<H>"); type_keystroke_by_string(ctx, "<D>8"); ok_preedit_buffer(ctx, "\xF0\xA2\x94\xA8\xE5\xBE\x97" /* 𢔨得 */ ); type_keystroke_by_string(ctx, "<D>8"); ok_preedit_buffer(ctx, "\xF0\xA2\x94\xA8\xF0\xA2\x94\xA8" /* 𢔨𢔨 */ ); chewing_delete(ctx); }
void test_interval() { ChewingContext *ctx; IntervalType it; ctx = chewing_new(); start_testcase(ctx, fd); type_keystroke_by_string(ctx, "`31hk4g4`31hk4g4`31" /* ,測試,測試, */ ); ok_preedit_buffer(ctx, "\xEF\xBC\x8C\xE6\xB8\xAC\xE8\xA9\xA6\xEF\xBC\x8C\xE6\xB8\xAC\xE8\xA9\xA6\xEF\xBC\x8C" /* ,測試,測試, */ ); chewing_interval_Enumerate(ctx); ok(chewing_interval_hasNext(ctx) == 1, "shall have next interval"); chewing_interval_Get(ctx, &it); ok(it.from == 1 && it.to == 3, "interval (%d, %d) shall be (1, 3)", it.from, it.to); ok(chewing_interval_hasNext(ctx) == 1, "shall have next interval"); chewing_interval_Get(ctx, &it); ok(it.from == 4 && it.to == 6, "interval (%d, %d) shall be (4, 6)", it.from, it.to); ok(chewing_interval_hasNext(ctx) == 0, "shall not have next interval"); chewing_delete(ctx); }
void test_ShiftRight_add_userphrase() { static const char phrase[] = "\xE6\xB8\xAC\xE8\xA9\xA6" /* 測試 */; static const char bopomofo[] = "\xE3\x84\x98\xE3\x84\x9C\xCB\x8B \xE3\x84\x95\xCB\x8B" /* ㄘㄜˋ ㄕˋ */; int cursor; ChewingContext *ctx; remove( TEST_HASH_DIR PLAT_SEPARATOR HASH_FILE ); chewing_Init( NULL, NULL ); ctx = chewing_new(); chewing_set_maxChiSymbolLen( ctx, 16 ); ok( has_userphrase( ctx, bopomofo, phrase ) == 0, "`%s' shall not be in userphrase", phrase ); type_keystroke_by_string( ctx, "hk4g4<L><L><SR><SR><E>" ); ok_preedit_buffer( ctx, phrase ); cursor = chewing_cursor_Current( ctx ); ok( cursor == 2, "cursor position `%d' shall be 2", cursor ); ok( has_userphrase( ctx, bopomofo, phrase ) == 1, "`%s' shall be in userphrase", phrase ); chewing_delete( ctx ); chewing_Terminate(); }
void test_in_fullshape_mode() { ChewingContext *ctx; size_t i; ctx = chewing_new(); chewing_set_maxChiSymbolLen( ctx, 16 ); chewing_set_ChiEngMode( ctx, SYMBOL_MODE ); chewing_set_ShapeMode( ctx, FULLSHAPE_MODE ); for ( i = 0; i < ARRAY_SIZE( SPECIAL_SYMBOL_TABLE ); ++i ) { // If fullshape symbol is collided with special symbol, use // fullshape symbol if ( is_fullshape_collision_key( SPECIAL_SYMBOL_TABLE[i].token ) ) continue; type_keystroke_by_string( ctx, SPECIAL_SYMBOL_TABLE[i].token ); ok_preedit_buffer( ctx, "" ); ok_commit_buffer( ctx, SPECIAL_SYMBOL_TABLE[i].expected ); } chewing_delete( ctx ); }
void test_set_selKey() { ChewingContext *ctx; int *select_key; chewing_Init( 0, 0 ); ctx = chewing_new(); chewing_set_maxChiSymbolLen( ctx, 16 ); // XXX: chewing_set_selKey shall accept const char *. chewing_set_selKey( ctx, ALTERNATE_SELECT_KEY, ARRAY_SIZE( ALTERNATE_SELECT_KEY )); select_key = chewing_get_selKey( ctx ); ok( select_key, "chewing_get_selKey shall not return NULL" ); ok( !memcmp( select_key, ALTERNATE_SELECT_KEY, sizeof( ALTERNATE_SELECT_KEY )), "select key shall be ALTERNATE_SELECT_KEY"); type_keystroke_by_string( ctx, DATA.token ); ok_preedit_buffer( ctx, DATA.expected ); chewing_free( select_key ); chewing_delete( ctx ); chewing_Terminate(); }
void test_Tab_at_the_end() { ChewingContext *ctx; ctx = chewing_new(); start_testcase(ctx, fd); type_keystroke_by_string(ctx, "hk4g4u6vu84"); ok_preedit_buffer(ctx, "\xE6\xB8\xAC\xE8\xA9\xA6\xE4\xB8\x80\xE4\xB8\x8B" /* 測試一下 */ ); type_keystroke_by_string(ctx, "<T>"); ok_preedit_buffer(ctx, "\xE6\xB8\xAC\xE8\xA9\xA6\xE5\x84\x80\xE4\xB8\x8B" /* 測試儀下 */ ); type_keystroke_by_string(ctx, "<T>"); ok_preedit_buffer(ctx, "\xE6\xB8\xAC\xE8\xA9\xA6\xE4\xB8\x80\xE4\xB8\x8B" /* 測試一下 */ ); chewing_delete(ctx); }
void test_KB_MPS2() { ChewingContext *ctx; ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_KBType(ctx, KB_MPS2_PINYIN); type_keystroke_by_string(ctx, "shin ku4in jen de5hen3bang4"); ok_preedit_buffer(ctx, "\xE6\x96\xB0\xE9\x85\xB7\xE9\x9F\xB3\xE7\x9C\x9F\xE7\x9A\x84\xE5\xBE\x88\xE6\xA3\x92" /* 新酷音真的很棒 */ ); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "huan ing2shr3iung4pin in muo2shz4"); ok_preedit_buffer(ctx, "\xE6\xAD\xA1\xE8\xBF\x8E\xE4\xBD\xBF\xE7\x94\xA8\xE6\x8B\xBC\xE9\x9F\xB3\xE6\xA8\xA1\xE5\xBC\x8F" /* 歡迎使用拼音模式 */ ); chewing_clean_preedit_buf(ctx); chewing_delete(ctx); }
void test_auto_commit_symbol() { ChewingContext *ctx; ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_maxChiSymbolLen(ctx, 2); type_keystroke_by_string(ctx, "`31hk4g4" /* ,測試 */ ); ok_preedit_buffer(ctx, "\xE6\xB8\xAC\xE8\xA9\xA6" /* 測試 */ ); ok_commit_buffer(ctx, "\xEF\xBC\x8C" /* , */ ); chewing_delete(ctx); }
void test_libchewing_data_issue_1() { const TestData DATA = { "e03y.3", "\xE8\xB6\x95\xE8\xB5\xB0" /* 趕走 */ }; ChewingContext *ctx; clean_userphrase(); ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_maxChiSymbolLen(ctx, 16); type_keystroke_by_string(ctx, DATA.token); ok_preedit_buffer(ctx, DATA.expected); chewing_delete(ctx); }
void test_Esc_escCleanAllBuf() { ChewingContext *ctx; ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_escCleanAllBuf(ctx, 1); type_keystroke_by_string(ctx, "hk4g4<EE>"); ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, ""); ok_commit_buffer(ctx, ""); chewing_delete(ctx); }
void test_select_candidate_rearward() { /* * The following phrases are in dict * 一上來 * 上來 * 移上來 * 移上 */ static const char *CAND_1[] = { "\xE4\xB8\x80\xE4\xB8\x8A\xE4\xBE\x86" /* 一上來 */ , "\xE7\xA7\xBB\xE4\xB8\x8A\xE4\xBE\x86" /* 移上來 */ , }; static const char *CAND_2[] = { "\xE4\xB8\x8A\xE4\xBE\x86" /* 上來 */ , }; ChewingContext *ctx; clean_userphrase(); ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_maxChiSymbolLen(ctx, 16); chewing_set_phraseChoiceRearward(ctx, 1); type_keystroke_by_string(ctx, "u6g;4x96"); /* ㄧˊㄕㄤˋㄌㄞˊ */ ok_preedit_buffer(ctx, CAND_1[0]); type_keystroke_by_string(ctx, "<D>"); /* ㄧˊㄕㄤˋㄌㄞˊ */ ok_candidate(ctx, CAND_1, ARRAY_SIZE(CAND_1)); type_keystroke_by_string(ctx, "<D>"); /* ㄕㄤˋㄌㄞˊ */ ok_candidate(ctx, CAND_2, ARRAY_SIZE(CAND_2)); type_keystroke_by_string(ctx, "<D><D>2<E>"); /* select 移上來 */ ok_commit_buffer(ctx, CAND_1[1]); chewing_delete(ctx); }
void test_in_easy_symbol_mode() { ChewingContext *ctx; size_t i; ctx = chewing_new(); chewing_set_maxChiSymbolLen( ctx, 16 ); chewing_set_easySymbolInput( ctx, 1 ); for ( i = 0; i < ARRAY_SIZE( SPECIAL_SYMBOL_TABLE ); ++i ) { type_keystroke_by_string( ctx, SPECIAL_SYMBOL_TABLE[i].token ); ok_preedit_buffer( ctx, SPECIAL_SYMBOL_TABLE[i].expected ); type_keystroke_by_string( ctx, "<E>" ); ok_commit_buffer( ctx, SPECIAL_SYMBOL_TABLE[i].expected ); } chewing_delete( ctx ); }
void test_fullshape_input() { ChewingContext *ctx; size_t i; ctx = chewing_new(); chewing_set_ChiEngMode( ctx, SYMBOL_MODE ); chewing_set_ShapeMode( ctx, FULLSHAPE_MODE ); for ( i = 0; i < ARRAY_SIZE( FULLSHAPE_DATA ); ++i ) { type_keystroke_by_string( ctx, FULLSHAPE_DATA[i].token ); // fullshape symbol does not present in preedit buffer. ok_preedit_buffer( ctx, "" ); ok_commit_buffer( ctx, FULLSHAPE_DATA[i].expected ); } chewing_delete( ctx ); }
void test_type_symbol() { ChewingContext *ctx; int i; chewing_Init( NULL, NULL ); ctx = chewing_new(); chewing_set_candPerPage( ctx, 10 ); chewing_set_maxChiSymbolLen( ctx, 16 ); for (i = 0; i < ARRAY_SIZE(SYMBOL); ++i ) { type_keystroke_by_string( ctx, SYMBOL[i].token ); ok_preedit_buffer( ctx, "" ); ok_commit_buffer( ctx, SYMBOL[i].expected ); } chewing_delete( ctx ); chewing_Terminate(); }
void test_longest_phrase() { ChewingContext *ctx; IntervalType it; ctx = chewing_new(); start_testcase(ctx, fd); type_keystroke_by_string(ctx, "rup ji up6ji 1j4bj6y4ru32k7e.3ji " /* ㄐㄧㄣ ㄨㄛ ㄧㄣˊ ㄨㄛ ㄅㄨˋ ㄖㄨˊ ㄗˋ ㄐㄧˇ ㄉㄜ˙ ㄍㄡˇ ㄨㄛ */ ); ok_preedit_buffer(ctx, "\xE9\x87\x91\xE7\xAA\xA9\xE9\x8A\x80\xE7\xAA\xA9\xE4\xB8\x8D\xE5\xA6\x82\xE8\x87\xAA\xE5\xB7\xB1\xE7\x9A\x84\xE7\x8B\x97\xE7\xAA\xA9" /* 金窩銀窩不如自己的狗窩 */ ); chewing_interval_Enumerate(ctx); ok(chewing_interval_hasNext(ctx) == 1, "shall have next interval"); chewing_interval_Get(ctx, &it); ok(it.from == 0 && it.to == 11, "interval (%d, %d) shall be (0, 11)", it.from, it.to); chewing_delete(ctx); }
void test_Down_open_candidate_window_after_deleting_symbol() { ChewingContext *ctx; int ret; ctx = chewing_new(); start_testcase(ctx, fd); type_keystroke_by_string(ctx, "<<>hk4g4<<>" /* ,測試, */); ret = chewing_cand_TotalChoice(ctx); ok(ret == 0, "chewing_cand_TotalChoice() returns `%d' shall be `%d'", ret, 0); type_keystroke_by_string(ctx, "<H><DC><EN><D>" /* Home Delete End Down */); ret = chewing_cand_TotalChoice(ctx); ok(ret > 0, "chewing_cand_TotalChoice() returns `%d' shall be greater than `%d'", ret, 0); type_keystroke_by_string(ctx, "2"); ret = chewing_cand_TotalChoice(ctx); ok(ret == 0, "chewing_cand_TotalChoice() returns `%d' shall be `%d'", ret, 0); ok_preedit_buffer(ctx, "\xE6\xB8\xAC\xE8\xA9\xA6\xE2\x86\x90" /* 測試← */ ); chewing_delete(ctx); }
void test_Down_open_candidate_window() { ChewingContext *ctx; int ret; ctx = chewing_new(); start_testcase(ctx, fd); type_keystroke_by_string(ctx, "hk4"); ret = chewing_cand_TotalChoice(ctx); ok(ret == 0, "chewing_cand_TotalChoice() returns `%d' shall be `%d'", ret, 0); type_keystroke_by_string(ctx, "<D>"); ret = chewing_cand_TotalChoice(ctx); ok(ret > 0, "chewing_cand_TotalChoice() returns `%d' shall be greater than `%d'", ret, 0); type_keystroke_by_string(ctx, "3"); ret = chewing_cand_TotalChoice(ctx); ok(ret == 0, "chewing_cand_TotalChoice() returns `%d' shall be `%d'", ret, 0); ok_preedit_buffer(ctx, "\xE6\xB8\xAC" /* 測 */ ); chewing_delete(ctx); }
void test_in_chinese_mode() { ChewingContext *ctx; size_t i; ctx = chewing_new(); chewing_set_maxChiSymbolLen( ctx, 16 ); for ( i = 0; i < ARRAY_SIZE( SPECIAL_SYMBOL_TABLE ); ++i ) { // If bopomofo symbol is collided with special symbol, use // bopomofo symbol if ( is_bopomofo_collision_key( SPECIAL_SYMBOL_TABLE[i].token ) ) continue; type_keystroke_by_string( ctx, SPECIAL_SYMBOL_TABLE[i].token ); ok_preedit_buffer( ctx, SPECIAL_SYMBOL_TABLE[i].expected ); type_keystroke_by_string( ctx, "<E>" ); ok_commit_buffer( ctx, SPECIAL_SYMBOL_TABLE[i].expected ); } chewing_delete( ctx ); }
void test_KB_HSU() { ChewingContext *ctx; ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_KBType(ctx, KB_HSU); type_keystroke_by_string(ctx, "cen kxjen jn dgshnfbkj"); ok_preedit_buffer(ctx, "\xE6\x96\xB0\xE9\x85\xB7\xE9\x9F\xB3\xE7\x9C\x9F\xE7\x9A\x84\xE5\xBE\x88\xE6\xA3\x92" /* 新酷音真的很棒 */ ); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "m"); ok_bopomofo_buffer(ctx, "\xE3\x84\x87" /* ㄇ */ ); type_keystroke_by_string(ctx, " "); /* convert "ㄇ" to "ㄢ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE5\xAE\x89" /* 安 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "h"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8F" /* ㄏ */ ); type_keystroke_by_string(ctx, "d"); /* convert "ㄏ" to "ㄛ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE5\x93\xA6" /* 哦 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "g"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8D" /* ㄍ */ ); type_keystroke_by_string(ctx, " "); /* convert "ㄍ" to "ㄜ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE9\x98\xBF" /* 阿 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "n"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8B" /* ㄋ */ ); type_keystroke_by_string(ctx, "f"); /* convert "ㄋ" to "ㄣ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE5\xB3\x8E" /* 峎 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "k"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8E" /* ㄎ */ ); type_keystroke_by_string(ctx, " "); /* convert "ㄎ" to "ㄤ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE9\xAA\xAF" /* 骯 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "j"); ok_bopomofo_buffer(ctx, "\xE3\x84\x90" /* ㄐ */); type_keystroke_by_string(ctx, " "); /* convert "ㄐ,ㄑ,ㄒ" to "ㄓ,ㄔ,ㄕ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE4\xB9\x8B" /* 之 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "l"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8C" /* ㄌ */); type_keystroke_by_string(ctx, "f"); /* convert "ㄌ" to "ㄦ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE7\x88\xBE" /* 爾 */); chewing_clean_preedit_buf(ctx); chewing_delete(ctx); }
void test_KB_ET26() { ChewingContext *ctx; ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_KBType(ctx, KB_ET26); type_keystroke_by_string(ctx, "cen kxken gn drdhnjbtk"); ok_preedit_buffer(ctx, "\xE6\x96\xB0\xE9\x85\xB7\xE9\x9F\xB3\xE7\x9C\x9F\xE7\x9A\x84\xE5\xBE\x88\xE6\xA3\x92" /* 新酷音真的很棒 */ ); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "p"); ok_bopomofo_buffer(ctx, "\xE3\x84\x86" /* ㄆ */ ); type_keystroke_by_string(ctx, "f"); /* convert "ㄆ" to "ㄡ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE5\x90\xBD" /* 吽 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "m"); ok_bopomofo_buffer(ctx, "\xE3\x84\x87" /* ㄇ */ ); type_keystroke_by_string(ctx, " "); /* convert "ㄇ" to "ㄢ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE5\xAE\x89" /* 安 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "n"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8B" /* ㄋ */ ); type_keystroke_by_string(ctx, "j"); /* convert "ㄋ" to "ㄣ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE5\xB3\x8E" /* 峎 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "t"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8A" /* ㄊ */ ); type_keystroke_by_string(ctx, " "); /* convert "ㄊ" to "ㄤ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE9\xAA\xAF" /* 骯 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "l"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8C" /* ㄌ */ ); type_keystroke_by_string(ctx, " "); /* convert "ㄌ" to "ㄥ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE9\x9E\xA5" /* 鞥 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "h"); ok_bopomofo_buffer(ctx, "\xE3\x84\x8F" /* ㄏ */); type_keystroke_by_string(ctx, "j"); /* convert "ㄏ" to "ㄦ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE7\x88\xBE" /* 爾 */); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "g"); ok_bopomofo_buffer(ctx, "\xE3\x84\x90" /* ㄐ */); type_keystroke_by_string(ctx, " "); /* convert "ㄐ,ㄒ" to "ㄓ,ㄕ" */ ok_bopomofo_buffer(ctx, ""); ok_preedit_buffer(ctx, "\xE4\xB9\x8B" /* 之 */); chewing_clean_preedit_buf(ctx); chewing_delete(ctx); }
void test_KB_DACHEN_CP26() { ChewingContext *ctx; ctx = chewing_new(); start_testcase(ctx, fd); chewing_set_KBType(ctx, KB_DACHEN_CP26); type_keystroke_by_string(ctx, "vup djdup tp wkycprqlld"); ok_preedit_buffer(ctx, "\xE6\x96\xB0\xE9\x85\xB7\xE9\x9F\xB3\xE7\x9C\x9F\xE7\x9A\x84\xE5\xBE\x88\xE6\xA3\x92" /* 新酷音真的很棒 */ ); chewing_clean_preedit_buf(ctx); type_keystroke_by_string(ctx, "qq"); /* switch between "ㄅ" and "ㄆ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x86" /* ㄆ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "ww"); /* switch between "ㄉ" and "ㄊ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x8A" /* ㄊ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "tt"); /* switch between "ㄓ" and "ㄔ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x94" /* ㄔ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "xmm"); /* switch between "ㄩ" and "ㄡ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x8C\xE3\x84\xA1" /* ㄌㄡ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "xum"); /* convert "ㄧㄩ" to "ㄧㄡ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x8C\xE3\x84\xA7\xE3\x84\xA1" /* ㄌㄧㄡ */); type_keystroke_by_string(ctx, "m"); /* convert "ㄧㄡ" to "ㄩ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x8C\xE3\x84\xA9" /* ㄌㄩ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "ii"); /* switch between "ㄛ" and "ㄞ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x9E" /* ㄞ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "oo"); /* switch between "ㄟ" and "ㄢ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\xA2" /* ㄢ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "ll"); /* switch between "ㄠ" and "ㄤ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\xA4" /* ㄤ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "pp"); /* switch between "ㄣ" and "ㄦ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\xA6" /* ㄦ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "wu"); /* switch among "ㄧ", "ㄚ" and "ㄧㄚ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x89\xE3\x84\xA7" /* ㄉㄧ */); type_keystroke_by_string(ctx, "u"); ok_bopomofo_buffer(ctx, "\xE3\x84\x89\xE3\x84\x9A" /* ㄉㄚ */); type_keystroke_by_string(ctx, "u"); ok_bopomofo_buffer(ctx, "\xE3\x84\x89\xE3\x84\xA7\xE3\x84\x9A" /* ㄉㄧㄚ */); type_keystroke_by_string(ctx, "u"); ok_bopomofo_buffer(ctx, "\xE3\x84\x89" /* ㄉ */); type_keystroke_by_string(ctx, "ju"); ok_bopomofo_buffer(ctx, "\xE3\x84\x89\xE3\x84\xA8\xE3\x84\x9A" /* ㄉㄨㄚ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "bb"); /* convert "ㄖ" to "ㄝ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x96\xE3\x84\x9D" /* ㄖㄝ */); chewing_clean_bopomofo_buf(ctx); type_keystroke_by_string(ctx, "njn"); /* convert "ㄙ" to "ㄥ" */ ok_bopomofo_buffer(ctx, "\xE3\x84\x99\xE3\x84\xA8\xE3\x84\xA5" /* ㄙㄨㄥ */); chewing_clean_bopomofo_buf(ctx); chewing_delete(ctx); }