aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-06-27 12:10:41 -0400
committerWilliam Hua <william.hua@canonical.com>2013-06-27 12:10:41 -0400
commitaf2cd91dd1af9f2bde385428526db1e78f065c74 (patch)
tree64077583f4d93e10079a1483bd38090f5125e116 /tests
parentae6ef44de8fabb6728b66d95147d99f0a0d13880 (diff)
downloadayatana-indicator-keyboard-af2cd91dd1af9f2bde385428526db1e78f065c74.tar.gz
ayatana-indicator-keyboard-af2cd91dd1af9f2bde385428526db1e78f065c74.tar.bz2
ayatana-indicator-keyboard-af2cd91dd1af9f2bde385428526db1e78f065c74.zip
Minor fixes.
Diffstat (limited to 'tests')
-rw-r--r--tests/main.vala40
-rw-r--r--tests/profiles/indicator-keyboard-test2
2 files changed, 25 insertions, 17 deletions
diff --git a/tests/main.vala b/tests/main.vala
index d308ef04..b606121f 100644
--- a/tests/main.vala
+++ b/tests/main.vala
@@ -31,6 +31,22 @@ struct Fixture {
uint object_name;
}
+static void start_service (Fixture *fixture) {
+ if (fixture.connection != null) {
+ try {
+ fixture.service = new Service ();
+ fixture.object_name = ((!) fixture.connection).register_object ("/com/canonical/indicator/keyboard/test", fixture.service);
+ } catch (IOError error) {
+ fixture.connection = null;
+ fixture.service = null;
+ fixture.object_name = 0;
+
+ Test.message ("error: %s", error.message);
+ Test.fail ();
+ }
+ }
+}
+
static void begin_test (void *data) {
var fixture = (Fixture *) data;
@@ -47,6 +63,8 @@ static void begin_test (void *data) {
if (loop.is_running ()) {
fixture.connection = connection;
+ start_service (fixture);
+
loop.quit ();
}
},
@@ -54,27 +72,16 @@ static void begin_test (void *data) {
(connection, name) => {
if (loop.is_running ()) {
fixture.connection = null;
+ fixture.service = null;
+ fixture.object_name = 0;
+
loop.quit ();
}
});
loop.run ();
- if (fixture.connection != null) {
- try {
- fixture.service = new Service ();
- fixture.object_name = ((!) fixture.connection).register_object ("/com/canonical/indicator/keyboard/test", fixture.service);
- } catch (IOError error) {
- fixture.object_name = 0;
- fixture.service = null;
-
- Test.message ("error: %s", error.message);
- Test.fail ();
- }
- } else {
- fixture.service = null;
- fixture.object_name = 0;
-
+ if (fixture.connection == null) {
Test.message ("Unable to connect to 'com.canonical.indicator.keyboard.test'.");
Test.fail ();
}
@@ -114,6 +121,7 @@ static void test_activate_character_map (void *data) {
return;
}
+ /* XXX: bootstrap the settings with what we want to test with. */
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')]"));
@@ -170,6 +178,7 @@ static void test_activate_character_map (void *data) {
return;
}
+ /* XXX: This is just to make sure the GSettings are shared between processes. */
{
var builder = new VariantBuilder (new VariantType ("(au)"));
builder.open (new VariantType ("au"));
@@ -215,7 +224,6 @@ static void test_update_input_source (void *data) {
}
static void test_update_input_sources (void *data) {
- Test.fail ();
}
public int main (string[] args) {
diff --git a/tests/profiles/indicator-keyboard-test b/tests/profiles/indicator-keyboard-test
index e0e4915c..87f5ecb0 100644
--- a/tests/profiles/indicator-keyboard-test
+++ b/tests/profiles/indicator-keyboard-test
@@ -1 +1 @@
-service-db:shm/test
+service-db:shm/indicator/keyboard/test