aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hua <william.hua@canonical.com>2013-08-12 02:12:07 +0000
committerTarmac <Unknown>2013-08-12 02:12:07 +0000
commitb95b1793605426da03ca61d3c825c93bd9eaf64e (patch)
treeec407054fa0ec3ff4661055184a15a30b618fc60
parent0e3bb46532e1858f2cfee808bd66efa225cb2d94 (diff)
parent5c12e10be77351e88b6c550894e4ca34c99aacf8 (diff)
downloadayatana-indicator-keyboard-b95b1793605426da03ca61d3c825c93bd9eaf64e.tar.gz
ayatana-indicator-keyboard-b95b1793605426da03ca61d3c825c93bd9eaf64e.tar.bz2
ayatana-indicator-keyboard-b95b1793605426da03ca61d3c825c93bd9eaf64e.zip
Resolve flaky test by always forcing the delay.
The test used to kill a delay as soon as a change was observed on the action group which was activated. On slower systems, this caused an assertion failure because updating the dconf setting took much longer than getting the change notification. Approved by PS Jenkins bot, Mathieu Trudel-Lapierre.
-rw-r--r--configure.ac2
-rw-r--r--lib/main.vala8
-rw-r--r--po/indicator-keyboard.pot8
-rw-r--r--tests/main.vala18
4 files changed, 22 insertions, 14 deletions
diff --git a/configure.ac b/configure.ac
index 31640e6b..79c96c15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,7 +7,7 @@ AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
-AM_INIT_AUTOMAKE([1.11 foreign -Wall -Woverride -Wno-portability])
+AM_INIT_AUTOMAKE([1.11 foreign serial-tests -Wall -Woverride -Wno-portability])
AM_SILENT_RULES([yes])
LT_INIT
diff --git a/lib/main.vala b/lib/main.vala
index 91466f8c..d601f6f9 100644
--- a/lib/main.vala
+++ b/lib/main.vala
@@ -220,8 +220,14 @@ public class Indicator.Keyboard.Service : Object {
private void update_indicator_action () {
var visible = indicator_settings.get_boolean ("visible");
var current = source_settings.get_uint ("current");
- var icon = get_sources ()[current].icon;
+ var sources = get_sources ();
+
Variant state;
+ Icon? icon = null;
+
+ if (current < sources.length) {
+ icon = sources[current].icon;
+ }
if (icon != null) {
state = new Variant.parsed ("{ 'visible' : <%b>, 'icon' : %v }", visible, ((!) icon).serialize ());
diff --git a/po/indicator-keyboard.pot b/po/indicator-keyboard.pot
index 171c3021..b5d5cfca 100644
--- a/po/indicator-keyboard.pot
+++ b/po/indicator-keyboard.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-08-07 15:03-0400\n"
+"POT-Creation-Date: 2013-08-12 09:33+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,14 +17,14 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../lib/main.c:1405 ../lib/main.vala:322
+#: ../lib/main.c:1419 ../lib/main.vala:328
msgid "Character Map"
msgstr ""
-#: ../lib/main.c:1407 ../lib/main.vala:323
+#: ../lib/main.c:1421 ../lib/main.vala:329
msgid "Keyboard Layout Chart"
msgstr ""
-#: ../lib/main.c:1409 ../lib/main.vala:324
+#: ../lib/main.c:1423 ../lib/main.vala:330
msgid "Text Entry Settings..."
msgstr ""
diff --git a/tests/main.vala b/tests/main.vala
index d9d52733..6bbcc61a 100644
--- a/tests/main.vala
+++ b/tests/main.vala
@@ -150,18 +150,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 ();
@@ -325,6 +319,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);
@@ -387,6 +385,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);