aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/config.vala.in1
-rw-r--r--tests/indicator-keyboard-service.in1
-rw-r--r--tests/main.vala25
-rw-r--r--tests/profiles/indicator-keyboard-test1
-rw-r--r--tests/services/ca.desrt.dconf.service3
6 files changed, 32 insertions, 5 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a2143607..b4e80c02 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,11 +1,13 @@
+TESTS = indicator-keyboard-test
+
+check_PROGRAMS = indicator-keyboard-test
+
AM_CFLAGS = -w
AM_LDFLAGS = -lm
AM_VALAFLAGS = --enable-experimental-non-null \
--metadatadir $(top_srcdir)/deps \
--vapidir $(top_srcdir)/deps
-check_PROGRAMS = indicator-keyboard-test
-
indicator_keyboard_test_SOURCES = main.vala \
config.vala
indicator_keyboard_test_VALAFLAGS = $(AM_VALAFLAGS) \
diff --git a/tests/config.vala.in b/tests/config.vala.in
index a3c4aeb8..7acae9de 100644
--- a/tests/config.vala.in
+++ b/tests/config.vala.in
@@ -1 +1,2 @@
+const string DCONF_PROFILE = "@abs_top_builddir@/tests/profiles/indicator-keyboard-test";
const string SERVICE_DIR = "@abs_top_builddir@/tests/services";
diff --git a/tests/indicator-keyboard-service.in b/tests/indicator-keyboard-service.in
index 3526c571..a1f7d573 100644
--- a/tests/indicator-keyboard-service.in
+++ b/tests/indicator-keyboard-service.in
@@ -1,4 +1,5 @@
#!/bin/sh
PATH="@abs_top_builddir@/tests/execute:$PATH"
+DCONF_PROFILE="@abs_top_builddir@/tests/profiles/indicator-keyboard-test"
@abs_top_builddir@/lib/indicator-keyboard-service
diff --git a/tests/main.vala b/tests/main.vala
index 20704001..d308ef04 100644
--- a/tests/main.vala
+++ b/tests/main.vala
@@ -46,6 +46,7 @@ static void begin_test (void *data) {
(connection, name) => {
if (loop.is_running ()) {
fixture.connection = connection;
+
loop.quit ();
}
},
@@ -87,14 +88,14 @@ static void end_test (void *data) {
fixture.object_name = 0;
}
- fixture.service = null;
- fixture.connection = null;
-
if (fixture.service_name != 0) {
Bus.unown_name (fixture.service_name);
fixture.service_name = 0;
}
+ fixture.service = null;
+ fixture.connection = null;
+
if (fixture.bus != null) {
((!) fixture.bus).down ();
fixture.bus = null;
@@ -113,6 +114,10 @@ static void test_activate_character_map (void *data) {
return;
}
+ var settings = new Settings ("org.gnome.desktop.input-sources");
+ settings.set_uint ("current", 0);
+ settings.set_value ("sources", new Variant.parsed ("[('xkb', 'us'), ('ibus', 'pinyin')]"));
+
var cancellable = new Cancellable ();
DBusProxy action_proxy;
DBusProxy menu_proxy;
@@ -165,6 +170,17 @@ static void test_activate_character_map (void *data) {
return;
}
+ {
+ var builder = new VariantBuilder (new VariantType ("(au)"));
+ builder.open (new VariantType ("au"));
+ builder.add ("u", 0);
+ builder.add ("u", 1);
+ builder.close ();
+ var variant = builder.end ();
+ stdout.printf ("%s\n", menu_proxy.call_sync ("Start", variant, DBusCallFlags.NONE, SHORT_TIMEOUT).print (true));
+ menu_proxy.call_sync ("End", variant, DBusCallFlags.NONE, SHORT_TIMEOUT);
+ }
+
var loop = new MainLoop (null, false);
var signal_name = ((!) fixture.service).notify["command"].connect ((pspec) => {
@@ -199,9 +215,12 @@ static void test_update_input_source (void *data) {
}
static void test_update_input_sources (void *data) {
+ Test.fail ();
}
public int main (string[] args) {
+ Environment.set_variable ("DCONF_PROFILE", DCONF_PROFILE, true);
+
Test.init (ref args, null);
var suite = new TestSuite ("indicator-keyboard");
diff --git a/tests/profiles/indicator-keyboard-test b/tests/profiles/indicator-keyboard-test
new file mode 100644
index 00000000..e0e4915c
--- /dev/null
+++ b/tests/profiles/indicator-keyboard-test
@@ -0,0 +1 @@
+service-db:shm/test
diff --git a/tests/services/ca.desrt.dconf.service b/tests/services/ca.desrt.dconf.service
new file mode 100644
index 00000000..7ce3879b
--- /dev/null
+++ b/tests/services/ca.desrt.dconf.service
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=ca.desrt.dconf
+Exec=/usr/lib/dconf/dconf-service