tests: Describe how to test
This commit is contained in:
		
							
								
								
									
										24
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								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
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										41
									
								
								tests/entry.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								tests/entry.py
									
									
									
									
									
										Normal file
									
								
							@ -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)
 | 
			
		||||
		Reference in New Issue
	
	Block a user