QtUiTest Namespace Reference
[QtUiTestModule]

The QtUiTest namespace provides the plugin interfaces used for customizing the behaviour of QtUiTest. More...

 #include <QtUiTest>

This namespace is under development and is subject to change.


Classes

class ActivateWidget   (preliminary)
class CheckItemWidget   (preliminary)
class CheckWidget   (preliminary)
class IndexedWidget   (preliminary)
class InputWidget   (preliminary)
class LabelWidget   (preliminary)
class ListWidget   (preliminary)
class SelectWidget   (preliminary)
class TestWidget
class TextWidget   (preliminary)
class Widget   (preliminary)
class WidgetFactory   (preliminary)

Types

enum InputOption { NoOptions, DemoMode, KeyRepeat }
enum Key { Key_Activate, Key_ActivateButton, Key_Select }
enum LabelOrientation { LabelLeft, LabelRight, LabelAbove, LabelBelow }
enum WidgetType { Focus, InputMethod, SoftMenu, OptionsMenu, ..., Launcher }

Functions

T qtuitest_cast ( const QObject * object )

Detailed Description

The QtUiTest namespace provides the plugin interfaces used for customizing the behaviour of QtUiTest.

When running a Qt Extended system test, functions such as select() and getText() are used to perform actions and retrieve information from widgets. This is implemented by wrapping each conceptual widget (which is not necessarily a QWidget) with a test widget class.

These test widgets each implement one or more of the widget interfaces in the QtUiTest namespace. The interfaces are used to determine what actions can be taken on a particular widget, and how to perform them.

For example, when the following system test code executes:

 select("Dog", "Favorite Animal");

QtUiTest will first look up the QWidget which is labelled by the text "Favorite Animal". It will then use qtuitest_cast to cast this widget to a QtUiTest::SelectWidget. If this is successful, it will then call select("Dog") on the list widget.

It is possible to customize the behavior of QtUiTest for particular widgets by creating custom test widget classes and a QtUiTest::WidgetFactory factory class to wrap QObject instances in test widgets.


Classes

class ActivateWidget

The ActivateWidget class provides an abstract base class for all test widgets which can conceptually be "activated" by a user. More...

class CheckItemWidget

The CheckItemWidget class provides an abstract base class for all test widgets which include items that support 'checked' and 'unchecked' states. More...

class CheckWidget

The CheckWidget class provides an abstract base class for all test widgets which support 'checked' and 'unchecked' states. More...

class IndexedWidget

The IndexedWidget class provides an abstract base class for all test widgets which allow the user to select items based on index. More...

class InputWidget

The InputWidget class provides an abstract base class for all test widgets which allow the user to input text. More...

class LabelWidget

The LabelWidget class provides an abstract base class for all test widgets which are conceptually labels. More...

class ListWidget

The ListWidget class provides an abstract base class for all test widgets which display a list of items to the user. More...

class SelectWidget

The SelectWidget class provides an abstract base class for all test widgets which allow the user to select from a range of items. More...

class TestWidget

class TextWidget

The TextWidget class provides an abstract base class for all test widgets which display text to the user. More...

class Widget

The Widget class provides an abstract base class for all test widgets. More...

class WidgetFactory

The WidgetFactory class provides a factory interface for QtUiTest widget wrapper classes. More...


Type Documentation

enum QtUiTest::InputOption

This enum type specifies the options to be used when simulating key and mouse events.

ConstantValueDescription
QtUiTest::NoOptions0x0no options.
QtUiTest::DemoMode0x1when simulating, force artificial delays between key and mouse events, and animate some events.
QtUiTest::KeyRepeat0x2when simulating key press events, simulate auto-repeat key press events. The default is to simulate regular key press events.

enum QtUiTest::Key

This enum provides mappings for high-level conceptual keys to platform-specific values of Qt::Key.

ConstantValueDescription
QtUiTest::Key_ActivateQt::Key_EnterKey used to activate generic UI elements.
QtUiTest::Key_ActivateButtonQt::Key_SpaceKey used to activate buttons.
QtUiTest::Key_SelectQt::Key_SpaceKey used to select an item from lists.

enum QtUiTest::LabelOrientation

enum QtUiTest::WidgetType

This enum type specifies different types of widgets which can be retrieved via QtUiTest::findWidget().

ConstantValueDescription
QtUiTest::Focus6The widget which currently has keyboard focus. Note that this need not be located in the current application.
QtUiTest::InputMethod0A currently active input method widget.
QtUiTest::SoftMenu1A currently displayed soft menu bar.
QtUiTest::OptionsMenu2The context/options menu which is currently shown, or would be shown if the user attempted to raise a context menu (typically by pressing Qt::Key_Context1).
QtUiTest::TabBar3The tab bar for the currently active tab widget, if one exists. QtUiTest is not designed to handle multiple nested tab widgets.
QtUiTest::HomeScreen5The home screen widget.
QtUiTest::Launcher4The widget (typically a grid-like menu) in the server process used for launching applications.


Function Documentation

T qtuitest_cast ( const QObject * object )

Casts object to the specified Qt Extended test widget interface T.

If object already implements T, it is simply casted and returned. Otherwise, QtUiTest will attempt to find or create a test widget to wrap object, using all loaded QtUiTest::WidgetFactory plugins. If a test widget cannot be created to wrap object, 0 is returned.

In either case, the returned value must not be deleted by the caller.

Example:

 // Attempt to select the item "Foo" from the given widget
 bool selectFoo(QWidget *widget) {
     QtUiTest::SelectWidget* sw
         = qtuitest_cast<QtUiTest::SelectWidget*>(widget);
     if (!sw || !sw->canSelect("Foo")) {
         return false;
     }
     return sw->select("Foo");
 }


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
QtUiTest