1
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
3
""" Toolbar emulator for Addressbook App tests """
5
# Copyright 2013 Canonical
7
# This program is free software: you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License version 3, as published
9
# by the Free Software Foundation.
10
from autopilot.introspection.dbus import StateNotFoundError
12
from ubuntuuitoolkit import emulators as toolkit_emulators
14
logger = logging.getLogger(__name__)
17
class Toolbar(toolkit_emulators.Toolbar):
18
"""An emulator class that makes it easy to interact with the tool bar"""
19
def __init__(self, *args):
20
super(Toolbar, self).__init__(*args)
22
def click_action_item_by_text(self, text):
23
"""Click an action item in the tool labelled 'text'
25
:param text: label of the ActionItem
28
action_item = self.select_single('ActionItem', text=text)
29
self.pointing_device.click_object(action_item)
30
except StateNotFoundError:
32
'ActionItem with text "{0}" not found.'.format(text)
36
def click_select(self):
37
"""Press 'Select' button on the toolbar"""
38
self.click_action_item_by_text("Select")