diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2011-09-20 07:59:46 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-21 08:24:11 +0200 |
commit | d372a9f3709aa76322e23c98eb5a853ba83e1e21 (patch) | |
tree | e556c3881d0a5152535dee32fa4edbcd5ab57c58 /src/testlib/qtestevent.h | |
parent | a097825b2135ebfde45a122ea9252954f4ddcd5f (diff) |
testlib: Remove widgets dependency when only using gui
There's api in testlib that should only be available
if the application links against widgets.
Change-Id: I22e382c6710690866ed8ffed81bae27b548dc830
Reviewed-on: http://codereview.qt-project.org/5094
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jo Asplin <jo.asplin@nokia.com>
Reviewed-by: Matthew Cattell <matthew.cattell@nokia.com>
Diffstat (limited to 'src/testlib/qtestevent.h')
-rw-r--r-- | src/testlib/qtestevent.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h index 9de9fd007d..c7af5b28d7 100644 --- a/src/testlib/qtestevent.h +++ b/src/testlib/qtestevent.h @@ -67,7 +67,9 @@ QT_MODULE(Test) class QTestEvent { public: +#ifdef QT_WIDGETS_LIB virtual void simulate(QWidget *w) = 0; +#endif virtual QTestEvent *clone() const = 0; virtual ~QTestEvent() {} @@ -84,6 +86,7 @@ public: _ascii(ascii), _key(Qt::Key_unknown) {} inline QTestEvent *clone() const { return new QTestKeyEvent(*this); } +#ifdef QT_WIDGETS_LIB inline void simulate(QWidget *w) { if (_ascii == 0) @@ -91,6 +94,7 @@ public: else QTest::keyEvent(_action, w, _ascii, _modifiers, _delay); } +#endif protected: QTest::KeyAction _action; @@ -107,10 +111,12 @@ public: : _keys(keys), _modifiers(modifiers), _delay(delay) {} inline QTestEvent *clone() const { return new QTestKeyClicksEvent(*this); } +#ifdef QT_WIDGETS_LIB inline void simulate(QWidget *w) { QTest::keyClicks(w, _keys, _modifiers, _delay); } +#endif private: QString _keys; @@ -126,10 +132,12 @@ public: : _action(action), _button(button), _modifiers(modifiers), _pos(position), _delay(delay) {} inline QTestEvent *clone() const { return new QTestMouseEvent(*this); } +#ifdef QT_WIDGETS_LIB inline void simulate(QWidget *w) { QTest::mouseEvent(_action, w, _button, _modifiers, _pos, _delay); } +#endif private: QTest::MouseAction _action; @@ -147,7 +155,9 @@ public: inline QTestDelayEvent(int msecs): _delay(msecs) {} inline QTestEvent *clone() const { return new QTestDelayEvent(*this); } +#ifdef QT_WIDGETS_LIB inline void simulate(QWidget * /*w*/) { QTest::qWait(_delay); } +#endif private: int _delay; @@ -205,11 +215,13 @@ public: inline void addDelay(int msecs) { append(new QTestDelayEvent(msecs)); } +#ifdef QT_WIDGETS_LIB inline void simulate(QWidget *w) { for (int i = 0; i < count(); ++i) at(i)->simulate(w); } +#endif }; QT_END_NAMESPACE |