From ae6ef44de8fabb6728b66d95147d99f0a0d13880 Mon Sep 17 00:00:00 2001 From: William Hua Date: Thu, 27 Jun 2013 01:04:55 -0400 Subject: Continued tests work-in-progress. --- .bzrignore | 1 + configure.ac | 4 ++-- data/Makefile.am | 4 ++-- lib/Makefile.am | 4 ++-- lib/main.vala | 2 +- po/indicator-keyboard.pot | 2 +- tests/Makefile.am | 6 ++++-- tests/config.vala.in | 1 + tests/indicator-keyboard-service.in | 1 + tests/main.vala | 25 ++++++++++++++++++++++--- tests/profiles/indicator-keyboard-test | 1 + tests/services/ca.desrt.dconf.service | 3 +++ 12 files changed, 41 insertions(+), 13 deletions(-) create mode 100644 tests/profiles/indicator-keyboard-test create mode 100644 tests/services/ca.desrt.dconf.service diff --git a/.bzrignore b/.bzrignore index 86f8dccb..66db2b25 100644 --- a/.bzrignore +++ b/.bzrignore @@ -31,4 +31,5 @@ po/stamp-it tests/config.vala tests/indicator-keyboard-service tests/indicator-keyboard-test +tests/indicator-keyboard-test.trs tests/services/indicator-keyboard.service diff --git a/configure.ac b/configure.ac index e9bb7592..4674acc5 100644 --- a/configure.ac +++ b/configure.ac @@ -79,8 +79,8 @@ AC_CONFIG_FILES([Makefile po/Makefile.in tests/Makefile tests/config.vala - tests/indicator-keyboard-service - tests/services/indicator-keyboard.service], + tests/services/indicator-keyboard.service]) +AC_CONFIG_FILES([tests/indicator-keyboard-service], [chmod +x tests/indicator-keyboard-service]) AC_OUTPUT diff --git a/data/Makefile.am b/data/Makefile.am index 61be4ab1..06603061 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -1,11 +1,11 @@ +noinst_PROGRAMS = indicator-keyboard-icon-generator + AM_CFLAGS = -w -DGNOME_DESKTOP_USE_UNSTABLE_API AM_LDFLAGS = -lm AM_VALAFLAGS = --enable-experimental-non-null \ --metadatadir $(top_srcdir)/deps \ --vapidir $(top_srcdir)/deps -noinst_PROGRAMS = indicator-keyboard-icon-generator - indicator_keyboard_icon_generator_SOURCES = main.vala \ $(top_srcdir)/lib/common.vala indicator_keyboard_icon_generator_VALAFLAGS = $(AM_VALAFLAGS) \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 1d88add2..3fca1215 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1,11 +1,11 @@ +libexec_PROGRAMS = indicator-keyboard-service + AM_CFLAGS = -w -DGNOME_DESKTOP_USE_UNSTABLE_API AM_LDFLAGS = -lm AM_VALAFLAGS = --enable-experimental-non-null \ --metadatadir $(top_srcdir)/deps \ --vapidir $(top_srcdir)/deps -libexec_PROGRAMS = indicator-keyboard-service - indicator_keyboard_service_SOURCES = main.vala \ common.vala indicator_keyboard_service_VALAFLAGS = $(AM_VALAFLAGS) \ diff --git a/lib/main.vala b/lib/main.vala index 6df1b069..7e2a6f32 100644 --- a/lib/main.vala +++ b/lib/main.vala @@ -711,7 +711,7 @@ public class Indicator.Keyboard.Service : Object { } [DBus (visible = false)] - private void handle_name_lost (DBusConnection connection, string name) { + private void handle_name_lost (DBusConnection? connection, string name) { ((!) this.loop).quit (); this.loop = null; } diff --git a/po/indicator-keyboard.pot b/po/indicator-keyboard.pot index c3aa9641..7c8c8f9e 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-06-26 08:59-0400\n" +"POT-Creation-Date: 2013-06-27 00:42-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" 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 -- cgit v1.2.3