|
rpm-build |
858c0f |
#! /usr/bin/python
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
from testutil import *
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
from gi.repository import Gio, GLib
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
import os, sys
|
|
rpm-build |
858c0f |
import pyatspi
|
|
rpm-build |
858c0f |
from dogtail import tree
|
|
rpm-build |
858c0f |
from dogtail import utils
|
|
rpm-build |
858c0f |
from dogtail.procedural import *
|
|
rpm-build |
858c0f |
from dogtail.rawinput import click
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
def active(widget):
|
|
rpm-build |
858c0f |
return widget.getState().contains(pyatspi.STATE_ARMED)
|
|
rpm-build |
858c0f |
def visible(widget):
|
|
rpm-build |
858c0f |
return widget.getState().contains(pyatspi.STATE_VISIBLE)
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
PAGE_LABELS = [
|
|
rpm-build |
858c0f |
'Punctuation',
|
|
rpm-build |
858c0f |
'Arrows',
|
|
rpm-build |
858c0f |
'Bullets',
|
|
rpm-build |
858c0f |
'Pictures',
|
|
rpm-build |
858c0f |
'Currencies',
|
|
rpm-build |
858c0f |
'Math',
|
|
rpm-build |
858c0f |
'Letters',
|
|
rpm-build |
858c0f |
'Emoticons'
|
|
rpm-build |
858c0f |
]
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
class Page(object):
|
|
rpm-build |
858c0f |
def __init__(self, app, label):
|
|
rpm-build |
858c0f |
self.button = app.child('%s Category List Row' % label)
|
|
rpm-build |
858c0f |
self.character_list = app.child('%s Character List' % label)
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
init()
|
|
rpm-build |
858c0f |
try:
|
|
rpm-build |
858c0f |
app = start()
|
|
rpm-build |
858c0f |
print "app started"
|
|
rpm-build |
858c0f |
assert app is not None
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
pages = dict()
|
|
rpm-build |
858c0f |
for label in PAGE_LABELS:
|
|
rpm-build |
858c0f |
pages[label] = Page(app, label)
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
recently_used_page = Page(app, 'Recently Used')
|
|
rpm-build |
858c0f |
assert recently_used_page.button.showing
|
|
rpm-build |
858c0f |
assert not recently_used_page.character_list.showing
|
|
rpm-build |
858c0f |
pages['Recently Used'] = recently_used_page
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
# basic state
|
|
rpm-build |
858c0f |
for label, page in pages.items():
|
|
rpm-build |
858c0f |
assert page.button.showing
|
|
rpm-build |
858c0f |
if label in PAGE_LABELS:
|
|
rpm-build |
858c0f |
# for the first time, recent characters are empty and
|
|
rpm-build |
858c0f |
# 'Punctuation' tab should be selected.
|
|
rpm-build |
858c0f |
if label == 'Punctuation':
|
|
rpm-build |
858c0f |
assert page.character_list.showing
|
|
rpm-build |
858c0f |
else:
|
|
rpm-build |
858c0f |
assert not page.character_list.showing
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
# selection mode
|
|
rpm-build |
858c0f |
for label1 in PAGE_LABELS:
|
|
rpm-build |
858c0f |
page = pages[label1]
|
|
rpm-build |
858c0f |
page.button.click()
|
|
rpm-build |
858c0f |
assert page.character_list.showing
|
|
rpm-build |
858c0f |
for label2 in PAGE_LABELS:
|
|
rpm-build |
858c0f |
if label2 == label1:
|
|
rpm-build |
858c0f |
continue
|
|
rpm-build |
858c0f |
assert not pages[label2].character_list.showing
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
# character dialog
|
|
rpm-build |
858c0f |
page = pages['Punctuation']
|
|
rpm-build |
858c0f |
page.button.click()
|
|
rpm-build |
858c0f |
x, y = page.character_list.position
|
|
rpm-build |
858c0f |
click(x + 10, y + 10)
|
|
rpm-build |
858c0f |
assert len(app.children) == 2
|
|
rpm-build |
858c0f |
character_dialog = app.children[-1]
|
|
rpm-build |
858c0f |
assert character_dialog.name == 'Exclamation Mark'
|
|
rpm-build |
858c0f |
see_also_button = character_dialog.child('See Also')
|
|
rpm-build |
858c0f |
assert see_also_button.showing
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
see_also_button.click()
|
|
rpm-build |
858c0f |
keyCombo('Escape')
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
# recently used characters
|
|
rpm-build |
858c0f |
recently_used_page = Page(app, 'Recently Used')
|
|
rpm-build |
858c0f |
recently_used_page.button.click()
|
|
rpm-build |
858c0f |
x, y = recently_used_page.character_list.position
|
|
rpm-build |
858c0f |
click(x + 10, y + 10)
|
|
rpm-build |
858c0f |
assert len(app.children) == 2
|
|
rpm-build |
858c0f |
character_dialog = app.children[-1]
|
|
rpm-build |
858c0f |
assert character_dialog.name == 'Exclamation Mark'
|
|
rpm-build |
858c0f |
see_also_button = character_dialog.child('See Also')
|
|
rpm-build |
858c0f |
assert see_also_button.showing
|
|
rpm-build |
858c0f |
finally:
|
|
rpm-build |
858c0f |
print "tearing down"
|
|
rpm-build |
858c0f |
fini()
|