summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-10-09 13:35:16 +0200
committerAlexis Menard <alexis.menard@nokia.com>2009-10-09 13:35:16 +0200
commit6a5be55e5f96758daeca44899bc8598c76c214e7 (patch)
tree84d1c808bd491a29bbd265e515563ef79dbc3213 /tests/auto
parentb8eb2784a1c1a9812d09fca7c8722624f12dbd1c (diff)
parent2caa16ff98348b043ecc3598e5b9af4a2e2ae3bc (diff)
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into 4.6
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qabstractslider/tst_qabstractslider.cpp18
-rw-r--r--tests/auto/qbuttongroup/tst_qbuttongroup.cpp2
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp2
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp8
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp6
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp3
-rw-r--r--tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp16
-rw-r--r--tests/auto/qsharedpointer/tst_qsharedpointer.cpp26
-rw-r--r--tests/auto/qspinbox/tst_qspinbox.cpp10
-rw-r--r--tests/auto/qtimer/tst_qtimer.cpp9
-rw-r--r--tests/auto/selftests/tst_selftests.cpp2
11 files changed, 80 insertions, 22 deletions
diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp
index 9f7a78e987..5c70bded8b 100644
--- a/tests/auto/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp
@@ -714,7 +714,11 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // delta
<< int(Qt::Vertical) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
+#ifdef Q_WS_MAC
+ << 1 // expected position after
+#else
<< 20 // expected position after
+#endif
<< QPoint(0,0);
QTest::newRow("Normal data page") << 0 // initial position
@@ -773,7 +777,11 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Horizontal) // orientation of wheel
+#ifdef Q_WS_MAC
+ << 49 // expected position after
+#else
<< 30 // expected position after
+#endif
<< QPoint(1,1);
QTest::newRow("Past end") << 50 // initial position
@@ -784,7 +792,11 @@ void tst_QAbstractSlider::wheelEvent_data()
<< false // inverted controls
<< 1 // wheel scroll lines
<< false // with modifiers
+#ifdef Q_WS_MAC
+ << 60 // delta
+#else
<< 2 // delta
+#endif
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Horizontal) // orientation of wheel
<< 100 // expected position after
@@ -798,7 +810,11 @@ void tst_QAbstractSlider::wheelEvent_data()
<< false // inverted controls
<< 1 // wheel scroll lines
<< false // with modifiers
- << -2 // delta
+#ifdef Q_WS_MAC
+ << -60 // delta
+#else
+ << -2 // delta
+#endif
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Horizontal) // orientation of wheel
<< 0 // expected position after
diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
index 11c1f47a5a..a19f8650c4 100644
--- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
+++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
@@ -406,7 +406,7 @@ void tst_QButtonGroup::task106609()
QTestEventLoop::instance().enterLoop(1);
QApplication::setActiveWindow(&dlg);
- QTRY_COMPARE(QApplication::activeWindow(), &dlg);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&dlg));
//qDebug() << "int:" << spy2.count() << "QAbstractButton*:" << spy1.count();
QCOMPARE(spy2.count(), 2);
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index f6b082fbe6..dc2ca61e0f 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -944,7 +944,7 @@ void tst_QFiledialog::selectFiles()
QVERIFY(listView);
for (int i = 0; i < list.count(); ++i) {
fd.selectFile(fd.directory().path() + "/" + list.at(i));
-#if defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(QT_MAC_USE_COCOA) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN)
QEXPECT_FAIL("", "This test does not work on Mac, Windows, or Symbian", Abort);
#endif
QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty());
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index 6c5fe90350..0589994841 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -2820,17 +2820,15 @@ void tst_QGraphicsScene::update2()
CustomView view;
view.setScene(&scene);
view.show();
-#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
-#endif
- QTest::qWait(250);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(view.repaints >= 1);
view.repaints = 0;
// Make sure QGraphicsScene::update only requires one event-loop iteration
// before the view is updated.
scene.update();
qApp->processEvents();
- QCOMPARE(view.repaints, 1);
+ QTRY_COMPARE(view.repaints, 1);
view.repaints = 0;
// The same for partial scene updates.
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index e8979eaa4e..b407fef2a2 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -159,7 +159,11 @@ void tst_QGraphicsTransform::scale()
// definitions correct for the difference.
static inline bool fuzzyCompare(qreal p1, qreal p2)
{
- return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
+ // increase delta on small machines using float instead of double
+ if (sizeof(qreal) == sizeof(float))
+ return (qAbs(p1 - p2) <= 0.00002f * qMin(qAbs(p1), qAbs(p2)));
+ else
+ return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2)));
}
static bool fuzzyCompare(const QTransform& t1, const QTransform& t2)
{
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index 726ca5549d..4eb149f6a6 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -812,6 +812,9 @@ public:
void tst_QMenu::task258920_mouseBorder()
{
+#ifdef Q_OS_WINCE_WM
+ QSKIP("Mouse move related signals for Windows Mobile unavailable", SkipAll);
+#endif
Menu258920 menu;
QAction *action = menu.addAction("test");
diff --git a/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp b/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp
index 3f9632cab4..2e210875c6 100644
--- a/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp
+++ b/tests/auto/qnetworkrequest/tst_qnetworkrequest.cpp
@@ -66,6 +66,7 @@ private slots:
void setHeader();
void rawHeaderParsing_data();
void rawHeaderParsing();
+ void originatingObject();
void removeHeader();
};
@@ -476,5 +477,20 @@ void tst_QNetworkRequest::removeHeader()
QVERIFY(request.hasRawHeader("bar"));
}
+void tst_QNetworkRequest::originatingObject()
+{
+ QNetworkRequest request;
+
+ QVERIFY(!request.originatingObject());
+
+ {
+ QObject dummy;
+ request.setOriginatingObject(&dummy);
+ QCOMPARE(request.originatingObject(), &dummy);
+ }
+
+ QVERIFY(!request.originatingObject());
+}
+
QTEST_MAIN(tst_QNetworkRequest)
#include "tst_qnetworkrequest.moc"
diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
index 58eaacbe68..ed9206cc28 100644
--- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp
@@ -812,8 +812,14 @@ void tst_QSharedPointer::differentPointers()
QVERIFY(baseptr.data() == aData);
QVERIFY(aData == baseptr.data());
- QVERIFY(bool(operator==<Data,DiffPtrDerivedData>(baseptr, aData)));
+
+#if defined(Q_CC_MSVC) && _MSC_VER < 1400
+ QEXPECT_FAIL("", "Compiler bug", Continue);
+#endif
QVERIFY(baseptr == aData);
+#if defined(Q_CC_MSVC) && _MSC_VER < 1400
+ QEXPECT_FAIL("", "Compiler bug", Continue);
+#endif
QVERIFY(aData == baseptr);
}
check();
@@ -829,6 +835,9 @@ void tst_QSharedPointer::differentPointers()
QVERIFY(ptr == baseptr);
QVERIFY(ptr.data() == baseptr.data());
QVERIFY(ptr == aBase);
+#if defined(Q_CC_MSVC) && _MSC_VER < 1400
+ QEXPECT_FAIL("", "Compiler bug", Continue);
+#endif
QVERIFY(baseptr == aData);
}
check();
@@ -845,6 +854,9 @@ void tst_QSharedPointer::differentPointers()
QVERIFY(ptr.data() == baseptr.data());
QVERIFY(ptr == aBase);
QVERIFY(ptr == aData);
+#if defined(Q_CC_MSVC) && _MSC_VER < 1400
+ QEXPECT_FAIL("", "Compiler bug", Continue);
+#endif
QVERIFY(baseptr == aData);
QVERIFY(baseptr == aBase);
}
@@ -865,6 +877,9 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
QVERIFY(ptr.data() == baseptr.data());
QVERIFY(ptr == aBase);
QVERIFY(ptr == aData);
+#if defined(Q_CC_MSVC) && _MSC_VER < 1400
+ QEXPECT_FAIL("", "Compiler bug", Continue);
+#endif
QVERIFY(baseptr == aData);
QVERIFY(baseptr == aBase);
}
@@ -882,6 +897,9 @@ void tst_QSharedPointer::virtualBaseDifferentPointers()
QVERIFY(ptr.data() == baseptr.data());
QVERIFY(ptr == aBase);
QVERIFY(ptr == aData);
+#if defined(Q_CC_MSVC) && _MSC_VER < 1400
+ QEXPECT_FAIL("", "Compiler bug", Continue);
+#endif
QVERIFY(baseptr == aData);
QVERIFY(baseptr == aBase);
}
@@ -1701,7 +1719,7 @@ void tst_QSharedPointer::invalidConstructs()
"struct DerivedData: public Data { int j; };\n"
"\n"
"extern int forwardDeclaredDestructorRunCount;\n"
- "struct ForwardDeclared;\n"
+ "class ForwardDeclared;\n"
"ForwardDeclared *forwardPointer();\n"
);
@@ -1730,6 +1748,10 @@ void tst_QSharedPointer::invalidConstructs()
bool result = (test.*testFunction)(body);
if (qgetenv("QTEST_EXTERNAL_DEBUG").toInt() > 0) {
qDebug("External test output:");
+#ifdef Q_CC_MSVC
+ // MSVC prints errors to stdout
+ printf("%s\n", test.standardOutput().constData());
+#endif
printf("%s\n", test.standardError().constData());
}
if (!result) {
diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp
index 4829b6bca6..2389060292 100644
--- a/tests/auto/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/qspinbox/tst_qspinbox.cpp
@@ -980,26 +980,28 @@ void tst_QSpinBox::sizeHint()
sizeHint_SpinBox *spinBox = new sizeHint_SpinBox;
layout->addWidget(spinBox);
widget->show();
- QTest::qWait(100);
+ QTest::qWaitForWindowShown(widget);
// Prefix
spinBox->sizeHintRequests = 0;
spinBox->setPrefix(QLatin1String("abcdefghij"));
qApp->processEvents();
- QVERIFY(spinBox->sizeHintRequests > 0);
+ QTRY_VERIFY(spinBox->sizeHintRequests > 0);
// Suffix
spinBox->sizeHintRequests = 0;
spinBox->setSuffix(QLatin1String("abcdefghij"));
qApp->processEvents();
- QVERIFY(spinBox->sizeHintRequests > 0);
+ QTRY_VERIFY(spinBox->sizeHintRequests > 0);
// Range
spinBox->sizeHintRequests = 0;
spinBox->setRange(0, 1234567890);
spinBox->setValue(spinBox->maximum());
qApp->processEvents();
- QVERIFY(spinBox->sizeHintRequests > 0);
+ QTRY_VERIFY(spinBox->sizeHintRequests > 0);
+
+ delete widget;
}
QTEST_MAIN(tst_QSpinBox)
diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp
index 0877500641..01a6317a84 100644
--- a/tests/auto/qtimer/tst_qtimer.cpp
+++ b/tests/auto/qtimer/tst_qtimer.cpp
@@ -46,10 +46,6 @@
#include <qtimer.h>
#include <qthread.h>
-
-
-
-
#if defined Q_OS_UNIX
#include <unistd.h>
#endif
@@ -242,7 +238,6 @@ public:
// sleep for 2ms
QTest::qSleep(2);
-
killTimer(te->timerId());
}
@@ -277,9 +272,11 @@ void tst_QTimer::livelock()
#elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
QEXPECT_FAIL("zero timer", "", Continue);
QEXPECT_FAIL("non-zero timer", "", Continue);
-#elif defined(Q_OS_WIN)
+#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (QSysInfo::WindowsVersion < QSysInfo::WV_XP)
QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Windows 2000", Continue);
+#elif defined(Q_OS_WINCE)
+ QEXPECT_FAIL("non-zero timer", "Windows CE devices often too slow", Continue);
#endif
QVERIFY(tester.postEventAtRightTime);
}
diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp
index 1a2de65cc3..579f4eb959 100644
--- a/tests/auto/selftests/tst_selftests.cpp
+++ b/tests/auto/selftests/tst_selftests.cpp
@@ -299,7 +299,7 @@ void tst_Selftests::runSubTest()
void tst_Selftests::initTestCase()
{
-#ifndef Q_OS_UNIX
+#if !defined(Q_OS_UNIX) || defined(Q_WS_MAC)
m_checkXMLBlacklist.append("crashes"); // This test crashes (XML valid on Unix only)
#endif
m_checkXMLBlacklist.append("waitwithoutgui"); // This test is not a QTestLib test.