aboutsummaryrefslogtreecommitdiff
path: root/tests/main.vala
diff options
context:
space:
mode:
Diffstat (limited to 'tests/main.vala')
-rw-r--r--tests/main.vala39
1 files changed, 21 insertions, 18 deletions
diff --git a/tests/main.vala b/tests/main.vala
index d9d52733..1a7833a2 100644
--- a/tests/main.vala
+++ b/tests/main.vala
@@ -18,6 +18,7 @@
const int TIMEOUT_S = 1;
const int TIMEOUT_MS = 1000;
+const int LONG_TIMEOUT_S = 10;
[DBus (name = "com.canonical.indicator.keyboard.test")]
public class Service : Object {
@@ -150,18 +151,12 @@ static void test_activate_input_source (void *data) {
var action_group = DBusActionGroup.get ((!) fixture.connection,
"com.canonical.indicator.keyboard",
"/com/canonical/indicator/keyboard");
- var loop = new MainLoop (null, false);
- var signal_name = action_group.action_state_changed["current"].connect ((action, state) => {
- loop.quit ();
- });
-
action_group.list_actions ();
action_group.activate_action ("current", new Variant.uint32 (2));
- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ var loop = new MainLoop (null, false);
+ Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
- Source.remove (source);
- action_group.disconnect (signal_name);
var state = action_group.get_action_state ("current");
var current = state.get_uint32 ();
@@ -199,7 +194,7 @@ static void test_activate_character_map (void *data) {
action_group.activate_action ("map", null);
- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
Source.remove (source);
((!) fixture.service).disconnect (signal_name);
@@ -238,7 +233,7 @@ static void test_activate_keyboard_layout_chart (void *data) {
action_group.activate_action ("chart", null);
- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
Source.remove (source);
((!) fixture.service).disconnect (signal_name);
@@ -266,7 +261,7 @@ static void test_activate_text_entry_settings (void *data) {
action_group.activate_action ("settings", null);
- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
Source.remove (source);
((!) fixture.service).disconnect (signal_name);
@@ -300,7 +295,7 @@ static void test_migration (void *data) {
try {
var cancellable = new Cancellable ();
- var source = Timeout.add_seconds (TIMEOUT_S, () => { cancellable.cancel (); return false; });
+ var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { cancellable.cancel (); return false; });
var dbus_proxy = new DBusProxy.sync ((!) fixture.connection,
DBusProxyFlags.NONE,
@@ -325,6 +320,10 @@ static void test_migration (void *data) {
return;
}
+ var loop = new MainLoop (null, false);
+ Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ loop.run ();
+
try {
string sources;
Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources sources", out sources);
@@ -362,7 +361,7 @@ static void test_no_migration (void *data) {
try {
var cancellable = new Cancellable ();
- var source = Timeout.add_seconds (TIMEOUT_S, () => { cancellable.cancel (); return false; });
+ var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { cancellable.cancel (); return false; });
var dbus_proxy = new DBusProxy.sync ((!) fixture.connection,
DBusProxyFlags.NONE,
@@ -387,6 +386,10 @@ static void test_no_migration (void *data) {
return;
}
+ var loop = new MainLoop (null, false);
+ Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ loop.run ();
+
try {
string sources;
Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources sources", out sources);
@@ -429,7 +432,7 @@ static void test_update_visible (void *data) {
action_group.list_actions ();
- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
Source.remove (source);
action_group.disconnect (signal_name);
@@ -453,7 +456,7 @@ static void test_update_visible (void *data) {
return;
}
- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
Source.remove (source);
action_group.disconnect (signal_name);
@@ -477,7 +480,7 @@ static void test_update_visible (void *data) {
return;
}
- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
Source.remove (source);
action_group.disconnect (signal_name);
@@ -562,7 +565,7 @@ static void test_update_input_source (void *data) {
return;
}
- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
Source.remove (source);
action_group.disconnect (signal_name);
@@ -669,7 +672,7 @@ static void test_update_input_sources (void *data) {
return;
}
- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
+ source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return false; });
loop.run ();
Source.remove (source);
section.disconnect (signal_name);