当前位置: 首页>>代码示例>>C++>>正文


C++ chewing_delete函数代码示例

本文整理汇总了C++中chewing_delete函数的典型用法代码示例。如果您正苦于以下问题:C++ chewing_delete函数的具体用法?C++ chewing_delete怎么用?C++ chewing_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了chewing_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test_libchewing_googlecode_issue_472

void test_libchewing_googlecode_issue_472()
{
    /* FIXME: Add const cause gcc warning */
    static char *INPUT[] = {
        "<T>|&Wt<H>mrJY)G<C2>OqJ<H><H>Yl<R>p0<EE>QE[^<C1>k",
        "+F<C9>hQ$UIICMr!X8/9<C3>(N<T>yU2!-LUI<D>`CS<D>jShm9SF}<EN>[`QYu<C8>k",
        "hk4`2<D>jk",
        "hk4`j 0",
        "hk4<C0>j 0",
    };
    size_t i;
    ChewingContext *ctx;

    ctx = chewing_new();
    start_testcase(ctx, fd);
    chewing_set_maxChiSymbolLen(ctx, 16);
    chewing_set_autoShiftCur(ctx, 1);

    for (i = 0; i < ARRAY_SIZE(INPUT); ++i) {
        chewing_Reset(ctx);
        type_keystroke_by_string(ctx, INPUT[i]);
    }

    chewing_delete(ctx);
}
开发者ID:StanleyDing,项目名称:libchewing,代码行数:25,代码来源:test-regression.c

示例2: test_libchewing_googlecode_issue_473

void test_libchewing_googlecode_issue_473()
{
    /* FIXME: Add const cause gcc warning */
    static char *INPUT[] = {
        "t<N->_ M1<N+>H[Ls3<L><N1>PL+Z]4<C1>&(^H*H<TT>Sc<N->P]!|<CB>-<C6>S<H><N1><C0>U<B>d}P!f<EN><N.><C7>V!U!w|4-=S<C1>b<N2>Q",
        "wv<C0><C5><N9>$FIF<D><N4>B *<C2>E4*<C2>q)Kf)<SS><TT>4=<N5>%<R>mN4<EN>H<N9><N.>8s{XTD<N6>jZV(y3G`9<C6>JTy<B>J<C1>SNc<E>hC<SL><N/><R><C6>@an<C3><N7>wzF<C3>P*<N*><B>l<C3><N6>W<N*> $<SR><N.><N1><E><E><N0><N6>Y",
    };
    size_t i;
    ChewingContext *ctx;

    ctx = chewing_new();
    start_testcase(ctx, fd);
    chewing_set_maxChiSymbolLen(ctx, 16);
    chewing_set_autoShiftCur(ctx, 1);
    chewing_set_candPerPage(ctx, 9);
    chewing_set_addPhraseDirection(ctx, 1);
    chewing_set_spaceAsSelection(ctx, 1);

    for (i = 0; i < ARRAY_SIZE(INPUT); ++i) {
        chewing_Reset(ctx);
        type_keystroke_by_string(ctx, INPUT[i]);
    }

    chewing_delete(ctx);
}
开发者ID:StanleyDing,项目名称:libchewing,代码行数:25,代码来源:test-regression.c

示例3: test_set_ChiEngMode

void test_set_ChiEngMode()
{
	const int VALUE[] = {
		CHINESE_MODE,
		SYMBOL_MODE,
	};

	const int INVALID_VALUE[] = {
		-1,
		2,
	};

	ChewingContext *ctx;
	size_t i;
	size_t j;

	print_function_name();

	ctx = chewing_new();

	for ( i = 0; i < ARRAY_SIZE( VALUE ); ++i ) {
		chewing_set_ChiEngMode( ctx, VALUE[i] );
		ok( chewing_get_ChiEngMode( ctx ) == VALUE[i],
			"ChiEngMode shall be `%d'", VALUE[i] );

		for ( j = 0; j < ARRAY_SIZE( INVALID_VALUE ); ++j ) {
			// mode shall not change when set mode has invalid value.
			chewing_set_ChiEngMode( ctx, INVALID_VALUE[j] );
			ok( chewing_get_ChiEngMode( ctx ) == VALUE[i],
				"ChiEngMode shall be `%d'", VALUE[i] );
		}
	}

	chewing_delete( ctx );
}
开发者ID:blue119,项目名称:libchewing,代码行数:35,代码来源:test-config.c

示例4: test_CtrlNum_add_phrase_symbol_in_between

void test_CtrlNum_add_phrase_symbol_in_between()
{
	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 );
        chewing_set_addPhraseDirection( ctx, 1 );

	ok( has_userphrase( ctx, bopomofo, NULL ) == 0,
		"`%s' shall not be in userphrase", bopomofo );

	type_keystroke_by_string( ctx, "hk4`1g4<C2>" );
	cursor = chewing_cursor_Current( ctx );
	ok( cursor == 3, "cursor position `%d' shall be 3", cursor );

	/*
	 * FIXME: Current buggy here. User phrase shall not be added when there
	 * is a symbol in between.
	 */
	/* ok( has_userphrase( ctx, bopomofo, NULL ) == 0,
		"`%s' shall not be in userphrase", bopomofo ); */

	chewing_delete( ctx );
	chewing_Terminate();
}
开发者ID:chiehwen,项目名称:libchewing,代码行数:31,代码来源:test-userphrase.c

示例5: test_enumerate_keyboard_type

void test_enumerate_keyboard_type()
{
	ChewingContext *ctx;
	size_t i;
	char *keyboard_string;


	ctx = chewing_new();

	ok( chewing_kbtype_Total( ctx ) == ARRAY_SIZE( KEYBOARD_STRING ),
		"total keyboard_string type shall be %d", ARRAY_SIZE( KEYBOARD_STRING ) );

	chewing_kbtype_Enumerate( ctx );
	for ( i = 0; i < ARRAY_SIZE( KEYBOARD_STRING ); ++i ) {
		ok( chewing_kbtype_hasNext( ctx ) == 1 ,
			"shall have next keyboard_string type" );
		keyboard_string = chewing_kbtype_String( ctx );
		ok( strcmp( keyboard_string, KEYBOARD_STRING[i] ) == 0,
			"`%s' shall be `%s'", keyboard_string, KEYBOARD_STRING[i] );
		chewing_free( keyboard_string );
	}
	ok( chewing_kbtype_hasNext( ctx ) == 0 ,
		"shall not have next keyboard_string type" );
	keyboard_string = chewing_kbtype_String( ctx );
	ok( strcmp( keyboard_string, "" ) == 0,
		"`%s' shall be `%s'", keyboard_string, "" );
	chewing_free( keyboard_string );

	chewing_delete( ctx );
}
开发者ID:beantu,项目名称:libchewing,代码行数:30,代码来源:test-keyboard.c

示例6: test_zuin_buffer

void test_zuin_buffer()
{
	ChewingContext *ctx;
	ctx = chewing_new();

	type_keystroke_by_string( ctx, "1ul" );
	ok_zuin_buffer( ctx, "\xE3\x84\x85\xE3\x84\xA7\xE3\x84\xA0" /* ㄅㄧㄠ */ );

	type_keystroke_by_string( ctx, " " );
	ok_zuin_buffer( ctx, "" );

	type_keystroke_by_string( ctx, "ul" );
	ok_zuin_buffer( ctx, "\xE3\x84\xA7\xE3\x84\xA0" /* ㄧㄠ */ );

	type_keystroke_by_string( ctx, " " );
	ok_zuin_buffer( ctx, "" );

	type_keystroke_by_string( ctx, "3");
	ok_zuin_buffer( ctx, "\xCB\x87" /* ˇ */);

	type_keystroke_by_string( ctx, " " );
	ok_zuin_buffer( ctx, "" );

	chewing_delete( ctx );
}
开发者ID:beantu,项目名称:libchewing,代码行数:25,代码来源:test-bopomofo.c

示例7: test_select_candidate_4_bytes_utf8

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 );
}
开发者ID:beantu,项目名称:libchewing,代码行数:27,代码来源:test-bopomofo.c

示例8: test_Space_selection_symbol

void test_Space_selection_symbol()
{
    const char CAND_1[] = "\xE2\x80\xA6" /* … */ ;
    const char CAND_2[] = "\xE9\x9B\x99\xE7\xB7\x9A\xE6\xA1\x86" /* 雙線框 */ ;

    ChewingContext *ctx;
    const char *const_buf;

    clean_userphrase();

    ctx = chewing_new();
    start_testcase(ctx, fd);
    chewing_set_spaceAsSelection(ctx, 1);

    type_keystroke_by_string(ctx, "`");
    chewing_cand_Enumerate(ctx);
    const_buf = chewing_cand_String_static(ctx);
    ok(strcmp(const_buf, CAND_1) == 0, "first candidate list head `%s' shall be `%s'", const_buf, CAND_1);

    type_keystroke_by_string(ctx, " ");
    chewing_cand_Enumerate(ctx);
    const_buf = chewing_cand_String_static(ctx);
    ok(strcmp(const_buf, CAND_2) == 0, "second candidate list head `%s' shall be `%s'", const_buf, CAND_2);

    /* rollover */
    type_keystroke_by_string(ctx, " ");
    chewing_cand_Enumerate(ctx);
    const_buf = chewing_cand_String_static(ctx);
    ok(strcmp(const_buf, CAND_1) == 0, "first candidate list head `%s' shall be `%s'", const_buf, CAND_1);

    chewing_delete(ctx);
}
开发者ID:PingNote,项目名称:libchewing,代码行数:32,代码来源:test-bopomofo.c

示例9: test_userphrase_auto_learn_hardcode_break

void test_userphrase_auto_learn_hardcode_break()
{
	/* 的 is a hardcode break point, see ChewingIsBreakPoint */
	static const char phrase[] = "\xE7\x9A\x84\xE7\x9A\x84" /* 的的 */;
	static const char bopomofo[] = "\xE3\x84\x89\xE3\x84\x9C\xCB\x99 \xE3\x84\x89\xE3\x84\x9C\xCB\x99" /* ㄉㄜ˙ ㄉㄜ˙ */;
	ChewingContext *ctx;

	remove( TEST_HASH_DIR PLAT_SEPARATOR HASH_FILE );

	chewing_Init( NULL, NULL );

	ctx = chewing_new();
	chewing_set_maxChiSymbolLen( ctx, 16 );
	chewing_set_addPhraseDirection( ctx, 1 );

	ok( has_userphrase( ctx, bopomofo, phrase ) == 0,
		"`%s' shall not be in userphrase", phrase );

	type_keystroke_by_string( ctx, "2k72k7<E>" );
	ok( has_userphrase( ctx, bopomofo, phrase ) == 0,
		"`%s' shall not be in userphrase", phrase );

	chewing_delete( ctx );
	chewing_Terminate();
}
开发者ID:chiehwen,项目名称:libchewing,代码行数:25,代码来源:test-userphrase.c

示例10: test_set_addPhraseDirection

void test_set_addPhraseDirection()
{
	ChewingContext *ctx;
	int value;
	int mode;

	ctx = chewing_new();
	start_testcase( ctx, fd );

	for ( value = 0; value < 2; ++value ) {
		chewing_set_addPhraseDirection( ctx, value );
		mode = chewing_get_addPhraseDirection( ctx );
		ok( mode == value,
			"addPhraseDirection `%d' shall be `%d'", mode, value );

		chewing_set_addPhraseDirection( ctx, -1 );
		mode = chewing_get_addPhraseDirection( ctx );
		ok( mode == value,
			"addPhraseDirection `%d' shall be `%d'", mode, value );

		chewing_set_addPhraseDirection( ctx, 2 );
		mode = chewing_get_addPhraseDirection( ctx );
		ok( mode == value,
			"addPhraseDirection `%d' shall be `%d'", mode, value );
	}

	chewing_delete( ctx );
}
开发者ID:aitjcize,项目名称:libchewing,代码行数:28,代码来源:test-config.c

示例11: test_Space_selection_word

void test_Space_selection_word()
{
    ChewingContext *ctx;
    char *buf;
    int len;

    clean_userphrase();

    ctx = chewing_new();
    start_testcase(ctx, fd);
    chewing_set_spaceAsSelection(ctx, 1);

    type_keystroke_by_string(ctx, "hk4g4<H>" /* 測試 */ );

    type_keystroke_by_string(ctx, " "); /* open candidate window */

    chewing_cand_Enumerate(ctx);
    buf = chewing_cand_String(ctx);
    len = ueStrLen(buf);
    ok(len == 2, "candidate `%s' length `%d' shall be `%d'", buf, len, 2);
    chewing_free(buf);

    type_keystroke_by_string(ctx, " "); /* next candidate list */

    chewing_cand_Enumerate(ctx);
    buf = chewing_cand_String(ctx);
    len = ueStrLen(buf);
    ok(len == 1, "candidate `%s' length `%d' shall be `%d'", buf, len, 1);
    chewing_free(buf);

    type_keystroke_by_string(ctx, " "); /* next page */
    ok(chewing_cand_CurrentPage(ctx) == 1, "current page shall be 1");

    chewing_delete(ctx);
}
开发者ID:PingNote,项目名称:libchewing,代码行数:35,代码来源:test-bopomofo.c

示例12: test_set_fullshape

void test_set_fullshape()
{
	ChewingContext *ctx;


	ctx = chewing_new();

	ok( chewing_get_ShapeMode( ctx ) == HALFSHAPE_MODE,
		"default is HALFSHAPE_MODE" );

	chewing_set_ShapeMode( ctx, FULLSHAPE_MODE );
	ok( chewing_get_ShapeMode( ctx ) == FULLSHAPE_MODE,
		"mode shall change to FULLSHAPE_MODE" );

	// XXX: What is the correct behavior when input parameter is wrong?
//	chewing_set_ShapeMode( ctx, -1 );
//	ok( chewing_get_ShapeMode( ctx ) == FULLSHAPE_MODE,
//		"mode shall not change when parameter is invalid" );

	chewing_set_ShapeMode( ctx, HALFSHAPE_MODE );
	ok( chewing_get_ShapeMode( ctx ) == HALFSHAPE_MODE,
		"mode shall change to HALFSHAPE_MODE" );

	chewing_set_ShapeMode( ctx, -1 );
	ok( chewing_get_ShapeMode( ctx ) == HALFSHAPE_MODE,
		"mode shall not change when parameter is invalid" );


	chewing_delete( ctx );
}
开发者ID:beantu,项目名称:libchewing,代码行数:30,代码来源:test-fullshape.c

示例13: test_set_autoShiftCur

void test_set_autoShiftCur()
{
	ChewingContext *ctx;
	int value;
	int mode;

	chewing_Init( 0, 0 );

	ctx = chewing_new();

	for ( value = 0; value < 2; ++value ) {
		chewing_set_autoShiftCur( ctx, value );
		mode = chewing_get_autoShiftCur( ctx );
		ok( mode = chewing_get_autoShiftCur( ctx ) == value,
			"autoShiftCur shall be `%d'", value );

		chewing_set_autoShiftCur( ctx, -1 );
		mode = chewing_get_autoShiftCur( ctx );
		ok( mode = chewing_get_autoShiftCur( ctx ) == value,
			"autoShiftCur shall be `%d'", value );

		chewing_set_autoShiftCur( ctx, 2 );
		mode = chewing_get_autoShiftCur( ctx );
		ok( mode = chewing_get_autoShiftCur( ctx ) == value,
			"autoShiftCur shall be `%d'", value );
	}

	chewing_delete( ctx );
	chewing_Terminate();
}
开发者ID:chiehwen,项目名称:libchewing,代码行数:30,代码来源:test-config.c

示例14: test_set_easySymbolInput

void test_set_easySymbolInput()
{
	ChewingContext *ctx;
	int value;
	int mode;

	chewing_Init( 0, 0 );

	ctx = chewing_new();

	for ( value = 0; value < 2; ++value ) {
		chewing_set_easySymbolInput( ctx, value );
		mode = chewing_get_easySymbolInput( ctx );
		ok( mode == value,
			"easySymbolInput `%d', shall be `%d'", mode, value );

		chewing_set_easySymbolInput( ctx, -1 );
		mode = chewing_get_easySymbolInput( ctx );
		ok( mode == value,
			"easySymbolInput `%d', shall be `%d'", mode, value );

		chewing_set_easySymbolInput( ctx, 2 );
		mode = chewing_get_easySymbolInput( ctx );
		ok( mode == value,
			"easySymbolInput `%d', shall be `%d'", mode, value );
	}

	chewing_delete( ctx );
	chewing_Terminate();
}
开发者ID:chiehwen,项目名称:libchewing,代码行数:30,代码来源:test-config.c

示例15: test_set_spaceAsSelection

void test_set_spaceAsSelection()
{
	ChewingContext *ctx;
	int value;
	int mode;

	chewing_Init( 0, 0 );

	ctx = chewing_new();

	for ( value = 0; value < 2; ++value ) {
		chewing_set_spaceAsSelection( ctx, value );
		mode = chewing_get_spaceAsSelection( ctx );
		ok( mode == value,
			"spaceAsSelection `%d' shall be `%d'", mode, value );

		chewing_set_spaceAsSelection( ctx, -1 );
		mode = chewing_get_spaceAsSelection( ctx );
		ok( mode == value,
			"spaceAsSelection `%d' shall be `%d'", mode, value );

		chewing_set_spaceAsSelection( ctx, 2 );
		mode = chewing_get_spaceAsSelection( ctx );
		ok( mode == value,
			"spaceAsSelection `%d' shall be `%d'", mode, value );
	}

	chewing_delete( ctx );
	chewing_Terminate();
}
开发者ID:chiehwen,项目名称:libchewing,代码行数:30,代码来源:test-config.c


注:本文中的chewing_delete函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。