summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/bic/tst_bic.cpp2
-rw-r--r--tests/auto/declarative/examples/tst_examples.cpp43
-rw-r--r--tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp12
-rw-r--r--tests/auto/macnativeevents/expectedeventlist.cpp176
-rw-r--r--tests/auto/macnativeevents/expectedeventlist.h71
-rw-r--r--tests/auto/macnativeevents/macnativeevents.pro6
-rw-r--r--tests/auto/macnativeevents/nativeeventlist.cpp (renamed from tests/auto/macnativeevents/qnativeplayer.cpp)78
-rw-r--r--tests/auto/macnativeevents/nativeeventlist.h (renamed from tests/auto/macnativeevents/qnativeplayer.h)32
-rw-r--r--tests/auto/macnativeevents/qnativeevents.cpp (renamed from tests/auto/macnativeevents/qnativeinput.cpp)2
-rw-r--r--tests/auto/macnativeevents/qnativeevents.h (renamed from tests/auto/macnativeevents/qnativeinput.h)0
-rw-r--r--tests/auto/macnativeevents/qnativeevents_mac.cpp (renamed from tests/auto/macnativeevents/qnativeinput_mac.cpp)2
-rw-r--r--tests/auto/macnativeevents/tst_macnativeevents.cpp229
-rw-r--r--tests/auto/qchar/qchar.pro6
-rw-r--r--tests/auto/qchar/tst_qchar.cpp5
-rw-r--r--tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp15
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp60
-rw-r--r--tests/auto/qhelpgenerator/data/test.qhp2
-rw-r--r--tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp2
-rw-r--r--tests/auto/qhelpprojectdata/data/test.qhp4
-rw-r--r--tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp2
-rw-r--r--tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp5
-rw-r--r--tests/auto/qtextcursor/tst_qtextcursor.cpp34
-rw-r--r--tests/auto/qthread/tst_qthread.cpp47
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp3
-rw-r--r--tests/benchmarks/corelib/tools/qvector/main.cpp36
-rw-r--r--tests/benchmarks/corelib/tools/qvector/qvector.pro2
26 files changed, 666 insertions, 210 deletions
diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp
index 0331c96..2349afa 100644
--- a/tests/auto/bic/tst_bic.cpp
+++ b/tests/auto/bic/tst_bic.cpp
@@ -147,7 +147,9 @@ void tst_Bic::initTestCase_data()
QTest::newRow("QtXmlPatterns") << "QtXmlPatterns";
QTest::newRow("Qt3Support") << "Qt3Support";
QTest::newRow("QtTest") << "QtTest";
+#ifndef QT_NO_DBUS
QTest::newRow("QtDBus") << "QtDBus";
+#endif
QTest::newRow("QtDesigner") << "QtDesigner";
}
diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp
index 7f4367e..dfcc9c0 100644
--- a/tests/auto/declarative/examples/tst_examples.cpp
+++ b/tests/auto/declarative/examples/tst_examples.cpp
@@ -90,6 +90,12 @@ tst_examples::tst_examples()
excludedDirs << "examples/declarative/plugins";
excludedDirs << "examples/declarative/proxywidgets";
excludedDirs << "examples/declarative/gestures";
+
+#ifdef QT_NO_WEBKIT
+ excludedDirs << "examples/declarative/webview";
+ excludedDirs << "demos/declarative/webbrowser";
+#endif
+
#ifdef QT_NO_XMLPATTERNS
excludedDirs << "examples/declarative/xmldata";
excludedDirs << "demos/declarative/twitter";
@@ -110,19 +116,19 @@ void tst_examples::namingConvention(const QDir &d)
return;
}
- QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"),
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"),
QDir::Files);
bool seenQml = !files.isEmpty();
bool seenLowercase = false;
foreach (const QString &file, files) {
- if (file.at(0).isLower())
+ if (file.at(0).isLower())
seenLowercase = true;
}
if (!seenQml) {
- QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
QDir::NoSymLinks);
foreach (const QString &dir, dirs) {
QDir sub = d;
@@ -153,7 +159,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d)
QStringList rv;
- QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"),
+ QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"),
QDir::Files);
foreach (const QString &file, files) {
if (file.at(0).isLower()) {
@@ -161,7 +167,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d)
}
}
- QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
+ QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot |
QDir::NoSymLinks);
foreach (const QString &dir, dirs) {
QDir sub = d;
@@ -175,26 +181,30 @@ QStringList tst_examples::findQmlFiles(const QDir &d)
/*
-This test runs all the examples in the declarative UI source tree and ensures
+This test runs all the examples in the declarative UI source tree and ensures
that they start and exit cleanly.
Examples are any .qml files under the examples/ or demos/ directory that start
-with a lower case letter.
+with a lower case letter.
*/
#ifndef CONCURRENT
void tst_examples::examples_data()
{
QTest::addColumn<QString>("file");
- QString examples = QLibraryInfo::location(QLibraryInfo::ExamplesPath);
- QString demos = QLibraryInfo::location(QLibraryInfo::DemosPath);
+ QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/";
+ QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/";
QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/";
+ qWarning() << examples << demos << snippets;
+
QStringList files;
files << findQmlFiles(QDir(examples));
files << findQmlFiles(QDir(demos));
files << findQmlFiles(QDir(snippets));
+ qWarning() << files;
+
foreach (const QString &file, files)
QTest::newRow(file.toLatin1().constData()) << file;
}
@@ -223,7 +233,7 @@ void Example::run()
QFileInfo testdata(script+".qml");
QStringList arguments;
arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest"))
- << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure"
+ << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure"
<< file;
#ifdef Q_WS_QWS
arguments << "-qws";
@@ -238,7 +248,7 @@ void Example::run()
if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0)
qWarning() << p.readAllStandardOutput() << p.readAllStandardError();
-
+
if (p.exitStatus() != QProcess::NormalExit ||
p.exitCode() != 0) {
result = Fail;
@@ -255,8 +265,8 @@ void tst_examples::examples()
#ifdef CONCURRENT
QThreadPool::globalInstance()->setMaxThreadCount(5);
- QString examples = QLibraryInfo::location(QLibraryInfo::ExamplesPath);
- QString demos = QLibraryInfo::location(QLibraryInfo::DemosPath);
+ QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/";
+ QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/";
QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/";
QStringList files;
@@ -276,13 +286,14 @@ void tst_examples::examples()
QFutureSynchronizer<void> sync;
for (int ii = 0; ii < tests.count(); ++ii) {
- QFuture<void> r = QtConcurrent::run(tests.at(ii), &Example::run);
+ Example *e = &tests[ii];
+ QFuture<void> r = QtConcurrent::run(e, &Example::run);
sync.addFuture(r);
}
sync.waitForFinished();
- for (int ii = 0; ii < tests.count(); ++ii)
+ for (int ii = 0; ii < tests.count(); ++ii)
QVERIFY(tests.at(ii).result == Example::Pass);
#else
@@ -295,7 +306,7 @@ void tst_examples::examples()
QFileInfo testdata(script+".qml");
QStringList arguments;
arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest"))
- << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure"
+ << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure"
<< file;
#ifdef Q_WS_QWS
arguments << "-qws";
diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
index 8aeba6d..bb965a9 100644
--- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
+++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
@@ -148,7 +148,7 @@ void tst_qdeclarativeborderimage::imageSource()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create());
QVERIFY(obj != 0);
-
+
if (remote)
TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading);
@@ -267,14 +267,14 @@ void tst_qdeclarativeborderimage::sciSource()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create());
QVERIFY(obj != 0);
-
+
if (remote)
TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading);
-
+
QCOMPARE(obj->source(), remote ? source : QUrl(source));
QCOMPARE(obj->width(), 300.);
QCOMPARE(obj->height(), 300.);
-
+
if (valid) {
TRY_WAIT(obj->status() == QDeclarativeBorderImage::Ready);
QCOMPARE(obj->border()->left(), 10);
@@ -342,8 +342,8 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest_data()
{
QTest::addColumn<QString>("source");
- QTest::newRow("png file") << "http://no-such-qt-server-like-this/none.png";
- QTest::newRow("sci file") << "http://no-such-qt-server-like-this/none.sci";
+ QTest::newRow("png file") << "http://localhost/none.png";
+ QTest::newRow("sci file") << "http://localhost/none.sci";
}
QTEST_MAIN(tst_qdeclarativeborderimage)
diff --git a/tests/auto/macnativeevents/expectedeventlist.cpp b/tests/auto/macnativeevents/expectedeventlist.cpp
new file mode 100644
index 0000000..b1fb9a6
--- /dev/null
+++ b/tests/auto/macnativeevents/expectedeventlist.cpp
@@ -0,0 +1,176 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "expectedeventlist.h"
+#include <QDebug>
+#include <QCoreApplication>
+#include <QAbstractEventDispatcher>
+#include <QtTest/QtTest>
+
+ExpectedEventList::ExpectedEventList(QObject *target)
+ : QObject(target), eventCount(0)
+{
+ target->installEventFilter(this);
+ debug = !qgetenv("NATIVEDEBUG").isEmpty();
+}
+
+ExpectedEventList::~ExpectedEventList()
+{
+ qDeleteAll(eventList);
+}
+
+void ExpectedEventList::append(QEvent *e)
+{
+ eventList.append(e);
+ ++eventCount;
+}
+
+void ExpectedEventList::timerEvent(QTimerEvent *)
+{
+ timer.stop();
+ QAbstractEventDispatcher::instance()->interrupt();
+}
+
+bool ExpectedEventList::waitForAllEvents(int maxEventWaitTime)
+{
+ if (eventList.isEmpty())
+ return true;
+
+ int eventCount = eventList.size();
+ timer.start(maxEventWaitTime, this);
+
+ while (timer.isActive()) {
+ QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
+ if (eventList.isEmpty())
+ return true;
+
+ if (eventCount < eventList.size()){
+ eventCount = eventList.size();
+ timer.start(maxEventWaitTime, this);
+ }
+ }
+
+ int eventListNr = eventCount - eventList.size() + 1;
+ qWarning() << "Stopped waiting for expected event nr" << eventListNr;
+ return false;
+}
+
+void ExpectedEventList::compareMouseEvents(QEvent *received, QEvent *expected)
+{
+ QMouseEvent *e1 = static_cast<QMouseEvent *>(received);
+ QMouseEvent *e2 = static_cast<QMouseEvent *>(expected);
+ if (e1->pos() == e2->pos()
+ && (e1->globalPos() == e2->globalPos())
+ && (e1->button() == e2->button())
+ && (e1->buttons() == e2->buttons())
+ && (e1->modifiers() == e2->modifiers()))
+ return; // equal
+
+ int eventListNr = eventCount - eventList.size();
+ if (!debug) {
+ qWarning() << "Expected event" << eventListNr << "differs from received event:";
+ QCOMPARE(e1->pos(), e2->pos());
+ QCOMPARE(e1->globalPos(), e2->globalPos());
+ QCOMPARE(e1->button(), e2->button());
+ QCOMPARE(e1->buttons(), e2->buttons());
+ QCOMPARE(e1->modifiers(), e2->modifiers());
+ } else {
+ qWarning() << "*** FAIL *** : Expected event" << eventListNr << "differs from received event:";
+ qWarning() << "Received:" << e1 << e1->globalPos();
+ qWarning() << "Expected:" << e2 << e2->globalPos();
+ }
+}
+
+void ExpectedEventList::compareKeyEvents(QEvent *event1, QEvent *event2)
+{
+ QKeyEvent *e1 = static_cast<QKeyEvent *>(event1);
+ QKeyEvent *e2 = static_cast<QKeyEvent *>(event2);
+ Q_UNUSED(e1);
+ Q_UNUSED(e2);
+}
+
+bool ExpectedEventList::eventFilter(QObject *, QEvent *received)
+{
+ if (debug)
+ qDebug() << received;
+ if (eventList.isEmpty())
+ return false;
+
+ QEvent *expected = eventList.first();
+ if (expected->type() == received->type()) {
+ eventList.removeFirst();
+ switch (received->type()) {
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonDblClick:
+ case QEvent::NonClientAreaMouseButtonPress:
+ case QEvent::NonClientAreaMouseButtonRelease:
+ case QEvent::NonClientAreaMouseButtonDblClick:
+ case QEvent::NonClientAreaMouseMove: {
+ compareMouseEvents(received, expected);
+ break;
+ }
+ case QEvent::KeyPress: {
+ break;
+ }
+ case QEvent::KeyRelease: {
+ break;
+ }
+ case QEvent::Resize: {
+ break;
+ }
+ case QEvent::WindowActivate: {
+ break;
+ }
+ case QEvent::WindowDeactivate: {
+ break;
+ }
+ default:
+ break;
+ }
+ if (eventList.isEmpty())
+ QAbstractEventDispatcher::instance()->interrupt();
+ }
+
+ return false;
+}
+
diff --git a/tests/auto/macnativeevents/expectedeventlist.h b/tests/auto/macnativeevents/expectedeventlist.h
new file mode 100644
index 0000000..bd9f358
--- /dev/null
+++ b/tests/auto/macnativeevents/expectedeventlist.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef EVENTFILTER
+#define EVENTFILTER
+
+#include <QWidget>
+#include <QList>
+#include <QEvent>
+#include <QBasicTimer>
+
+class ExpectedEventList : public QObject
+{
+ QList<QEvent *> eventList;
+ QBasicTimer timer;
+ bool debug;
+ int eventCount;
+ void timerEvent(QTimerEvent *);
+
+public:
+ ExpectedEventList(QObject *target);
+ ~ExpectedEventList();
+ void append(QEvent *e);
+ bool waitForAllEvents(int timeoutPerEvent = 2000);
+ bool eventFilter(QObject *obj, QEvent *event);
+
+private:
+ void compareMouseEvents(QEvent *event1, QEvent *event2);
+ void compareKeyEvents(QEvent *event1, QEvent *event2);
+};
+
+#endif
+
diff --git a/tests/auto/macnativeevents/macnativeevents.pro b/tests/auto/macnativeevents/macnativeevents.pro
index a0293d4..af34942 100644
--- a/tests/auto/macnativeevents/macnativeevents.pro
+++ b/tests/auto/macnativeevents/macnativeevents.pro
@@ -8,9 +8,9 @@ DEPENDPATH += .
INCLUDEPATH += .
LIBS += -framework Carbon
-HEADERS += qnativeinput.h qnativeplayer.h
-SOURCES += qnativeinput.cpp qnativeplayer.cpp qnativeinput_mac.cpp
-
+HEADERS += qnativeevents.h nativeeventlist.h expectedeventlist.h
+SOURCES += qnativeevents.cpp qnativeevents_mac.cpp
+SOURCES += expectedeventlist.cpp nativeeventlist.cpp
SOURCES += tst_macnativeevents.cpp
requires(mac)
diff --git a/tests/auto/macnativeevents/qnativeplayer.cpp b/tests/auto/macnativeevents/nativeeventlist.cpp
index 92298ef..d5d7b95 100644
--- a/tests/auto/macnativeevents/qnativeplayer.cpp
+++ b/tests/auto/macnativeevents/nativeeventlist.cpp
@@ -39,22 +39,26 @@
**
****************************************************************************/
-#include "qnativeplayer.h"
+#include "nativeeventlist.h"
-QNativePlayer::QNativePlayer()
+NativeEventList::NativeEventList(int defaultWaitMs)
+ : playbackMultiplier(1.0)
+ , currIndex(-1)
+ , wait(false)
+ , defaultWaitMs(defaultWaitMs)
{
- currIndex = -1;
- playbackMultiplier = 1.0;
- wait = false;
+ QString multiplier = qgetenv("NATIVEDEBUG");
+ if (!multiplier.isEmpty())
+ setTimeMultiplier(multiplier.toFloat());
}
-QNativePlayer::~QNativePlayer()
+NativeEventList::~NativeEventList()
{
for (int i=0; i<eventList.size(); i++)
delete eventList.takeAt(i).second;
}
-void QNativePlayer::sendNextEvent()
+void NativeEventList::sendNextEvent()
{
QNativeEvent *e = eventList.at(currIndex).second;
if (e)
@@ -62,7 +66,7 @@ void QNativePlayer::sendNextEvent()
waitNextEvent();
}
-void QNativePlayer::waitNextEvent()
+void NativeEventList::waitNextEvent()
{
if (++currIndex >= eventList.size()){
emit done();
@@ -74,12 +78,22 @@ void QNativePlayer::waitNextEvent()
QTimer::singleShot(interval * playbackMultiplier, this, SLOT(sendNextEvent()));
}
-void QNativePlayer::append(int waitMs, QNativeEvent *event)
+void NativeEventList::append(QNativeEvent *event)
+{
+ eventList.append(QPair<int, QNativeEvent *>(defaultWaitMs, event));
+}
+
+void NativeEventList::append(int waitMs, QNativeEvent *event)
{
eventList.append(QPair<int, QNativeEvent *>(waitMs, event));
}
-void QNativePlayer::play(Playback playback)
+void NativeEventList::append(int waitMs)
+{
+ eventList.append(QPair<int, QNativeEvent *>(waitMs, 0));
+}
+
+void NativeEventList::play(Playback playback)
{
waitNextEvent();
@@ -88,52 +102,14 @@ void QNativePlayer::play(Playback playback)
QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents);
}
-void QNativePlayer::stop()
+void NativeEventList::stop()
{
wait = false;
QAbstractEventDispatcher::instance()->interrupt();
}
-// ************************************************************************
-
-QEventOutputList::QEventOutputList()
-{
- wait = true;
-}
-
-QEventOutputList::~QEventOutputList()
+void NativeEventList::setTimeMultiplier(float multiplier)
{
- qDeleteAll(*this);
+ playbackMultiplier = multiplier;
}
-bool QEventOutputList::waitUntilEmpty(int maxEventWaitTime)
-{
- int currSize = size();
- QTime time;
- time.restart();
- while (wait){
- QCoreApplication::processEvents(QEventLoop::AllEvents, 50);
-
- if (isEmpty()){
- return true;
- }
- else if (currSize == size()){
- if (time.elapsed() > maxEventWaitTime){
- return false;
- }
- }
- else{
- currSize = size();
- time.restart();
- }
- }
- return false;
-}
-
-void QEventOutputList::sleep(int sleepTime)
-{
- QTime time;
- time.restart();
- while (time.elapsed() < sleepTime)
- QCoreApplication::processEvents(QEventLoop::AllEvents, 50);
-}
diff --git a/tests/auto/macnativeevents/qnativeplayer.h b/tests/auto/macnativeevents/nativeeventlist.h
index 61ee162..688665d 100644
--- a/tests/auto/macnativeevents/qnativeplayer.h
+++ b/tests/auto/macnativeevents/nativeeventlist.h
@@ -43,22 +43,25 @@
#define Q_NATIVE_PLAYBACK
#include <QtCore>
-#include "qnativeinput.h"
+#include "qnativeevents.h"
-class QNativePlayer : public QObject
+class NativeEventList : public QObject
{
Q_OBJECT;
public:
enum Playback {ReturnImmediately, WaitUntilFinished};
- QNativePlayer();
- ~QNativePlayer();
+ NativeEventList(int defaultWaitMs = 20);
+ ~NativeEventList();
+ void append(QNativeEvent *event);
void append(int waitMs, QNativeEvent *event = 0);
+ void append(int waitMs);
+
void play(Playback playback = WaitUntilFinished);
void stop();
- float playbackMultiplier;
+ void setTimeMultiplier(float multiplier);
signals:
void done();
@@ -66,27 +69,14 @@ signals:
private slots:
void sendNextEvent();
- private:
+private:
void waitNextEvent();
QList<QPair<int, QNativeEvent *> > eventList;
+ float playbackMultiplier;
int currIndex;
bool wait;
+ int defaultWaitMs;
};
-// ******************************************************************
-
-class QEventOutputList : public QList<QEvent *>
-{
-public:
- QEventOutputList();
- ~QEventOutputList();
- bool waitUntilEmpty(int maxEventWaitTime = 1000);
- bool wait;
-
- // Useful method. Just sleep and process events:
- static void sleep(int sleepTime);
-};
-
-
#endif
diff --git a/tests/auto/macnativeevents/qnativeinput.cpp b/tests/auto/macnativeevents/qnativeevents.cpp
index c9462a6..cb4b82e 100644
--- a/tests/auto/macnativeevents/qnativeinput.cpp
+++ b/tests/auto/macnativeevents/qnativeevents.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qnativeinput.h"
+#include "qnativeevents.h"
QNativeInput::QNativeInput(bool subscribe)
{
diff --git a/tests/auto/macnativeevents/qnativeinput.h b/tests/auto/macnativeevents/qnativeevents.h
index a98e4e4..a98e4e4 100644
--- a/tests/auto/macnativeevents/qnativeinput.h
+++ b/tests/auto/macnativeevents/qnativeevents.h
diff --git a/tests/auto/macnativeevents/qnativeinput_mac.cpp b/tests/auto/macnativeevents/qnativeevents_mac.cpp
index 143a633..6c04bf3 100644
--- a/tests/auto/macnativeevents/qnativeinput_mac.cpp
+++ b/tests/auto/macnativeevents/qnativeevents_mac.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qnativeinput.h"
+#include "qnativeevents.h"
#include <Carbon/Carbon.h>
#include <QtCore>
diff --git a/tests/auto/macnativeevents/tst_macnativeevents.cpp b/tests/auto/macnativeevents/tst_macnativeevents.cpp
index ccadd54..08ab9e6 100644
--- a/tests/auto/macnativeevents/tst_macnativeevents.cpp
+++ b/tests/auto/macnativeevents/tst_macnativeevents.cpp
@@ -44,8 +44,9 @@
#include <QPushButton>
#include <QtTest/QtTest>
-#include "qnativeinput.h"
-#include "qnativeplayer.h"
+#include "qnativeevents.h"
+#include "nativeeventlist.h"
+#include "expectedeventlist.h"
#ifdef Q_OS_MAC
@@ -55,21 +56,233 @@ class tst_MacNativeEvents : public QObject
{
Q_OBJECT
private slots:
- void testLeftMousePressRelease();
+ void testMouseMoveLocation();
+ void testPushButtonPressRelease();
+ void testMouseLeftDoubleClick();
+ void stressTestMouseLeftDoubleClick();
+ void testMouseDragInside();
+ void testMouseDragOutside();
+ void testMouseDragToNonClientArea();
+ void testDragWindow();
+ void testMouseEnter();
};
-void tst_MacNativeEvents::testLeftMousePressRelease()
+void tst_MacNativeEvents::testMouseMoveLocation()
{
+ QWidget w;
+ w.setMouseTracking(true);
+ w.show();
+ QPoint p = w.geometry().center();
+
+ NativeEventList native;
+ native.append(new QNativeMouseMoveEvent(p, Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(p), p, Qt::NoButton, Qt::NoButton, Qt::NoModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testPushButtonPressRelease()
+{
+ // Check that a native mouse press and release generates the
+ // same qevents on a pushbutton:
QPushButton w("click me");
w.show();
QPoint p = w.geometry().center();
- QNativePlayer player;
- player.append(50, new QNativeMouseButtonEvent(p, Qt::LeftButton, 1, Qt::NoModifier));
- player.append(50, new QNativeMouseButtonEvent(p, Qt::LeftButton, 0, Qt::NoModifier));
- player.play();
+ NativeEventList native;
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 1, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 0, Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QMouseEvent(QEvent::MouseButtonPress, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonRelease, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testMouseLeftDoubleClick()
+{
+ // Check that a native double click makes
+ // the test widget receive a press-release-click-release:
+ QWidget w;
+ w.show();
+ QPoint p = w.geometry().center();
+
+ NativeEventList native;
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 1, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 0, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 2, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 0, Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QMouseEvent(QEvent::MouseButtonPress, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonRelease, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonDblClick, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonRelease, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::stressTestMouseLeftDoubleClick()
+{
+ // Check that multiple, fast, double clicks makes
+ // the test widget receive correct click events
+ QWidget w;
+ w.show();
+ QPoint p = w.geometry().center();
+
+ NativeEventList native;
+ ExpectedEventList expected(&w);
+
+ for (int i=0; i<10; ++i){
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 1, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 0, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 2, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(p, Qt::LeftButton, 0, Qt::NoModifier));
+
+ expected.append(new QMouseEvent(QEvent::MouseButtonPress, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonRelease, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonDblClick, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonRelease, w.mapFromGlobal(p), p, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+ }
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
}
+void tst_MacNativeEvents::testMouseDragInside()
+{
+ // Check that a mouse drag inside a widget
+ // will cause press-move-release events to be delivered
+ QWidget w;
+ w.show();
+ QPoint p1 = w.geometry().center();
+ QPoint p2 = p1 - QPoint(10, 0);
+ QPoint p3 = p1 - QPoint(20, 0);
+ QPoint p4 = p1 - QPoint(30, 0);
+
+ NativeEventList native;
+ native.append(new QNativeMouseButtonEvent(p1, Qt::LeftButton, 1, Qt::NoModifier));
+ native.append(new QNativeMouseDragEvent(p2, Qt::LeftButton, Qt::NoModifier));
+ native.append(new QNativeMouseDragEvent(p3, Qt::LeftButton, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(p4, Qt::LeftButton, 0, Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QMouseEvent(QEvent::MouseButtonPress, w.mapFromGlobal(p1), p1, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(p2), p2, Qt::NoButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(p3), p3, Qt::NoButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonRelease, w.mapFromGlobal(p4), p4, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testMouseDragOutside()
+{
+ // Check that if we drag the mouse from inside the
+ // widget, and release it outside, we still get mouse move
+ // and release events when the mouse is outside the widget.
+ QWidget w;
+ w.show();
+ QPoint inside1 = w.geometry().center();
+ QPoint inside2 = inside1 - QPoint(10, 0);
+ QPoint outside1 = w.geometry().topLeft() - QPoint(50, 0);
+ QPoint outside2 = outside1 - QPoint(10, 0);
+
+ NativeEventList native;
+ native.append(new QNativeMouseButtonEvent(inside1, Qt::LeftButton, 1, Qt::NoModifier));
+ native.append(new QNativeMouseDragEvent(inside2, Qt::LeftButton, Qt::NoModifier));
+ native.append(new QNativeMouseDragEvent(outside1, Qt::LeftButton, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(outside2, Qt::LeftButton, 0, Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QMouseEvent(QEvent::MouseButtonPress, w.mapFromGlobal(inside1), inside1, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(inside2), inside2, Qt::NoButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(outside1), outside1, Qt::NoButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonRelease, w.mapFromGlobal(outside2), outside2, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testMouseDragToNonClientArea()
+{
+ // Check that if we drag the mouse from inside the
+ // widget, and release it on the title bar, we still get mouse move
+ // and release events when the mouse is on the title bar
+ QWidget w;
+ w.show();
+ QPoint inside1 = w.geometry().center();
+ QPoint inside2 = inside1 - QPoint(10, 0);
+ QPoint titlebar1 = w.geometry().topLeft() - QPoint(-100, 10);
+ QPoint titlebar2 = titlebar1 - QPoint(10, 0);
+
+ NativeEventList native;
+ native.append(new QNativeMouseButtonEvent(inside1, Qt::LeftButton, 1, Qt::NoModifier));
+ native.append(new QNativeMouseDragEvent(inside2, Qt::LeftButton, Qt::NoModifier));
+ native.append(new QNativeMouseDragEvent(titlebar1, Qt::LeftButton, Qt::NoModifier));
+ native.append(new QNativeMouseButtonEvent(titlebar2, Qt::LeftButton, 0, Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QMouseEvent(QEvent::MouseButtonPress, w.mapFromGlobal(inside1), inside1, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(inside2), inside2, Qt::NoButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(titlebar1), titlebar1, Qt::NoButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::MouseButtonRelease, w.mapFromGlobal(titlebar2), titlebar2, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testDragWindow()
+{
+ // Check that if we drag the mouse from inside the
+ // widgets title bar, we get a move event on the window
+ QWidget w;
+ w.show();
+ QPoint titlebar = w.geometry().topLeft() - QPoint(-100, 10);
+ QPoint moveTo = titlebar + QPoint(100, 0);
+
+ NativeEventList native;
+ native.append(new QNativeMouseButtonEvent(titlebar, Qt::LeftButton, 1, Qt::NoModifier));
+ native.append(new QNativeMouseDragEvent(moveTo, Qt::LeftButton, Qt::NoModifier));
+ native.append(500, new QNativeMouseButtonEvent(moveTo, Qt::LeftButton, 0, Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QMouseEvent(QEvent::NonClientAreaMouseButtonPress, w.mapFromGlobal(titlebar), titlebar, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier));
+ expected.append(new QMouseEvent(QEvent::NonClientAreaMouseButtonRelease, w.mapFromGlobal(titlebar), moveTo, Qt::LeftButton, Qt::NoButton, Qt::NoModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+void tst_MacNativeEvents::testMouseEnter()
+{
+ // When a mouse enters a widget, both a mouse enter events and a
+ // mouse move event should be sendt. Lets test this:
+ QWidget w;
+ w.setMouseTracking(true);
+ w.show();
+ QPoint outside = w.geometry().topLeft() - QPoint(50, 0);
+ QPoint inside = w.geometry().center();
+
+ NativeEventList native;
+ native.append(new QNativeMouseMoveEvent(outside, Qt::NoModifier));
+ native.append(new QNativeMouseMoveEvent(inside, Qt::NoModifier));
+
+ ExpectedEventList expected(&w);
+ expected.append(new QEvent(QEvent::Enter));
+ expected.append(new QMouseEvent(QEvent::MouseMove, w.mapFromGlobal(inside), inside, Qt::NoButton, Qt::NoButton, Qt::NoModifier));
+
+ native.play();
+ QVERIFY2(expected.waitForAllEvents(), "the test did not receive all expected events!");
+}
+
+
#include "tst_macnativeevents.moc"
QTEST_MAIN(tst_MacNativeEvents)
diff --git a/tests/auto/qchar/qchar.pro b/tests/auto/qchar/qchar.pro
index 0a3fcc3..a534d14 100644
--- a/tests/auto/qchar/qchar.pro
+++ b/tests/auto/qchar/qchar.pro
@@ -8,4 +8,8 @@ deploy.sources += NormalizationTest.txt
DEPLOYMENT = deploy
}
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
+symbian*: {
+ DEFINES += SRCDIR=""
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp
index 6227c2e..5ca2255 100644
--- a/tests/auto/qchar/tst_qchar.cpp
+++ b/tests/auto/qchar/tst_qchar.cpp
@@ -513,10 +513,7 @@ void tst_QChar::normalization()
}
QFile f(SRCDIR "NormalizationTest.txt");
- if (!f.exists()) {
- QFAIL("Couldn't find NormalizationTest.txt");
- return;
- }
+ QVERIFY(f.exists());
f.open(QIODevice::ReadOnly);
diff --git a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
index 9ea422c..87df57d 100644
--- a/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
+++ b/tests/auto/qelapsedtimer/tst_qelapsedtimer.cpp
@@ -46,6 +46,17 @@
static const int minResolution = 50; // the minimum resolution for the tests
+QDebug operator<<(QDebug s, const QElapsedTimer &t)
+{
+ union {
+ QElapsedTimer t;
+ struct { qint64 t1, t2; } i;
+ } copy;
+ copy.t = t;
+ s.nospace() << "(" << copy.i.t1 << ", " << copy.i.t2 << ")";
+ return s.space();
+}
+
class tst_QElapsedTimer : public QObject
{
Q_OBJECT
@@ -110,15 +121,17 @@ void tst_QElapsedTimer::basics()
#endif
quint64 value1 = t1.msecsSinceReference();
+ qDebug() << value1 << t1;
qint64 elapsed = t1.restart();
QVERIFY(elapsed < minResolution);
quint64 value2 = t1.msecsSinceReference();
+ qDebug() << value2 << t1 << elapsed;
// in theory, elapsed == value2 - value1
// However, since QElapsedTimer keeps internally the full resolution,
// we have here a rounding error due to integer division
- QVERIFY(qAbs(elapsed - qint64(value2 - value1)) < 1);
+ QVERIFY(qAbs(elapsed - qint64(value2 - value1)) <= 1);
}
void tst_QElapsedTimer::elapsed()
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index 42e7250..da5c772 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -194,6 +194,9 @@ tst_QFileInfo::~tst_QFileInfo()
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QDir().rmdir("./.hidden-directory");
#endif
+#ifdef Q_OS_WIN
+ QDir().rmdir("./hidden-directory");
+#endif
}
// Testing get/set functions
@@ -1056,14 +1059,6 @@ void tst_QFileInfo::isSymLink_data()
QTest::newRow("existent file") << SRCDIR "tst_qfileinfo.cpp" << false << "";
QTest::newRow("link") << "link.lnk" << true << QFileInfo(SRCDIR "tst_qfileinfo.cpp").absoluteFilePath();
QTest::newRow("broken link") << "brokenlink.lnk" << true << QFileInfo("dummyfile").absoluteFilePath();
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- if (QSysInfo::WindowsVersion & QSysInfo::WV_VISTA) {
- QTest::newRow("Documents and Settings") << "C:/Documents and Settings" << true << "C:/Users";
- QTest::newRow("All Users") << "C:/Users/All Users" << true << "C:/ProgramData";
- QTest::newRow("Default User") << "C:/Users/Default User" << true << "C:/Users/Default";
- }
-#endif
}
void tst_QFileInfo::isSymLink()
@@ -1086,16 +1081,13 @@ void tst_QFileInfo::isHidden_data()
}
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- QTest::newRow("C:/RECYCLER") << QString::fromLatin1("C:/RECYCLER") << true;
- QTest::newRow("C:/RECYCLER/.") << QString::fromLatin1("C:/RECYCLER/.") << true;
- QTest::newRow("C:/RECYCLER/..") << QString::fromLatin1("C:/RECYCLER/..") << true;
+ QVERIFY(QDir("./hidden-directory").exists() || QDir().mkdir("./hidden-directory"));
+ QVERIFY(SetFileAttributesW(QString("./hidden-directory").utf16(),FILE_ATTRIBUTE_HIDDEN));
+ QTest::newRow("C:/path/to/hidden-directory") << QDir::currentPath() + QString::fromLatin1("/hidden-directory") << true;
+ QTest::newRow("C:/path/to/hidden-directory/.") << QDir::currentPath() + QString::fromLatin1("/hidden-directory/.") << true;
#endif
#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
-
- if (!QDir("./.hidden-directory").exists()
- && !QDir().mkdir("./.hidden-directory"))
- qWarning("Unable to create directory './.hidden-directory'. Some tests will fail.");
-
+ QVERIFY(QDir("./.hidden-directory").exists() || QDir().mkdir("./.hidden-directory"));
QTest::newRow("/path/to/.hidden-directory") << QDir::currentPath() + QString("/.hidden-directory") << true;
QTest::newRow("/path/to/.hidden-directory/.") << QDir::currentPath() + QString("/.hidden-directory/.") << true;
QTest::newRow("/path/to/.hidden-directory/..") << QDir::currentPath() + QString("/.hidden-directory/..") << true;
@@ -1123,34 +1115,24 @@ void tst_QFileInfo::isHidden_data()
{
QFile file(hiddenFileName);
- if (file.open(QIODevice::WriteOnly)) {
- QTextStream t(&file);
- t << "foobar";
- } else {
- qWarning("Failed to create hidden file");
- }
+ QVERIFY(file.open(QIODevice::WriteOnly));
+ QTextStream t(&file);
+ t << "foobar";
+
QFile file2(notHiddenFileName);
- if (file2.open(QIODevice::WriteOnly)) {
- QTextStream t(&file);
- t << "foobar";
- } else {
- qWarning("Failed to create non-hidden file");
- }
+ QVERIFY(file2.open(QIODevice::WriteOnly))
+ QTextStream t(&file);
+ t << "foobar";
}
RFs rfs;
TInt err = rfs.Connect();
- if (err == KErrNone) {
- HBufC* symFile = qt_QString2HBufC(hiddenFileName);
- err = rfs.SetAtt(*symFile, KEntryAttHidden, 0);
- rfs.Close();
- delete symFile;
- if (err != KErrNone) {
- qWarning("Failed to set hidden attribute for test file");
- }
- } else {
- qWarning("Failed to open RFs session");
- }
+ QCOMPARE(err, KErrNone);
+ HBufC* symFile = qt_QString2HBufC(hiddenFileName);
+ err = rfs.SetAtt(*symFile, KEntryAttHidden, 0);
+ rfs.Close();
+ delete symFile;
+ QCOMPARE(err, KErrNone);
#endif
}
diff --git a/tests/auto/qhelpgenerator/data/test.qhp b/tests/auto/qhelpgenerator/data/test.qhp
index a97c00d..2c3f128 100644
--- a/tests/auto/qhelpgenerator/data/test.qhp
+++ b/tests/auto/qhelpgenerator/data/test.qhp
@@ -3,7 +3,7 @@
<metaData name="author" value="Nokia Corporation and/or its subsidiary(-ies)" />
<metaData name="language" value="en" />
<virtualFolder>testFolder</virtualFolder>
- <namespace>trolltech.com.1_0_0.test</namespace>
+ <namespace>trolltech.com.1.0.0.test</namespace>
<customFilter name="Custom Filter 1">
<filterAttribute>test</filterAttribute>
<filterAttribute>filter1</filterAttribute>
diff --git a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp
index 34ee7c6..a190081 100644
--- a/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp
+++ b/tests/auto/qhelpgenerator/tst_qhelpgenerator.cpp
@@ -119,7 +119,7 @@ void tst_QHelpGenerator::checkNamespace()
{
m_query->exec("SELECT Id, Name FROM NamespaceTable");
if (m_query->next()
- && m_query->value(1).toString() == QLatin1String("trolltech.com.1_0_0.test"))
+ && m_query->value(1).toString() == QLatin1String("trolltech.com.1.0.0.test"))
return;
QFAIL("Namespace Error!");
}
diff --git a/tests/auto/qhelpprojectdata/data/test.qhp b/tests/auto/qhelpprojectdata/data/test.qhp
index e9ac7f2..1e9074a 100644
--- a/tests/auto/qhelpprojectdata/data/test.qhp
+++ b/tests/auto/qhelpprojectdata/data/test.qhp
@@ -3,7 +3,7 @@
<metaData name="author" value="Nokia Corporation and/or its subsidiary(-ies)" />
<metaData name="language" value="en" />
<virtualFolder>testFolder</virtualFolder>
- <namespace>trolltech.com.1_0_0.test</namespace>
+ <namespace>trolltech.com.1.0.0.test</namespace>
<customFilter name="Custom Filter 1">
<filterAttribute>test</filterAttribute>
<filterAttribute>filter1</filterAttribute>
@@ -69,4 +69,4 @@
<file>cars.html</file>
</files>
</filterSection>
-</QtHelpProject> \ No newline at end of file
+</QtHelpProject>
diff --git a/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp b/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp
index 929cab5..9c458f7 100644
--- a/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp
+++ b/tests/auto/qhelpprojectdata/tst_qhelpprojectdata.cpp
@@ -83,7 +83,7 @@ void tst_QHelpProjectData::namespaceName()
QHelpProjectData data;
if (!data.readData(m_inputFile))
QFAIL("Cannot read qhp file!");
- QCOMPARE(data.namespaceName(), QString("trolltech.com.1_0_0.test"));
+ QCOMPARE(data.namespaceName(), QString("trolltech.com.1.0.0.test"));
}
void tst_QHelpProjectData::virtualFolder()
diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
index 10ff488..a280256 100644
--- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
+++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
@@ -683,11 +683,6 @@ tst_Suite::tst_Suite()
addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 7", willFixInNextReleaseMessage);
addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 26", willFixInNextReleaseMessage);
-#ifndef Q_CC_MINGW
- addExpectedFailure("ecma/Expressions/11.4.7-02.js", "-(-2147483648) == 2147483648", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "- -\"0x80000000\"", willFixInNextReleaseMessage);
-#endif
-
#ifdef Q_CC_MSVC
addExpectedFailure("ecma_3/Expressions/11.7.3-01.js", "11.7.3 - >>> should evaluate operands in order: order", "QTBUG-8056");
addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.7.3 >>>", "QTBUG-8056");
diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp
index f55b8db..d44ce72 100644
--- a/tests/auto/qtextcursor/tst_qtextcursor.cpp
+++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp
@@ -150,6 +150,7 @@ private slots:
void adjustCursorsOnInsert();
void cursorPositionWithBlockUndoAndRedo();
+ void cursorPositionWithBlockUndoAndRedo2();
private:
int blockCount();
@@ -1778,5 +1779,38 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo()
QCOMPARE(cursor.position(), cursorPositionAfter);
}
+void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo2()
+{
+ cursor.insertText("AAAABBBB");
+ int cursorPositionBefore = cursor.position();
+ cursor.setPosition(0, QTextCursor::KeepAnchor);
+ cursor.beginEditBlock();
+ cursor.removeSelectedText();
+ cursor.insertText("AAAABBBBCCCCDDDD");
+ cursor.endEditBlock();
+ doc->undo(&cursor);
+ QVERIFY(doc->toPlainText() == "AAAABBBB");
+ QCOMPARE(cursor.position(), cursorPositionBefore);
+
+ cursor.insertText("CCCC");
+ QVERIFY(doc->toPlainText() == "AAAABBBBCCCC");
+
+ cursorPositionBefore = cursor.position();
+ cursor.setPosition(0, QTextCursor::KeepAnchor);
+ cursor.beginEditBlock();
+ cursor.removeSelectedText();
+ cursor.insertText("AAAABBBBCCCCDDDD");
+ cursor.endEditBlock();
+
+ /* this undo now implicitely reinserts two segments, first "CCCCC", then
+ "AAAABBBB". The test ensures that the two are combined in order to
+ reconstruct the correct cursor position */
+ doc->undo(&cursor);
+
+
+ QVERIFY(doc->toPlainText() == "AAAABBBBCCCC");
+ QCOMPARE(cursor.position(), cursorPositionBefore);
+}
+
QTEST_MAIN(tst_QTextCursor)
#include "tst_qtextcursor.moc"
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp
index bd1bc53..871578e 100644
--- a/tests/auto/qthread/tst_qthread.cpp
+++ b/tests/auto/qthread/tst_qthread.cpp
@@ -168,16 +168,18 @@ public slots:
class Exit_Thread : public Simple_Thread
{
public:
+ Exit_Object *object;
int code;
int result;
void run()
{
- Simple_Thread::run();
- Exit_Object o;
- o.thread = this;
- o.code = code;
- QTimer::singleShot(100, &o, SLOT(slot()));
+ if (object) {
+ Simple_Thread::run();
+ object->thread = this;
+ object->code = code;
+ QTimer::singleShot(100, object, SLOT(slot()));
+ }
result = exec();
}
};
@@ -211,17 +213,16 @@ public slots:
class Quit_Thread : public Simple_Thread
{
public:
+ Quit_Object *object;
int result;
void run()
{
- {
- QMutexLocker locker(&mutex);
- cond.wakeOne();
+ if (object) {
+ Simple_Thread::run();
+ object->thread = this;
+ QTimer::singleShot(100, object, SLOT(slot()));
}
- Quit_Object o;
- o.thread = this;
- QTimer::singleShot(100, &o, SLOT(slot()));
result = exec();
}
};
@@ -420,6 +421,8 @@ void tst_QThread::stackSize()
void tst_QThread::exit()
{
Exit_Thread thread;
+ thread.object = new Exit_Object;
+ thread.object->moveToThread(&thread);
thread.code = 42;
thread.result = 0;
QVERIFY(!thread.isFinished());
@@ -433,6 +436,16 @@ void tst_QThread::exit()
QVERIFY(thread.isFinished());
QVERIFY(!thread.isRunning());
QCOMPARE(thread.result, thread.code);
+ delete thread.object;
+
+ Exit_Thread thread2;
+ thread2.object = 0;
+ thread2.code = 53;
+ thread2.result = 0;
+ thread2.start();
+ thread2.exit(thread.code);
+ QVERIFY(thread2.wait(five_minutes));
+ QCOMPARE(thread.result, thread.code);
}
void tst_QThread::start()
@@ -480,6 +493,9 @@ void tst_QThread::terminate()
void tst_QThread::quit()
{
Quit_Thread thread;
+ thread.object = new Quit_Object;
+ thread.object->moveToThread(&thread);
+ thread.result = -1;
QVERIFY(!thread.isFinished());
QVERIFY(!thread.isRunning());
QMutexLocker locker(&thread.mutex);
@@ -491,6 +507,15 @@ void tst_QThread::quit()
QVERIFY(thread.isFinished());
QVERIFY(!thread.isRunning());
QCOMPARE(thread.result, 0);
+ delete thread.object;
+
+ Quit_Thread thread2;
+ thread2.object = 0;
+ thread2.result = -1;
+ thread2.start();
+ thread2.quit();
+ QVERIFY(thread2.wait(five_minutes));
+ QCOMPARE(thread.result, 0);
}
void tst_QThread::wait()
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 76e20b9..1b2944e 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -6056,6 +6056,9 @@ void tst_QWidget::setToolTip()
#ifdef Q_OS_WINCE_WM
QSKIP("Mouse over doesn't work on Windows mobile.", SkipAll);
#endif
+#ifdef QT_MAC_USE_COCOA
+ QSKIP("Temporarily disable the rest on cocoa due to QCursor::setPos problems.", SkipAll);
+#endif
for (int pass = 0; pass < 2; ++pass) {
QWidget *popup = new QWidget(0, Qt::Popup);
diff --git a/tests/benchmarks/corelib/tools/qvector/main.cpp b/tests/benchmarks/corelib/tools/qvector/main.cpp
index 6393eda..29c4440 100644
--- a/tests/benchmarks/corelib/tools/qvector/main.cpp
+++ b/tests/benchmarks/corelib/tools/qvector/main.cpp
@@ -208,7 +208,6 @@ private slots:
void qvector_mutable_read_access();
#ifdef TEST_RETURN
void qvector_fill_and_return();
- void qvector_fill_and_return2();
#endif
// Purre Standard solution
@@ -217,14 +216,12 @@ private slots:
void stdvector_mutable_read_access();
#ifdef TEST_RETURN
void stdvector_fill_and_return();
- void stdvector_fill_and_return2();
#endif
// Build using std, pass as QVector
void mixedvector() { qWarning() << "mixed results: "; }
#ifdef TEST_RETURN
void mixedvector_fill_and_return();
- void mixedvector_fill_and_return2();
#endif
// Alternative implementation
@@ -233,7 +230,6 @@ private slots:
void qrawvector_mutable_read_access();
#ifdef TEST_RETURN
void qrawvector_fill_and_return();
- void qrawvector_fill_and_return2();
#endif
};
@@ -280,7 +276,6 @@ void tst_QVector::qvector_mutable_read_access()
#ifdef TEST_RETURN
extern QVector<double> qvector_fill_and_return_helper();
-extern QVector<double> qvector_fill_and_return_helper2();
void tst_QVector::qvector_fill_and_return()
{
@@ -290,13 +285,6 @@ void tst_QVector::qvector_fill_and_return()
}
}
-void tst_QVector::qvector_fill_and_return2()
-{
- QBENCHMARK {
- QVector<double> v = qvector_fill_and_return_helper2();
- s += v[1];
- }
-}
#endif
@@ -329,7 +317,6 @@ void tst_QVector::qrawvector_mutable_read_access()
#ifdef TEST_RETURN
extern QVector<double> qrawvector_fill_and_return_helper();
-extern QVector<double> qrawvector_fill_and_return_helper2();
void tst_QVector::qrawvector_fill_and_return()
{
@@ -339,13 +326,6 @@ void tst_QVector::qrawvector_fill_and_return()
}
}
-void tst_QVector::qrawvector_fill_and_return2()
-{
- QBENCHMARK {
- QVector<double> v = qrawvector_fill_and_return_helper();
- s += v[1];
- }
-}
#endif
@@ -378,7 +358,6 @@ void tst_QVector::stdvector_mutable_read_access()
#ifdef TEST_RETURN
extern std::vector<double> stdvector_fill_and_return_helper();
-extern std::vector<double> stdvector_fill_and_return_helper2();
void tst_QVector::stdvector_fill_and_return()
{
@@ -388,13 +367,6 @@ void tst_QVector::stdvector_fill_and_return()
}
}
-void tst_QVector::stdvector_fill_and_return2()
-{
- QBENCHMARK {
- std::vector<double> v = stdvector_fill_and_return_helper2();
- s += v[1];
- }
-}
#endif
///////////////////// mixed vector /////////////////////
@@ -402,7 +374,6 @@ void tst_QVector::stdvector_fill_and_return2()
#ifdef TEST_RETURN
extern QVector<double> mixedvector_fill_and_return_helper();
-extern QVector<double> mixedvector_fill_and_return_helper2();
void tst_QVector::mixedvector_fill_and_return()
{
@@ -412,13 +383,6 @@ void tst_QVector::mixedvector_fill_and_return()
}
}
-void tst_QVector::mixedvector_fill_and_return2()
-{
- QBENCHMARK {
- std::vector<double> v = stdvector_fill_and_return_helper2();
- s += v[1];
- }
-}
#endif
QTEST_MAIN(tst_QVector)
diff --git a/tests/benchmarks/corelib/tools/qvector/qvector.pro b/tests/benchmarks/corelib/tools/qvector/qvector.pro
index adb30c9..ccab83a 100644
--- a/tests/benchmarks/corelib/tools/qvector/qvector.pro
+++ b/tests/benchmarks/corelib/tools/qvector/qvector.pro
@@ -2,5 +2,5 @@ load(qttest_p4)
TARGET = tst_vector
QT = core
INCLUDEPATH += .
-SOURCES += main.cpp outofline.cpp outofline2.cpp
+SOURCES += main.cpp outofline.cpp
CONFIG += release