622 lines
17 KiB
Diff
622 lines
17 KiB
Diff
From e37bcc53f1d145e10974fb0bb91802d735921fcd Mon Sep 17 00:00:00 2001
|
|
From: Daiki Ueno <ueno@unixuser.org>
|
|
Date: Wed, 31 Aug 2011 11:44:46 +0900
|
|
Subject: [PATCH 1/6] Update the format of default.xml to allow override.
|
|
|
|
This patch allows value inheritance from the previous matches.
|
|
With the new format:
|
|
|
|
<engines>
|
|
<engine>
|
|
<name>*</name>
|
|
<rank>0</rank>
|
|
<preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:ja:*</name>
|
|
<rank>2</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:ja:anthy</name>
|
|
<rank>1</rank>
|
|
</engine>
|
|
</engines>
|
|
|
|
We will get preedit-highlight == TRUE and rank == 1 for m17n:ja:anthy.
|
|
---
|
|
src/Makefile.am | 3 +-
|
|
src/default.xml.in.in | 221 +++++++++++++++++++------------------------------
|
|
src/engine.c | 2 +
|
|
src/m17nutil.c | 68 +++++++---------
|
|
src/m17nutil.h | 1 +
|
|
src/test.c | 66 +++++++++++++++
|
|
6 files changed, 186 insertions(+), 175 deletions(-)
|
|
create mode 100644 src/test.c
|
|
|
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
index 282128a..e354149 100644
|
|
--- a/src/Makefile.am
|
|
+++ b/src/Makefile.am
|
|
@@ -40,11 +40,10 @@ TESTS = \
|
|
|
|
|
|
test_m17n_SOURCES = \
|
|
- m17nutil.c \
|
|
+ test.c \
|
|
$(NULL)
|
|
test_m17n_CFLAGS = \
|
|
$(AM_CFLAGS) \
|
|
- -DDEBUG \
|
|
$(NULL)
|
|
test_m17n_LDADD = \
|
|
libm17ncommon.a \
|
|
diff --git a/src/default.xml.in.in b/src/default.xml.in.in
|
|
index 5c5d67d..dc93fd3 100644
|
|
--- a/src/default.xml.in.in
|
|
+++ b/src/default.xml.in.in
|
|
@@ -1,246 +1,197 @@
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
<engines>
|
|
<!-- This file defines the default config value for each
|
|
- engine. The "engine" elements below are checked in
|
|
- first-to-last order and a "name" element in an "engine"
|
|
- element allows wildcard patterns. Please keep more
|
|
- specific entries to appear first. -->
|
|
- <!-- Indic engines which represent languages. -->
|
|
+ engine. A "name" element in an "engine" element allows
|
|
+ wildcard patterns. "engine" elements are evaluated in
|
|
+ first-to-last order and the latter match may override the
|
|
+ existing default. -->
|
|
+ <!-- Default for other engines. -->
|
|
+ <engine>
|
|
+ <name>m17n:*</name>
|
|
+ <rank>0</rank>
|
|
+ <preedit-highlight>FALSE</preedit-highlight>
|
|
+ </engine>
|
|
+ <!-- Indic engines should be selected by default:
|
|
+ https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
|
|
+ <engine>
|
|
+ <name>m17n:as:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:bn:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:gu:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:hi:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:kn:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ks:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:mai:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ml:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:mr:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ne:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:or:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:pa:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:sa:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:sd:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:si:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:ta:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <engine>
|
|
+ <name>m17n:te:*</name>
|
|
+ <rank>1</rank>
|
|
+ </engine>
|
|
+ <!-- Assign higher rank to Indic engines which represent each
|
|
+ language. -->
|
|
<engine>
|
|
<name>m17n:as:phonetic</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:bn:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:gu:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:hi:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:kn:kgp</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:ks:kbd</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:mai:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:ml:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:mr:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:ne:rom</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:or:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:pa:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:sa:harvard-kyoto</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:sd:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:si:wijesekera</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:ta:tamil99</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:te:inscript</name>
|
|
<rank>2</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
</engine>
|
|
- <!-- Samanala should have lower rank than other Sinhala
|
|
- engines since it is the only non-keyboard input method in
|
|
- Sinhala. -->
|
|
+ <!-- Assign lower rank to Sinhala Samanala since it is a
|
|
+ non-keyboard input method in Sinhala. -->
|
|
<engine>
|
|
<name>m17n:si:samanala</name>
|
|
<rank>0</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <!-- Chinese and Japanese engines which require preedit decoration. -->
|
|
- <engine>
|
|
- <name>m17n:ja:anthy</name>
|
|
- <rank>0</rank>
|
|
- <preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
+ <!-- Some CJK engines use preedit. -->
|
|
<engine>
|
|
<name>m17n:zh:cangjie</name>
|
|
- <rank>0</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:zh:py-b5</name>
|
|
- <rank>0</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:zh:py-gb</name>
|
|
- <rank>0</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:zh:py</name>
|
|
- <rank>0</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:zh:quick</name>
|
|
- <rank>0</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:zh:tonepy-b5</name>
|
|
- <rank>0</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:zh:tonepy-gb</name>
|
|
- <rank>0</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
<name>m17n:zh:tonepy</name>
|
|
- <rank>0</rank>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
<engine>
|
|
- <name>m17n:zh:util</name>
|
|
- <rank>0</rank>
|
|
+ <name>m17n:ja:anthy</name>
|
|
<preedit-highlight>TRUE</preedit-highlight>
|
|
</engine>
|
|
- <!-- Other Indic engines should be selected by default:
|
|
- https://bugzilla.redhat.com/show_bug.cgi?id=640896 -->
|
|
- <engine>
|
|
- <name>m17n:as:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:bn:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:gu:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:hi:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:kn:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:ks:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:mai:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:ml:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:mr:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:ne:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:or:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:pa:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:sa:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:sd:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:si:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:ta:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <engine>
|
|
- <name>m17n:te:*</name>
|
|
- <rank>1</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
- <!-- Default for other engines. -->
|
|
- <engine>
|
|
- <name>m17n:*</name>
|
|
- <rank>0</rank>
|
|
- <preedit-highlight>FALSE</preedit-highlight>
|
|
- </engine>
|
|
</engines>
|
|
diff --git a/src/engine.c b/src/engine.c
|
|
index cfb853c..dcff0c7 100644
|
|
--- a/src/engine.c
|
|
+++ b/src/engine.c
|
|
@@ -290,6 +290,8 @@ ibus_m17n_engine_class_init (IBusM17NEngineClass *klass)
|
|
&klass->lookup_table_orientation))
|
|
klass->lookup_table_orientation = IBUS_ORIENTATION_SYSTEM;
|
|
|
|
+ ibus_m17n_engine_config_free (engine_config);
|
|
+
|
|
g_signal_connect (config, "value-changed",
|
|
G_CALLBACK(ibus_m17n_config_value_changed),
|
|
klass);
|
|
diff --git a/src/m17nutil.c b/src/m17nutil.c
|
|
index 42aa8f6..b06f71d 100644
|
|
--- a/src/m17nutil.c
|
|
+++ b/src/m17nutil.c
|
|
@@ -13,12 +13,18 @@ static MConverter *utf8_converter = NULL;
|
|
|
|
#define DEFAULT_XML (SETUPDIR "/default.xml")
|
|
|
|
-struct _IBusM17NEngineConfigNode {
|
|
+typedef enum {
|
|
+ ENGINE_CONFIG_RANK_MASK = 1 << 0,
|
|
+ ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK = 1 << 1
|
|
+} EngineConfigMask;
|
|
+
|
|
+struct _EngineConfigNode {
|
|
gchar *name;
|
|
+ EngineConfigMask mask;
|
|
IBusM17NEngineConfig config;
|
|
};
|
|
|
|
-typedef struct _IBusM17NEngineConfigNode IBusM17NEngineConfigNode;
|
|
+typedef struct _EngineConfigNode EngineConfigNode;
|
|
|
|
static GSList *config_list = NULL;
|
|
|
|
@@ -257,20 +263,31 @@ ibus_m17n_list_engines (void)
|
|
IBusM17NEngineConfig *
|
|
ibus_m17n_get_engine_config (const gchar *engine_name)
|
|
{
|
|
+ IBusM17NEngineConfig *config = g_slice_new0 (IBusM17NEngineConfig);
|
|
GSList *p;
|
|
|
|
for (p = config_list; p != NULL; p = p->next) {
|
|
- IBusM17NEngineConfigNode *cnode = p->data;
|
|
+ EngineConfigNode *cnode = p->data;
|
|
|
|
- if (g_pattern_match_simple (cnode->name, engine_name))
|
|
- return &cnode->config;
|
|
+ if (g_pattern_match_simple (cnode->name, engine_name)) {
|
|
+ if (cnode->mask & ENGINE_CONFIG_RANK_MASK)
|
|
+ config->rank = cnode->config.rank;
|
|
+ if (cnode->mask & ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK)
|
|
+ config->preedit_highlight = cnode->config.preedit_highlight;
|
|
+ }
|
|
}
|
|
- g_return_val_if_reached (NULL);
|
|
+ return config;
|
|
+}
|
|
+
|
|
+void
|
|
+ibus_m17n_engine_config_free (IBusM17NEngineConfig *config)
|
|
+{
|
|
+ g_slice_free (IBusM17NEngineConfig, config);
|
|
}
|
|
|
|
static gboolean
|
|
-ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
|
|
- XMLNode *node)
|
|
+ibus_m17n_engine_config_parse_xml_node (EngineConfigNode *cnode,
|
|
+ XMLNode *node)
|
|
{
|
|
GList *p;
|
|
|
|
@@ -284,6 +301,7 @@ ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
|
|
}
|
|
if (g_strcmp0 (sub_node->name , "rank") == 0) {
|
|
cnode->config.rank = atoi (sub_node->text);
|
|
+ cnode->mask |= ENGINE_CONFIG_RANK_MASK;
|
|
continue;
|
|
}
|
|
if (g_strcmp0 (sub_node->name , "preedit-highlight") == 0) {
|
|
@@ -292,6 +310,7 @@ ibus_m17n_engine_config_parse_xml_node (IBusM17NEngineConfigNode *cnode,
|
|
else if (g_ascii_strcasecmp ("FALSE", sub_node->text) != 0)
|
|
g_warning ("<%s> element contains invalid boolean value %s",
|
|
sub_node->name, sub_node->text);
|
|
+ cnode->mask |= ENGINE_CONFIG_PREEDIT_HIGHLIGHT_MASK;
|
|
continue;
|
|
}
|
|
g_warning ("<engine> element contains invalid element <%s>",
|
|
@@ -320,7 +339,7 @@ ibus_m17n_get_component (void)
|
|
if (node && g_strcmp0 (node->name, "engines") == 0) {
|
|
for (p = node->sub_nodes; p != NULL; p = p->next) {
|
|
XMLNode *sub_node = p->data;
|
|
- IBusM17NEngineConfigNode *cnode;
|
|
+ EngineConfigNode *cnode;
|
|
|
|
if (g_strcmp0 (sub_node->name, "engine") != 0) {
|
|
g_warning ("<engines> element contains invalid element <%s>",
|
|
@@ -328,9 +347,9 @@ ibus_m17n_get_component (void)
|
|
continue;
|
|
}
|
|
|
|
- cnode = g_slice_new0 (IBusM17NEngineConfigNode);
|
|
+ cnode = g_slice_new0 (EngineConfigNode);
|
|
if (!ibus_m17n_engine_config_parse_xml_node (cnode, sub_node)) {
|
|
- g_slice_free (IBusM17NEngineConfigNode, cnode);
|
|
+ g_slice_free (EngineConfigNode, cnode);
|
|
continue;
|
|
}
|
|
config_list = g_slist_prepend (config_list, cnode);
|
|
@@ -448,30 +467,3 @@ ibus_m17n_config_get_int (IBusConfig *config,
|
|
return FALSE;
|
|
#endif /* !IBUS_CHECK_VERSION(1,3,99) */
|
|
}
|
|
-
|
|
-#ifdef DEBUG
|
|
-#include <locale.h>
|
|
-
|
|
-int main ()
|
|
-{
|
|
- IBusComponent *component;
|
|
- GString *output;
|
|
-
|
|
- setlocale (LC_ALL, "");
|
|
- ibus_init ();
|
|
- ibus_m17n_init_common ();
|
|
-
|
|
- component = ibus_m17n_get_component ();
|
|
-
|
|
- output = g_string_new ("");
|
|
-
|
|
- ibus_component_output (component, output, 1);
|
|
-
|
|
- g_debug ("\n%s", output->str);
|
|
-
|
|
- g_string_free (output, TRUE);
|
|
- g_object_unref (component);
|
|
-
|
|
- return 0;
|
|
-}
|
|
-#endif
|
|
diff --git a/src/m17nutil.h b/src/m17nutil.h
|
|
index f083194..313e7bc 100644
|
|
--- a/src/m17nutil.h
|
|
+++ b/src/m17nutil.h
|
|
@@ -30,6 +30,7 @@ gunichar *ibus_m17n_mtext_to_ucs4 (MText *text,
|
|
guint ibus_m17n_parse_color (const gchar *hex);
|
|
IBusM17NEngineConfig
|
|
*ibus_m17n_get_engine_config (const gchar *engine_name);
|
|
+void ibus_m17n_engine_config_free (IBusM17NEngineConfig *config);
|
|
void ibus_m17n_config_set_string (IBusConfig *config,
|
|
const gchar *section,
|
|
const gchar *name,
|
|
diff --git a/src/test.c b/src/test.c
|
|
new file mode 100644
|
|
index 0000000..0908818
|
|
--- /dev/null
|
|
+++ b/src/test.c
|
|
@@ -0,0 +1,66 @@
|
|
+/* vim:set et sts=4: */
|
|
+#ifdef HAVE_CONFIG_H
|
|
+#include <config.h>
|
|
+#endif
|
|
+
|
|
+#include <ibus.h>
|
|
+#include <locale.h>
|
|
+#include "m17nutil.h"
|
|
+
|
|
+static void
|
|
+test_output_component (void)
|
|
+{
|
|
+ IBusComponent *component;
|
|
+ GString *output;
|
|
+
|
|
+ component = ibus_m17n_get_component ();
|
|
+
|
|
+ output = g_string_new ("");
|
|
+
|
|
+ ibus_component_output (component, output, 1);
|
|
+
|
|
+ g_debug ("\n%s", output->str);
|
|
+
|
|
+ g_string_free (output, TRUE);
|
|
+ g_object_unref (component);
|
|
+}
|
|
+
|
|
+static void
|
|
+test_engine_config (void)
|
|
+{
|
|
+ IBusM17NEngineConfig *config;
|
|
+
|
|
+ config = ibus_m17n_get_engine_config ("m17n:non:exsistent");
|
|
+ g_assert_cmpint (config->rank, ==, 0);
|
|
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
|
|
+ ibus_m17n_engine_config_free (config);
|
|
+
|
|
+ config = ibus_m17n_get_engine_config ("m17n:si:wijesekera");
|
|
+ g_assert_cmpint (config->rank, ==, 2);
|
|
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
|
|
+ ibus_m17n_engine_config_free (config);
|
|
+
|
|
+ config = ibus_m17n_get_engine_config ("m17n:si:phonetic-dynamic");
|
|
+ g_assert_cmpint (config->rank, ==, 1);
|
|
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
|
|
+ ibus_m17n_engine_config_free (config);
|
|
+
|
|
+ config = ibus_m17n_get_engine_config ("m17n:si:samanala");
|
|
+ g_assert_cmpint (config->rank, ==, 0);
|
|
+ g_assert_cmpint (config->preedit_highlight, ==, 0);
|
|
+ ibus_m17n_engine_config_free (config);
|
|
+}
|
|
+
|
|
+int main (int argc, char **argv)
|
|
+{
|
|
+ setlocale (LC_ALL, "");
|
|
+ ibus_init ();
|
|
+ ibus_m17n_init_common ();
|
|
+
|
|
+ g_test_init (&argc, &argv, NULL);
|
|
+
|
|
+ g_test_add_func ("/test-m17n/output-component", test_output_component);
|
|
+ g_test_add_func ("/test-m17n/engine-config", test_engine_config);
|
|
+
|
|
+ return g_test_run ();
|
|
+}
|
|
--
|
|
1.7.6.2
|
|
|