summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-08-19 11:24:04 +0200
committeraxis <qt-info@nokia.com>2009-08-19 11:24:04 +0200
commit2d1b49bd21b788ba3e35fc5c41bf3aab42cbda65 (patch)
tree24dae3a4532870d61282841f6bb186cb008ab747 /src/testlib
parentb3a3652abbf1cb4ebba6c6257ecf47f8dc022d93 (diff)
parent20d2b7312456435e5e1a98dba7c2cc96b44fe83c (diff)
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: tests/auto/auto.pro
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp9
-rw-r--r--src/testlib/qtestevent.h5
-rw-r--r--src/testlib/qtestkeyboard.h2
-rw-r--r--src/testlib/qtestmouse.h2
4 files changed, 14 insertions, 4 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index a7aa81b26e..9a09c19a85 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -813,12 +813,12 @@ namespace QTest
{
static QObject *currentTestObject = 0;
- struct TestFunction {
+ static struct TestFunction {
TestFunction():function(0), data(0) {}
~TestFunction() { delete [] data; }
int function;
char *data;
- } testFuncs[512];
+ } *testFuncs;
/**
* Contains the count of test functions that was supplied
@@ -1125,6 +1125,11 @@ static void qParseArgs(int argc, char *argv[])
exit(1);
}
++QTest::lastTestFuncIdx;
+ if (!QTest::testFuncs) {
+ struct Cleanup { ~Cleanup() { delete[] QTest::testFuncs; } };
+ static Cleanup cleanup;
+ QTest::testFuncs = new TestFunction[512];
+ }
QTest::testFuncs[QTest::lastTestFuncIdx].function = idx;
QTest::testFuncs[QTest::lastTestFuncIdx].data = data;
QTEST_ASSERT(QTest::lastTestFuncIdx < 512);
diff --git a/src/testlib/qtestevent.h b/src/testlib/qtestevent.h
index a8376ee330..dfbba33601 100644
--- a/src/testlib/qtestevent.h
+++ b/src/testlib/qtestevent.h
@@ -71,6 +71,7 @@ public:
virtual ~QTestEvent() {}
};
+#ifdef QT_GUI_LIB
class QTestKeyEvent: public QTestEvent
{
public:
@@ -135,6 +136,8 @@ private:
QPoint _pos;
int _delay;
};
+#endif //QT_GUI_LIB
+
class QTestDelayEvent: public QTestEvent
{
@@ -159,6 +162,7 @@ public:
inline void clear()
{ qDeleteAll(*this); QList<QTestEvent *>::clear(); }
+#ifdef QT_GUI_LIB
inline void addKeyClick(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
{ addKeyEvent(QTest::Click, qtKey, modifiers, msecs); }
inline void addKeyPress(Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1)
@@ -194,6 +198,7 @@ public:
{ append(new QTestMouseEvent(QTest::MouseDClick, button, stateKey, pos, delay)); }
inline void addMouseMove(QPoint pos = QPoint(), int delay=-1)
{ append(new QTestMouseEvent(QTest::MouseMove, Qt::NoButton, 0, pos, delay)); }
+#endif //QT_GUI_LIB
inline void addDelay(int msecs)
{ append(new QTestDelayEvent(msecs)); }
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index 2e475b271f..af81075a7c 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#ifndef QTESTKEYBOARD_H
+#if !defined(QTESTKEYBOARD_H) && defined(QT_GUI_LIB)
#define QTESTKEYBOARD_H
#if 0
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index 2825c581a7..7ea927cc83 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#ifndef QTESTMOUSE_H
+#if !defined(QTESTMOUSE_H) && defined(QT_GUI_LIB)
#define QTESTMOUSE_H
#if 0