From 225b2434463bfc2f57608a76407fead8b662ee1f Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Fri, 13 Sep 2019 15:55:26 +0000 Subject: [PATCH] tests: Describe how to test --- README.md | 24 ++++++++++++++---------- tests/entry.py | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 tests/entry.py diff --git a/README.md b/README.md index 4d153bf6..bb9a5c6b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ Features ### TODO -- Pick up user-defined layouts - Use Wayland input method protocol - Pick up DBus interface files from /usr/share @@ -45,19 +44,11 @@ $ ninja test $ ninja install ``` -For development, alter the `meson` call: - -``` -$ meson ../build/ --prefix=../install -``` - -and don't skip `ninja install` before running. The last step is necessary in order to find the keyboard definition files. - Running ------- ``` -$ rootston +$ phoc # if no compatible Wayland compositor is running yet $ cd ../build/ $ src/squeekboard ``` @@ -73,9 +64,22 @@ cd build_dir ### Testing +Testing with an application: + +``` +python3 tests/entry.py +``` + +Testing visibility: + ``` $ busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true $ busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false +``` + +Testing layouts: + +``` $ gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'ua')]" $ gsettings set org.gnome.desktop.input-sources current 1 ``` diff --git a/tests/entry.py b/tests/entry.py new file mode 100644 index 00000000..e7f813fe --- /dev/null +++ b/tests/entry.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python3 + +import gi +import sys +gi.require_version('Gtk', '3.0') + +from gi.repository import Gtk + +class App(Gtk.Application): + + purposes = [ + ("Free form", Gtk.InputPurpose.FREE_FORM), + ("Alphabetical", Gtk.InputPurpose.ALPHA), + ("Digits", Gtk.InputPurpose.DIGITS), + ("Number", Gtk.InputPurpose.NUMBER), + ("Phone", Gtk.InputPurpose.PHONE), + ("URL", Gtk.InputPurpose.URL), + ("E-mail", Gtk.InputPurpose.EMAIL), + ("Name", Gtk.InputPurpose.NAME), + ("Password", Gtk.InputPurpose.PASSWORD), + ("PIN", Gtk.InputPurpose.PIN) + ] + + def do_activate(self): + w = Gtk.ApplicationWindow(application=self) + grid = Gtk.Grid(orientation='vertical', column_spacing=8, row_spacing=8) + i = 0 + for text, purpose in self.purposes: + + l = Gtk.Label(label=text) + e = Gtk.Entry(hexpand=True) + e.set_input_purpose(purpose) + grid.attach(l, 0, i, 1, 1) + grid.attach(e, 1, i, 1, 1) + i += 1 + + w.add(grid) + w.show_all() + +app = App() +app.run(sys.argv)