File: test-reset.c

package info (click to toggle)
libchewing 0.10.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,040 kB
  • sloc: ansic: 7,031; python: 190; sh: 127; makefile: 44
file content (49 lines) | stat: -rw-r--r-- 976 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * test-reset.c
 *
 * Copyright (c) 2012
 *      libchewing Core Team.
 *
 * See the file "COPYING" for information on usage and redistribution
 * of this file.
 */

#ifdef HAVE_CONFIG_H
#    include <config.h>
#endif

#include <assert.h>
#include <stdlib.h>

#include "chewing.h"
#include "testhelper.h"

void test_reset_shall_not_clean_static_data()
{
    const TestData DATA = { "hk4g4<E>", "\xE6\xB8\xAC\xE8\xA9\xA6" /* 測試 */  };
    ChewingContext *ctx;

    ctx = chewing_new();
    start_testcase(ctx);

    chewing_set_KBType(ctx, chewing_KBStr2Num("KB_DEFAULT"));

    chewing_set_maxChiSymbolLen(ctx, 16);

    chewing_Reset(ctx);

    type_keystroke_by_string(ctx, DATA.token);
    ok_commit_buffer(ctx, DATA.expected);

    chewing_delete(ctx);
}

int main(int argc, char *argv[])
{
    putenv("CHEWING_PATH=" CHEWING_DATA_PREFIX);
    putenv("CHEWING_USER_PATH=" TEST_HASH_DIR);

    test_reset_shall_not_clean_static_data();

    return exit_status();
}