~ubuntu-branches/ubuntu/trusty/fcitx/trusty-proposed

« back to all changes in this revision

Viewing changes to test/testhotkey.c

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2013-02-10 17:03:56 UTC
  • mfrom: (1.3.18) (33.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130210170356-2yuv6xy3ed378kn0
Tags: 1:4.2.7-1
* New upstream release.
* New binary packages:
  - fcitx-libs-gclient: D-Bus client library for Glib
  - fcitx-libs-qt: D-Bus client library for Qt
  - fcitx-module-quickphrase-editor: Quick Phrase editor module

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <assert.h>
 
2
#include "fcitx-config/hotkey.h"
 
3
 
 
4
#define TEST_HOTKEY_UNIFICATION(ORGSYM, ORGSTATE, OBJSYM, OBJSTATE) \
 
5
    do { \
 
6
        FcitxKeySym sym = ORGSYM; \
 
7
        unsigned int state = ORGSTATE; \
 
8
        FcitxHotkeyGetKey(sym, state, &sym, &state); \
 
9
        assert(OBJSYM == sym); \
 
10
        assert(OBJSTATE == state); \
 
11
    } while(0)
 
12
 
 
13
int main()
 
14
{
 
15
    TEST_HOTKEY_UNIFICATION(FcitxKey_a, 0, FcitxKey_a, 0);
 
16
    TEST_HOTKEY_UNIFICATION(FcitxKey_A, FcitxKeyState_Shift, FcitxKey_A, 0);
 
17
    TEST_HOTKEY_UNIFICATION(FcitxKey_F, FcitxKeyState_Ctrl_Shift, FcitxKey_F, FcitxKeyState_Ctrl_Shift);
 
18
    TEST_HOTKEY_UNIFICATION(FcitxKey_F, FcitxKeyState_Ctrl, FcitxKey_F, FcitxKeyState_Ctrl);
 
19
    TEST_HOTKEY_UNIFICATION(FcitxKey_f, FcitxKeyState_Ctrl_Shift, FcitxKey_F, FcitxKeyState_Ctrl_Shift);
 
20
    TEST_HOTKEY_UNIFICATION(FcitxKey_f, FcitxKeyState_Ctrl_Alt, FcitxKey_F, FcitxKeyState_Ctrl_Alt);
 
21
 
 
22
    return 0;
 
23
}