aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2021-01-24 03:38:44 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2021-01-27 17:10:40 +0100
commitb85daf94830a3ca39d59237fdb07bc33ede1c450 (patch)
tree8d704b1d8614759da71fbe42dca737c0e2261142 /tests
parent9b8fb0492c8c05630644d840aef520f3c6b17829 (diff)
downloadayatana-indicator-keyboard-b85daf94830a3ca39d59237fdb07bc33ede1c450.tar.gz
ayatana-indicator-keyboard-b85daf94830a3ca39d59237fdb07bc33ede1c450.tar.bz2
ayatana-indicator-keyboard-b85daf94830a3ca39d59237fdb07bc33ede1c450.zip
100% re-write of the keyboard indicator in plain C.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am19
-rw-r--r--tests/autopilot/Makefile.am5
-rw-r--r--tests/autopilot/__init__.py6
-rwxr-xr-xtests/autopilot/test.sh6
-rw-r--r--tests/autopilot/tests/Makefile.am1
-rw-r--r--tests/autopilot/tests/__init__.py0
-rw-r--r--tests/autopilot/tests/test_indicator_keyboard.py60
-rw-r--r--tests/config.vala.in3
l---------tests/execute/gkbd-keyboard-display1
l---------tests/execute/gucharmap1
-rwxr-xr-xtests/execute/org.ayatana.indicator.keyboard.test.Execute3
l---------tests/execute/unity-control-center1
-rw-r--r--tests/fixture.vala125
-rw-r--r--tests/indicator-keyboard-test.in15
-rw-r--r--tests/main.vala650
-rw-r--r--tests/manual15
-rw-r--r--tests/profiles/indicator-keyboard-test1
-rw-r--r--tests/services/ayatana-indicator-keyboard.service.in3
-rw-r--r--tests/services/ca.desrt.dconf.service3
-rw-r--r--tests/services/gvfs-daemon.service3
20 files changed, 0 insertions, 921 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
deleted file mode 100644
index f3be1539..00000000
--- a/tests/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-SUBDIRS = autopilot
-TESTS = indicator-keyboard-test
-
-check_PROGRAMS = indicator-keyboard-tests
-
-AM_CFLAGS = -w
-AM_LDFLAGS = -lm
-AM_VALAFLAGS = --metadatadir $(top_srcdir)/deps \
- --vapidir $(top_srcdir)/deps
-
-indicator_keyboard_tests_SOURCES = main.vala \
- fixture.vala \
- config.vala
-indicator_keyboard_tests_VALAFLAGS = $(AM_VALAFLAGS) \
- --pkg gio-2.0
-indicator_keyboard_tests_CFLAGS = $(AM_CFLAGS) \
- $(GIO_CFLAGS)
-indicator_keyboard_tests_LDFLAGS = $(AM_LDFLAGS) \
- $(GIO_LIBS)
diff --git a/tests/autopilot/Makefile.am b/tests/autopilot/Makefile.am
deleted file mode 100644
index 2af361a7..00000000
--- a/tests/autopilot/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-autopilotdir = $(pythondir)/indicator_keyboard
-autopilot_DATA = __init__.py
-
-autopilottestsdir = $(autopilotdir)/tests
-autopilottests_DATA = tests/__init__.py tests/test_indicator_keyboard.py
diff --git a/tests/autopilot/__init__.py b/tests/autopilot/__init__.py
deleted file mode 100644
index c9bdd5c3..00000000
--- a/tests/autopilot/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
-# Copyright 2013 Canonical
-#
-# This file is part of indicator-keyboard.
-
-"""indicator-keyboard autopilot tests - top level package."""
diff --git a/tests/autopilot/test.sh b/tests/autopilot/test.sh
deleted file mode 100755
index 7c3a0ad4..00000000
--- a/tests/autopilot/test.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-for name in `autopilot list tests | head -n -3 | tail -n +3`
-do
- autopilot run $name || exit 1
-done
diff --git a/tests/autopilot/tests/Makefile.am b/tests/autopilot/tests/Makefile.am
deleted file mode 100644
index 06deff91..00000000
--- a/tests/autopilot/tests/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-check_PYTHON = __init__.py test_indicator_keyboard.py
diff --git a/tests/autopilot/tests/__init__.py b/tests/autopilot/tests/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/tests/autopilot/tests/__init__.py
+++ /dev/null
diff --git a/tests/autopilot/tests/test_indicator_keyboard.py b/tests/autopilot/tests/test_indicator_keyboard.py
deleted file mode 100644
index 0ef197db..00000000
--- a/tests/autopilot/tests/test_indicator_keyboard.py
+++ /dev/null
@@ -1,60 +0,0 @@
-import autopilot.introspection.gtk
-import os
-import pyatspi.registry
-import pyatspi.utils
-import time
-import unity.tests
-
-def print_accessible(root, level=0):
- print level * ' ', root
-
- for node in root:
- print_accessible(node, level + 1)
-
-def get_accessible_with_name_and_role(root, name, role):
- is_accessible = lambda a: a.name == name and a.get_role_name() == role
- return pyatspi.utils.findDescendant(root, is_accessible, True);
-
-def get_panel_accessible(root):
- return get_accessible_with_name_and_role(root, 'unity-panel-service', 'application')
-
-def is_indicator_accessible(root):
- return root.get_role_name() == 'panel' and \
- len(root) == 1 and \
- root[0].get_role_name() == 'image' and \
- len(root[0]) == 1 and \
- root[0][0].get_role_name() == 'menu' and \
- len(root[0][0]) > 3 and \
- root[0][0][-3].name == 'Character Map' and \
- root[0][0][-3].get_role_name() == 'check menu item' and \
- root[0][0][-2].name == 'Keyboard Layout Chart' and \
- root[0][0][-2].get_role_name() == 'check menu item' and \
- root[0][0][-1].name == 'Text Entry Settings...' and \
- root[0][0][-1].get_role_name() == 'check menu item'
-
-def get_indicator_accessible(root):
- return pyatspi.utils.findDescendant(root, is_indicator_accessible, True)
-
-def get_accessible_index(root, node):
- for i in xrange(len(root)):
- if root[i] == node:
- return i
-
- return -1
-
-class IndicatorKeyboardTestCase(unity.tests.UnityTestCase):
-
- def setUp(self):
- super(IndicatorKeyboardTestCase, self).setUp()
-
- registry = pyatspi.registry.Registry()
- desktop = registry.getDesktop(0)
- panel = get_panel_accessible(desktop)
- self.indicator = get_indicator_accessible(panel)
-
- # This is needed on systems other than the EN locale
- os.putenv("LC_ALL", "C")
- self.addCleanup(os.unsetenv, "LC_ALL")
-
- def test_indicator(self):
- print_accessible(self.indicator)
diff --git a/tests/config.vala.in b/tests/config.vala.in
deleted file mode 100644
index ef533d33..00000000
--- a/tests/config.vala.in
+++ /dev/null
@@ -1,3 +0,0 @@
-const string DCONF_PROFILE = "@abs_top_builddir@/tests/profiles/indicator-keyboard-test";
-const string SERVICE_DIR = "@abs_top_builddir@/tests/services";
-const string XDG_RUNTIME_DIR = "@abs_top_builddir@/tests";
diff --git a/tests/execute/gkbd-keyboard-display b/tests/execute/gkbd-keyboard-display
deleted file mode 120000
index 0d3a8512..00000000
--- a/tests/execute/gkbd-keyboard-display
+++ /dev/null
@@ -1 +0,0 @@
-org.ayatana.indicator.keyboard.test.Execute \ No newline at end of file
diff --git a/tests/execute/gucharmap b/tests/execute/gucharmap
deleted file mode 120000
index 0d3a8512..00000000
--- a/tests/execute/gucharmap
+++ /dev/null
@@ -1 +0,0 @@
-org.ayatana.indicator.keyboard.test.Execute \ No newline at end of file
diff --git a/tests/execute/org.ayatana.indicator.keyboard.test.Execute b/tests/execute/org.ayatana.indicator.keyboard.test.Execute
deleted file mode 100755
index 58b0ce87..00000000
--- a/tests/execute/org.ayatana.indicator.keyboard.test.Execute
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-gdbus call -e -d org.ayatana.indicator.keyboard.test -o /org/ayatana/indicator/keyboard/test -m org.ayatana.indicator.keyboard.test.Execute "\'`basename $0` $*\'"
diff --git a/tests/execute/unity-control-center b/tests/execute/unity-control-center
deleted file mode 120000
index 0d3a8512..00000000
--- a/tests/execute/unity-control-center
+++ /dev/null
@@ -1 +0,0 @@
-org.ayatana.indicator.keyboard.test.Execute \ No newline at end of file
diff --git a/tests/fixture.vala b/tests/fixture.vala
deleted file mode 100644
index 7adc434f..00000000
--- a/tests/fixture.vala
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2014 Canonical Ltd.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Michal Hruby <michal.hruby@canonical.com>
- *
- * This file is taken from libunity.
- */
-
-/* A bit of magic to get proper-ish fixture support */
-public interface Fixture : Object
-{
- class DelegateWrapper
- {
- TestDataFunc func;
- public DelegateWrapper (owned TestDataFunc f) { func = (owned) f; }
- }
-
- public virtual void setup () {}
- public virtual void teardown () {}
-
- [CCode (has_target = false)]
- public delegate void Callback<T> (T ptr);
-
- private static List<DelegateWrapper> _tests;
-
- public static unowned TestDataFunc create<F> (Callback<void*> cb)
- requires (typeof (F).is_a (typeof (Fixture)))
- {
- TestDataFunc functor = () =>
- {
- var type = typeof (F);
- var instance = Object.new (type) as Fixture;
- instance.setup ();
- cb (instance);
- instance.teardown ();
- };
- unowned TestDataFunc copy = functor;
- _tests.append (new DelegateWrapper ((owned) functor));
- return copy;
- }
- public static unowned TestDataFunc create_static<F> (Callback<F> cb)
- {
- return create<F> ((Callback<void*>) cb);
- }
-}
-
-public static bool run_with_timeout (MainLoop ml, uint timeout_ms = 5000)
-{
- bool timeout_reached = false;
- var t_id = Timeout.add (timeout_ms, () =>
- {
- timeout_reached = true;
- debug ("Timeout reached");
- ml.quit ();
- return false;
- });
-
- ml.run ();
-
- if (!timeout_reached) Source.remove (t_id);
-
- return !timeout_reached;
-}
-
-/* calling this will ensure that the object was destroyed, but note that
- * it needs to be called with the (owned) modifier */
-public static void ensure_destruction (owned Object obj)
-{
- var ml = new MainLoop ();
- bool destroyed = false;
- obj.weak_ref (() => { destroyed = true; ml.quit (); });
-
- obj = null;
- if (!destroyed)
- {
- // wait a bit if there were async operations
- assert (run_with_timeout (ml));
- }
-}
-
-public class ErrorHandler
-{
- public ErrorHandler ()
- {
- GLib.Test.log_set_fatal_handler (handle_fatal_func);
- }
-
- private bool handle_fatal_func (string? log_domain, LogLevelFlags flags,
- string message)
- {
- return false;
- }
-
- private uint[] handler_ids;
- private GenericArray<string?> handler_domains;
-
- public void ignore_message (string? domain, LogLevelFlags flags)
- {
- handler_ids += Log.set_handler (domain, flags | LogLevelFlags.FLAG_FATAL,
- () => {});
- if (handler_domains == null)
- {
- handler_domains = new GenericArray<string?> ();
- }
- handler_domains.add (domain);
- }
-
- ~ErrorHandler ()
- {
- for(uint i = 0; i < handler_ids.length; i++)
- Log.remove_handler (handler_domains[i], handler_ids[i]);
- }
-}
diff --git a/tests/indicator-keyboard-test.in b/tests/indicator-keyboard-test.in
deleted file mode 100644
index 8c20f6bf..00000000
--- a/tests/indicator-keyboard-test.in
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-export PATH="@abs_top_builddir@/tests/execute:$PATH"
-export DCONF_PROFILE="@abs_top_builddir@/tests/profiles/indicator-keyboard-test"
-export GSETTINGS_SCHEMA_DIR="@abs_top_builddir@/data"
-export XDG_RUNTIME_DIR="@abs_top_builddir@/tests"
-export GTK_IM_MODULE="ibus"
-export GDK_BACKEND="x11"
-
-if xvfb-run -a ./indicator-keyboard-tests
-then
- pkill -f tests/gvfs || exit 0
-else
- pkill -f tests/gvfs && exit 1
-fi
diff --git a/tests/main.vala b/tests/main.vala
deleted file mode 100644
index 71e5e4a6..00000000
--- a/tests/main.vala
+++ /dev/null
@@ -1,650 +0,0 @@
-/*
- * Copyright 2013 Canonical Ltd.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- * Authors: William Hua <william.hua@canonical.com>
- */
-
-const int TIMEOUT_S = 1;
-const int TIMEOUT_MS = 1000;
-const int LONG_TIMEOUT_S = 10;
-
-static string display;
-
-[DBus (name = "org.ayatana.indicator.keyboard.test")]
-public class Service : Object {
-
- [DBus (visible = false)]
- private string? _command;
-
- [DBus (visible = false)]
- public string? command {
- get { return _command; }
- }
-
- public void execute (string command) {
- _command = command;
-
- var pspec = get_class ().find_property ("command");
-
- if (pspec != null) {
- notify["command"] ((!) pspec);
- }
- }
-}
-
-public class Tests : Object, Fixture {
-
- private TestDBus? _bus;
- private uint _service_name;
- private DBusConnection? _connection;
- private Service? _service;
- private uint _object_name;
-
- public void start_service () {
- if (_connection != null) {
- try {
- _service = new Service ();
- _object_name = ((!) _connection).register_object ("/org/ayatana/indicator/keyboard/test", _service);
- } catch (IOError error) {
- _connection = null;
- _service = null;
- _object_name = 0;
-
- Test.message ("error: %s", error.message);
- Test.fail ();
- }
- }
- }
-
- public void setup () {
- Environment.set_variable ("DCONF_PROFILE", DCONF_PROFILE, true);
- Environment.set_variable ("DISPLAY", display, true);
- Environment.set_variable ("LC_ALL", "C", true);
-
- _bus = new TestDBus (TestDBusFlags.NONE);
- ((!) _bus).add_service_dir (SERVICE_DIR);
- ((!) _bus).up ();
-
- Environment.set_variable ("XDG_RUNTIME_DIR", XDG_RUNTIME_DIR, true);
-
- var loop = new MainLoop (null, false);
-
- _service_name = Bus.own_name (BusType.SESSION,
- "org.ayatana.indicator.keyboard.test",
- BusNameOwnerFlags.ALLOW_REPLACEMENT | BusNameOwnerFlags.REPLACE,
- (connection, name) => {
- if (loop.is_running ()) {
- _connection = connection;
- start_service ();
- loop.quit ();
- }
- },
- null,
- (connection, name) => {
- if (loop.is_running ()) {
- _connection = null;
- _service = null;
- _object_name = 0;
- loop.quit ();
- }
- });
-
- loop.run ();
-
- if (_connection == null) {
- Test.message ("error: Unable to connect to org.ayatana.indicator.keyboard.test.");
- Test.fail ();
- }
-
- if (_object_name == 0) {
- Test.message ("error: Test fixture not initialized.");
- Test.fail ();
- return;
- }
- }
-
- public void teardown () {
- if (_object_name != 0) {
- ((!) _connection).unregister_object (_object_name);
- _object_name = 0;
- }
-
- if (_service_name != 0) {
- Bus.unown_name (_service_name);
- _service_name = 0;
- }
-
- _service = null;
- _connection = null;
-
- if (_bus != null) {
- ((!) _bus).down ();
- _bus = null;
-
- Environment.set_variable ("XDG_RUNTIME_DIR", XDG_RUNTIME_DIR, true);
- }
- }
-
- public void test_activate_input_source () {
- try {
- var current = 0;
- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- var action_group = DBusActionGroup.get ((!) _connection,
- "org.ayatana.indicator.keyboard",
- "/org/ayatana/indicator/keyboard");
- action_group.list_actions ();
- action_group.activate_action ("current", new Variant.uint32 (2));
-
- var loop = new MainLoop (null, false);
- Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return false; });
- loop.run ();
-
- var state = action_group.get_action_state ("current");
- var current = state.get_uint32 ();
- stderr.printf ("current = %u\n", current);
- assert (current == 2);
-
- try {
- string output;
- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
- stderr.printf ("output = \"%s\"\n", output);
- assert (strcmp (output, "uint32 2\n") == 0);
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
- }
-
- public void test_activate_character_map () {
- var action_group = DBusActionGroup.get ((!) _connection,
- "org.ayatana.indicator.keyboard",
- "/org/ayatana/indicator/keyboard");
- var loop = new MainLoop (null, false);
- var signal_name = ((!) _service).notify["command"].connect ((pspec) => {
- loop.quit ();
- });
-
- action_group.activate_action ("map", null);
-
- var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- ((!) _service).disconnect (signal_name);
-
- stderr.printf ("_service.command = \"%s\"\n", (!) ((!) _service).command);
- assert (strcmp ((!) ((!) _service).command, "'gucharmap '") == 0);
- }
-
- public void test_activate_keyboard_layout_chart () {
- try {
- var current = 1;
- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- var action_group = DBusActionGroup.get ((!) _connection,
- "org.ayatana.indicator.keyboard",
- "/org/ayatana/indicator/keyboard");
- var loop = new MainLoop (null, false);
- var signal_name = ((!) _service).notify["command"].connect ((pspec) => {
- loop.quit ();
- });
-
- action_group.activate_action ("chart", null);
-
- var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- ((!) _service).disconnect (signal_name);
-
- stderr.printf ("_service.command = \"%s\"\n", (!) ((!) _service).command);
- assert (strcmp ((!) ((!) _service).command, "'gkbd-keyboard-display -l ca\teng'") == 0);
- }
-
- public void test_activate_text_entry_settings () {
- var action_group = DBusActionGroup.get ((!) _connection,
- "org.ayatana.indicator.keyboard",
- "/org/ayatana/indicator/keyboard");
- var loop = new MainLoop (null, false);
- var signal_name = ((!) _service).notify["command"].connect ((pspec) => {
- loop.quit ();
- });
-
- action_group.activate_action ("settings", null);
-
- var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- ((!) _service).disconnect (signal_name);
-
- stderr.printf ("_service.command = \"%s\"\n", (!) ((!) _service).command);
- assert (strcmp ((!) ((!) _service).command, "'unity-control-center region layouts'") == 0);
- }
-
- public void test_migration () {
- try {
- var migrated = false;
- var sources = "[('xkb', 'us')]";
- var layouts = "['us', 'ca\teng', 'epo']";
- Process.spawn_command_line_sync (@"gsettings set org.ayatana.indicator.keyboard migrated $migrated");
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
- Process.spawn_command_line_sync (@"gsettings set org.gnome.libgnomekbd.keyboard layouts \"$layouts\"");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- try {
- var cancellable = new Cancellable ();
-
- var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { cancellable.cancel (); return true; });
-
- var dbus_proxy = new DBusProxy.sync ((!) _connection,
- DBusProxyFlags.NONE,
- null,
- "org.freedesktop.DBus",
- "/",
- "org.freedesktop.DBus",
- cancellable);
-
- Source.remove (source);
-
- if (cancellable.is_cancelled ()) {
- Test.message ("error: Unable to connect to org.freedesktop.DBus.");
- Test.fail ();
- return;
- }
-
- dbus_proxy.call_sync ("StartServiceByName", new Variant ("(su)", "org.ayatana.indicator.keyboard", 0), DBusCallFlags.NONE, TIMEOUT_MS);
- } catch (Error error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- 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);
- stderr.printf ("sources = \"%s\"\n", sources);
- assert (strcmp (sources, "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo')]\n") == 0);
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
- }
-
- public void test_no_migration () {
- try {
- var migrated = true;
- var sources = "[('xkb', 'us')]";
- var layouts = "['us', 'ca\teng', 'epo']";
- Process.spawn_command_line_sync (@"gsettings set org.ayatana.indicator.keyboard migrated $migrated");
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
- Process.spawn_command_line_sync (@"gsettings set org.gnome.libgnomekbd.keyboard layouts \"$layouts\"");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- try {
- var cancellable = new Cancellable ();
-
- var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { cancellable.cancel (); return true; });
-
- var dbus_proxy = new DBusProxy.sync ((!) _connection,
- DBusProxyFlags.NONE,
- null,
- "org.freedesktop.DBus",
- "/",
- "org.freedesktop.DBus",
- cancellable);
-
- Source.remove (source);
-
- if (cancellable.is_cancelled ()) {
- Test.message ("error: Unable to connect to org.freedesktop.DBus.");
- Test.fail ();
- return;
- }
-
- dbus_proxy.call_sync ("StartServiceByName", new Variant ("(su)", "org.ayatana.indicator.keyboard", 0), DBusCallFlags.NONE, TIMEOUT_MS);
- } catch (Error error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- 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);
- stderr.printf ("sources = \"%s\"\n", sources);
- assert (strcmp (sources, "[('xkb', 'us')]\n") == 0);
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
- }
-
- public void test_update_visible () {
- bool visible;
-
- try {
- visible = true;
- Process.spawn_command_line_sync (@"gsettings set org.ayatana.indicator.keyboard visible $visible");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- var action_group = DBusActionGroup.get ((!) _connection,
- "org.ayatana.indicator.keyboard",
- "/org/ayatana/indicator/keyboard");
- var loop = new MainLoop (null, false);
- var signal_name = action_group.action_added["indicator"].connect ((action) => {
- loop.quit ();
- });
-
- action_group.list_actions ();
-
- var source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- action_group.disconnect (signal_name);
-
- var state = action_group.get_action_state ("indicator");
- assert (state.lookup ("visible", "b", out visible));
- stderr.printf ("visible = %s\n", visible ? "true" : "false");
- assert (visible);
-
- loop = new MainLoop (null, false);
- signal_name = action_group.action_state_changed["indicator"].connect ((action, state) => {
- loop.quit ();
- });
-
- try {
- visible = false;
- Process.spawn_command_line_sync (@"gsettings set org.ayatana.indicator.keyboard visible $visible");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- action_group.disconnect (signal_name);
-
- state = action_group.get_action_state ("indicator");
- assert (state.lookup ("visible", "b", out visible));
- stderr.printf ("visible = %s\n", visible ? "true" : "false");
- assert (!visible);
-
- loop = new MainLoop (null, false);
- signal_name = action_group.action_state_changed["indicator"].connect ((action, state) => {
- loop.quit ();
- });
-
- try {
- visible = true;
- Process.spawn_command_line_sync (@"gsettings set org.ayatana.indicator.keyboard visible $visible");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- action_group.disconnect (signal_name);
-
- state = action_group.get_action_state ("indicator");
- assert (state.lookup ("visible", "b", out visible));
- stderr.printf ("visible = %s\n", visible ? "true" : "false");
- assert (visible);
- }
-
- public void test_update_input_source () {
- try {
- var current = 0;
- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- var action_group = DBusActionGroup.get ((!) _connection,
- "org.ayatana.indicator.keyboard",
- "/org/ayatana/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 ();
-
- try {
- var current = 1;
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- action_group.disconnect (signal_name);
-
- var state = action_group.get_action_state ("current");
- var current = state.get_uint32 ();
- stderr.printf ("current = %u\n", current);
- assert (current == 1);
-
- try {
- string output;
- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
- stderr.printf ("output = \"%s\"\n", output);
- assert (strcmp (output, "uint32 1\n") == 0);
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- loop = new MainLoop (null, false);
- signal_name = action_group.action_state_changed["current"].connect ((action, state) => {
- loop.quit ();
- });
-
- try {
- current = 0;
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- action_group.disconnect (signal_name);
-
- state = action_group.get_action_state ("current");
- current = state.get_uint32 ();
- stderr.printf ("current = %u\n", current);
- assert (current == 0);
-
- try {
- string output;
- Process.spawn_command_line_sync ("gsettings get org.gnome.desktop.input-sources current", out output);
- stderr.printf ("output = \"%s\"\n", output);
- assert (strcmp (output, "uint32 0\n") == 0);
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
- }
-
- public void test_update_input_sources () {
- try {
- var current = 0;
- var sources = "[('xkb', 'us')]";
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources current $current");
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- var menu_model = DBusMenuModel.get ((!) _connection,
- "org.ayatana.indicator.keyboard",
- "/org/ayatana/indicator/keyboard/desktop");
- var loop = new MainLoop (null, false);
- var signal_name = menu_model.items_changed.connect ((position, removed, added) => {
- loop.quit ();
- });
-
- menu_model.get_n_items ();
-
- var source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- menu_model.disconnect (signal_name);
-
- var menu = menu_model.get_item_link (0, Menu.LINK_SUBMENU);
- loop = new MainLoop (null, false);
- signal_name = menu.items_changed.connect ((position, removed, added) => {
- loop.quit ();
- });
-
- menu.get_n_items ();
-
- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- menu.disconnect (signal_name);
-
- var section = menu.get_item_link (0, Menu.LINK_SECTION);
- loop = new MainLoop (null, false);
- signal_name = section.items_changed.connect ((position, removed, added) => {
- loop.quit ();
- });
-
- section.get_n_items ();
-
- source = Timeout.add_seconds (TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- section.disconnect (signal_name);
-
- string label;
-
- stderr.printf ("section.get_n_items () = %d\n", section.get_n_items ());
- assert (section.get_n_items () == 1);
- section.get_item_attribute (0, Menu.ATTRIBUTE_LABEL, "s", out label);
- stderr.printf ("label = \"%s\"\n", label);
- assert (strcmp (label, "English (US)") == 0);
-
- loop = new MainLoop (null, false);
- signal_name = section.items_changed.connect ((position, removed, added) => {
- if (section.get_n_items () == 4) {
- loop.quit ();
- }
- });
-
- try {
- var sources = "[('xkb', 'us'), ('xkb', 'ca+eng'), ('xkb', 'epo'), ('ibus', 'pinyin')]";
- Process.spawn_command_line_sync (@"gsettings set org.gnome.desktop.input-sources sources \"$sources\"");
- } catch (SpawnError error) {
- Test.message ("error: %s", error.message);
- Test.fail ();
- return;
- }
-
- source = Timeout.add_seconds (LONG_TIMEOUT_S, () => { loop.quit (); return true; });
- loop.run ();
- Source.remove (source);
- section.disconnect (signal_name);
-
- stderr.printf ("section.get_n_items () = %d\n", section.get_n_items ());
- assert (section.get_n_items () == 4);
- section.get_item_attribute (0, Menu.ATTRIBUTE_LABEL, "s", out label);
- stderr.printf ("label = \"%s\"\n", label);
- assert (strcmp (label, "English (US)") == 0);
- section.get_item_attribute (1, Menu.ATTRIBUTE_LABEL, "s", out label);
- stderr.printf ("label = \"%s\"\n", label);
- assert (strcmp (label, "English (Canada)") == 0);
- section.get_item_attribute (2, Menu.ATTRIBUTE_LABEL, "s", out label);
- stderr.printf ("label = \"%s\"\n", label);
- assert (strcmp (label, "Esperanto") == 0);
- section.get_item_attribute (3, Menu.ATTRIBUTE_LABEL, "s", out label);
- stderr.printf ("label = \"%s\"\n", label);
- assert (label.ascii_casecmp ("Pinyin") == 0);
- }
-}
-
-public int main (string[] args) {
- display = Environment.get_variable ("DISPLAY");
-
- Test.init (ref args);
-
- Test.add_data_func ("/indicator-keyboard-service/activate-input-source", Fixture.create<Tests> (Tests.test_activate_input_source));
- Test.add_data_func ("/indicator-keyboard-service/activate-character-map", Fixture.create<Tests> (Tests.test_activate_character_map));
- Test.add_data_func ("/indicator-keyboard-service/activate-keyboard-layout-chart", Fixture.create<Tests> (Tests.test_activate_keyboard_layout_chart));
- Test.add_data_func ("/indicator-keyboard-service/activate-text-entry-settings", Fixture.create<Tests> (Tests.test_activate_text_entry_settings));
- Test.add_data_func ("/indicator-keyboard-service/migration", Fixture.create<Tests> (Tests.test_migration));
- Test.add_data_func ("/indicator-keyboard-service/no-migration", Fixture.create<Tests> (Tests.test_no_migration));
- Test.add_data_func ("/indicator-keyboard-service/update-visible", Fixture.create<Tests> (Tests.test_update_visible));
- Test.add_data_func ("/indicator-keyboard-service/update-input-source", Fixture.create<Tests> (Tests.test_update_input_source));
- Test.add_data_func ("/indicator-keyboard-service/update-input-sources", Fixture.create<Tests> (Tests.test_update_input_sources));
-
- return Test.run ();
-}
diff --git a/tests/manual b/tests/manual
deleted file mode 100644
index 67ee57da..00000000
--- a/tests/manual
+++ /dev/null
@@ -1,15 +0,0 @@
-
-Test-case indicator-keyboard/unity7-items-check
-<dl>
- <dt>Log in to a Unity 7 user session</dt>
- <dt>Go to the panel and click on the Keyboard indicator</dt>
- <dd>Ensure there are items in the menu</dd>
-</dl>
-
-Test-case indicator-keyboard/unity7-greeter-items-check
-<dl>
- <dt>Start a system and wait for the greeter or logout of the current user session</dt>
- <dt>Go to the panel and click on the Keyboard indicator</dt>
- <dd>Ensure there are items in the menu</dd>
-</dl>
-
diff --git a/tests/profiles/indicator-keyboard-test b/tests/profiles/indicator-keyboard-test
deleted file mode 100644
index 5268b3f5..00000000
--- a/tests/profiles/indicator-keyboard-test
+++ /dev/null
@@ -1 +0,0 @@
-service-db:shm/indicator_keyboard_test
diff --git a/tests/services/ayatana-indicator-keyboard.service.in b/tests/services/ayatana-indicator-keyboard.service.in
deleted file mode 100644
index 01b42ad1..00000000
--- a/tests/services/ayatana-indicator-keyboard.service.in
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=org.ayatana.indicator.keyboard
-Exec=@abs_top_builddir@/lib/indicator-keyboard-service
diff --git a/tests/services/ca.desrt.dconf.service b/tests/services/ca.desrt.dconf.service
deleted file mode 100644
index 7ce3879b..00000000
--- a/tests/services/ca.desrt.dconf.service
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=ca.desrt.dconf
-Exec=/usr/lib/dconf/dconf-service
diff --git a/tests/services/gvfs-daemon.service b/tests/services/gvfs-daemon.service
deleted file mode 100644
index 1a8607d6..00000000
--- a/tests/services/gvfs-daemon.service
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=org.gtk.vfs.Daemon
-Exec=/usr/lib/gvfs/gvfsd