summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml53
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp27
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp10
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js7
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml10
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp14
-rw-r--r--tests/auto/headers/tst_headers.cpp2
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp2
-rw-r--r--tests/auto/linguist/lupdate/tst_lupdate.cpp2
-rw-r--r--tests/auto/qpixmap/loadFromData/designer_argb32.pngbin0 -> 4189 bytes
-rw-r--r--tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gifbin0 -> 3317 bytes
-rw-r--r--tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.pngbin0 -> 2431 bytes
-rw-r--r--tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gifbin0 -> 2086 bytes
-rw-r--r--tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.pngbin0 -> 1405 bytes
-rw-r--r--tests/auto/qpixmap/loadFromData/designer_rgb32.jpgbin0 -> 11810 bytes
-rw-r--r--tests/auto/qpixmap/loadFromData/designer_rgb32.pngbin0 -> 4282 bytes
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp37
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp22
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp19
-rw-r--r--tests/auto/qtextstream/test/test.pro1
-rw-r--r--tests/auto/qtimeline/tst_qtimeline.cpp12
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp27
-rw-r--r--tests/auto/qwidgetaction/tst_qwidgetaction.cpp6
23 files changed, 208 insertions, 43 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml
new file mode 100644
index 0000000..225d8d4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml
@@ -0,0 +1,53 @@
+import Qt 4.7
+
+Rectangle {
+ width:360;
+ height: 200
+
+ Item {
+ objectName: "theItem"
+ anchors.centerIn: parent
+ width: childrenRect.width
+ height: childrenRect.height
+ Rectangle {
+ id: header1
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.top: parent.top
+ width: 100; height: 50
+ color: "green"
+ }
+ Rectangle {
+ id: text1
+ anchors.top: header1.bottom
+ anchors.topMargin: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 100; height: 50
+ color: "blue"
+ }
+ }
+
+ states: [
+ State {
+ name: "row"
+ AnchorChanges {
+ target: header1
+ anchors.horizontalCenter: undefined
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.top: undefined
+ }
+ AnchorChanges {
+ target: text1
+ anchors.horizontalCenter: undefined
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.top: undefined
+ anchors.left: header1.right
+ }
+ PropertyChanges {
+ target: text1
+ anchors.leftMargin: 10
+ anchors.topMargin: 0
+ }
+ }
+ ]
+}
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index 0a66245..4a57def 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -44,7 +44,8 @@
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtDeclarative/qdeclarativecontext.h>
#include <QtDeclarative/qdeclarativeview.h>
-#include <QtDeclarative/qdeclarativeitem.h>
+#include <private/qdeclarativerectangle_p.h>
+#include <private/qdeclarativeitem_p.h>
#include "../../../shared/util.h"
#ifdef Q_OS_SYMBIAN
@@ -73,6 +74,7 @@ private slots:
void transforms_data();
void childrenRect();
void childrenRectBug();
+ void childrenRectBug2();
void childrenProperty();
void resourcesProperty();
@@ -753,6 +755,29 @@ void tst_QDeclarativeItem::childrenRectBug()
delete canvas;
}
+// QTBUG-11465
+void tst_QDeclarativeItem::childrenRectBug2()
+{
+ QDeclarativeView *canvas = new QDeclarativeView(0);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug2.qml"));
+ canvas->show();
+
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(canvas->rootObject());
+ QVERIFY(rect);
+ QDeclarativeItem *item = rect->findChild<QDeclarativeItem*>("theItem");
+ QCOMPARE(item->width(), qreal(100));
+ QCOMPARE(item->height(), qreal(110));
+ QCOMPARE(item->x(), qreal(130));
+
+ QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
+ rectPrivate->setState("row");
+ QCOMPARE(item->width(), qreal(210));
+ QCOMPARE(item->height(), qreal(50));
+ QCOMPARE(item->x(), qreal(75));
+
+ delete canvas;
+}
+
template<typename T>
T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName)
{
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index b3b6c20..3d66733 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -48,6 +48,7 @@
#include <QtCore/qtimer.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qtranslator.h>
#include "../../../shared/util.h"
@@ -124,14 +125,17 @@ void tst_qdeclarativelistmodel::waitForWorker(QDeclarativeItem *item)
void tst_qdeclarativelistmodel::static_i18n()
{
QString expect = QString::fromUtf8("na\303\257ve");
- QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\" } }";
+
+ QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\"; prop2: QT_TR_NOOP(\""+expect+"\") } }";
QDeclarativeEngine engine;
QDeclarativeComponent component(&engine);
component.setData(componentStr.toUtf8(), QUrl::fromLocalFile(""));
QDeclarativeListModel *obj = qobject_cast<QDeclarativeListModel*>(component.create());
QVERIFY(obj != 0);
- QString prop = obj->get(0).property(QLatin1String("prop1")).toString();
- QCOMPARE(prop,expect);
+ QString prop1 = obj->get(0).property(QLatin1String("prop1")).toString();
+ QCOMPARE(prop1,expect);
+ QString prop2 = obj->get(0).property(QLatin1String("prop2")).toString();
+ QCOMPARE(prop2,expect); // (no, not translated, QT_TR_NOOP is a no-op)
delete obj;
}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
new file mode 100644
index 0000000..c165e29
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
@@ -0,0 +1,7 @@
+.pragma library
+
+function loadComponent() {
+ var component = Qt.createComponent("createComponentData.qml");
+ return component.status;
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
new file mode 100644
index 0000000..aae7a91
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
@@ -0,0 +1,10 @@
+import Qt 4.7
+import "createComponent_lib.js" as Test
+
+Item {
+ property int status: Component.Null
+
+ Component.onCompleted: {
+ status = Test.loadComponent()
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 06561fa..fb100a5 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -76,6 +76,7 @@ private slots:
void openUrlExternally();
void md5();
void createComponent();
+ void createComponent_pragmaLibrary();
void createQmlObject();
void consoleLog();
void formatting();
@@ -361,6 +362,19 @@ void tst_qdeclarativeqt::createComponent()
delete object;
}
+void tst_qdeclarativeqt::createComponent_pragmaLibrary()
+{
+ // Currently, just loading createComponent_lib.qml causes crash on some platforms
+ /*
+ QDeclarativeComponent component(&engine, TEST_FILE("createComponent_lib.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QEXPECT_FAIL("", "QTBUG-11507", Continue);
+ QCOMPARE(object->property("status").toInt(), int(QDeclarativeComponent::Ready));
+ */
+}
+
void tst_qdeclarativeqt::createQmlObject()
{
QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml"));
diff --git a/tests/auto/headers/tst_headers.cpp b/tests/auto/headers/tst_headers.cpp
index 0538607..06c70f9 100644
--- a/tests/auto/headers/tst_headers.cpp
+++ b/tests/auto/headers/tst_headers.cpp
@@ -79,7 +79,7 @@ private:
tst_Headers::tst_Headers() :
copyrightPattern("\\*\\* Copyright \\(C\\) 20[0-9][0-9] Nokia Corporation and/or its subsidiary\\(-ies\\)."),
- licensePattern("\\*\\* \\$QT_BEGIN_LICENSE:(LGPL|BSD|3RDPARTY|LGPL-ONLY)\\$"),
+ licensePattern("\\*\\* \\$QT_BEGIN_LICENSE:(LGPL|BSD|3RDPARTY|LGPL-ONLY|FDL)\\$"),
moduleTest(QLatin1String("\\*\\* This file is part of the .+ of the Qt Toolkit."))
{
}
diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp
index 054da4a..998f588 100644
--- a/tests/auto/linguist/lconvert/tst_lconvert.cpp
+++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp
@@ -153,7 +153,7 @@ void tst_lconvert::verifyReadFail(const QString &fn)
{
QProcess cvt;
cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn));
- QVERIFY(cvt.waitForFinished(1000));
+ QVERIFY(cvt.waitForFinished(10000));
QVERIFY(cvt.exitStatus() == QProcess::NormalExit);
QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input");
}
diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp
index c179462..5ba6c52 100644
--- a/tests/auto/linguist/lupdate/tst_lupdate.cpp
+++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp
@@ -288,7 +288,7 @@ void tst_lupdate::good()
proc.setWorkingDirectory(workDir);
proc.setProcessChannelMode(QProcess::MergedChannels);
proc.start(m_cmdLupdate + ' ' + lupdatecmd, QIODevice::ReadWrite | QIODevice::Text);
- QVERIFY2(proc.waitForFinished(5000), qPrintable(lupdatecmd));
+ QVERIFY2(proc.waitForFinished(30000), qPrintable(lupdatecmd));
QByteArray output = proc.readAll();
QVERIFY2(proc.exitStatus() == QProcess::NormalExit,
"\"lupdate " + lupdatecmd.toLatin1() + "\" crashed\n" + output);
diff --git a/tests/auto/qpixmap/loadFromData/designer_argb32.png b/tests/auto/qpixmap/loadFromData/designer_argb32.png
new file mode 100644
index 0000000..55d8247
--- /dev/null
+++ b/tests/auto/qpixmap/loadFromData/designer_argb32.png
Binary files differ
diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif
new file mode 100644
index 0000000..26a6da3
--- /dev/null
+++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.gif
Binary files differ
diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png
new file mode 100644
index 0000000..28cd2f0
--- /dev/null
+++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_no_alpha.png
Binary files differ
diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif
new file mode 100644
index 0000000..49ec77b
--- /dev/null
+++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.gif
Binary files differ
diff --git a/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png
new file mode 100644
index 0000000..09735a9
--- /dev/null
+++ b/tests/auto/qpixmap/loadFromData/designer_indexed8_with_alpha.png
Binary files differ
diff --git a/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg b/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg
new file mode 100644
index 0000000..70f39c2
--- /dev/null
+++ b/tests/auto/qpixmap/loadFromData/designer_rgb32.jpg
Binary files differ
diff --git a/tests/auto/qpixmap/loadFromData/designer_rgb32.png b/tests/auto/qpixmap/loadFromData/designer_rgb32.png
new file mode 100644
index 0000000..bca471d
--- /dev/null
+++ b/tests/auto/qpixmap/loadFromData/designer_rgb32.png
Binary files differ
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 49b1e52..179f068 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -172,6 +172,9 @@ private slots:
void fromData();
void loadFromDataNullValues();
+ void loadFromDataImage_data();
+ void loadFromDataImage();
+
void preserveDepth();
void splash_crash();
@@ -1540,6 +1543,40 @@ void tst_QPixmap::loadFromDataNullValues()
}
}
+void tst_QPixmap::loadFromDataImage_data()
+{
+ QTest::addColumn<QString>("imagePath");
+#ifdef Q_OS_SYMBIAN
+ const QString prefix = QLatin1String(SRCDIR) + "loadFromData";
+#else
+ const QString prefix = QLatin1String(SRCDIR) + "/loadFromData";
+#endif
+ QTest::newRow("designer_argb32.png") << prefix + "/designer_argb32.png";
+ QTest::newRow("designer_indexed8_no_alpha.png") << prefix + "/designer_indexed8_no_alpha.png";
+ QTest::newRow("designer_indexed8_with_alpha.png") << prefix + "/designer_indexed8_with_alpha.png";
+ QTest::newRow("designer_rgb32.png") << prefix + "/designer_rgb32.png";
+ QTest::newRow("designer_indexed8_no_alpha.gif") << prefix + "/designer_indexed8_no_alpha.gif";
+ QTest::newRow("designer_indexed8_with_alpha.gif") << prefix + "/designer_indexed8_with_alpha.gif";
+ QTest::newRow("designer_rgb32.jpg") << prefix + "/designer_rgb32.jpg";
+}
+
+void tst_QPixmap::loadFromDataImage()
+{
+ QFETCH(QString, imagePath);
+
+ QImage imageRef(imagePath);
+ QPixmap pixmapWithCopy = QPixmap::fromImage(imageRef);
+
+ QFile file(imagePath);
+ file.open(QIODevice::ReadOnly);
+ QByteArray rawData = file.readAll();
+
+ QPixmap directLoadingPixmap;
+ directLoadingPixmap.loadFromData(rawData);
+
+ QVERIFY(pixmapsAreEqual(&pixmapWithCopy, &directLoadingPixmap));
+}
+
void tst_QPixmap::task_246446()
{
// This crashed without the bugfix in 246446
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index 51aee74..808299b 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -98,6 +98,7 @@ private slots:
void noundo_isModified2();
void noundo_isModified3();
void mightBeRichText();
+ void mightBeRichText_data();
void task240325();
@@ -679,13 +680,32 @@ void tst_QTextDocument::noundo_isModified3()
QVERIFY(doc->isModified());
}
-void tst_QTextDocument::mightBeRichText()
+void tst_QTextDocument::mightBeRichText_data()
{
const char qtDocuHeader[] = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
"<!DOCTYPE html\n"
" PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n"
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">";
QVERIFY(Qt::mightBeRichText(QString::fromLatin1(qtDocuHeader)));
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<bool>("result");
+
+ QTest::newRow("documentation-header") << QString("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
+ "<!DOCTYPE html\n"
+ " PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN\" \"DTD/xhtml1-strict.dtd\">\n"
+ "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">")
+ << true;
+ QTest::newRow("br-nospace") << QString("Test <br/> new line") << true;
+ QTest::newRow("br-space") << QString("Test <br /> new line") << true;
+ QTest::newRow("br-invalidspace") << QString("Test <br/ > new line") << false;
+ QTest::newRow("invalid closing tag") << QString("Test <br/ line") << false;
+}
+
+void tst_QTextDocument::mightBeRichText()
+{
+ QFETCH(QString, input);
+ QFETCH(bool, result);
+ QVERIFY(result == Qt::mightBeRichText(input));
}
Q_DECLARE_METATYPE(QTextDocumentFragment)
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index a631f3d..f798faf 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -112,6 +112,7 @@ private slots:
void columnWrapWithTabs();
void boundingRectForUnsetLineWidth();
void boundingRectForSetLineWidth();
+ void glyphLessItems();
// QTextLine stuff
void setNumColumnsWrapAtWordBoundaryOrAnywhere();
@@ -1339,6 +1340,24 @@ void tst_QTextLayout::lineWidthFromBOM()
// Don't spin into an infinite loop
}
+void tst_QTextLayout::glyphLessItems()
+{
+ {
+ QTextLayout layout;
+ layout.setText("\t\t");
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+ }
+
+ {
+ QTextLayout layout;
+ layout.setText(QString::fromLatin1("AA") + QChar(QChar::LineSeparator));
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+ }
+}
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"
diff --git a/tests/auto/qtextstream/test/test.pro b/tests/auto/qtextstream/test/test.pro
index c70c27b..20823de 100644
--- a/tests/auto/qtextstream/test/test.pro
+++ b/tests/auto/qtextstream/test/test.pro
@@ -28,7 +28,6 @@ wince*|symbian: {
wince*: {
DEFINES += SRCDIR=\\\"\\\"
}else:symbian {
- load(data_caging_paths)
# Symbian can't define SRCDIR meaningfully here
qt_not_deployed {
codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll
diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp
index b15d2a4..47d0550 100644
--- a/tests/auto/qtimeline/tst_qtimeline.cpp
+++ b/tests/auto/qtimeline/tst_qtimeline.cpp
@@ -247,11 +247,7 @@ void tst_QTimeLine::frameRate()
void tst_QTimeLine::value()
{
-#ifdef Q_OS_WINCE //On WinCE timer resolution is bad - use longer times
QTimeLine timeLine(2000);
-#else
- QTimeLine timeLine(200);
-#endif
QVERIFY(timeLine.currentValue() == 0.0);
// Default speed
@@ -270,19 +266,11 @@ void tst_QTimeLine::value()
timeLine.setCurrentTime(100);
timeLine.start();
// Let it update on its own
-#ifdef Q_OS_WINCE
QTest::qWait(500);
-#else
- QTest::qWait(50);
-#endif
QCOMPARE(timeLine.state(), QTimeLine::Running);
qreal value = timeLine.currentValue();
timeLine.setDirection(QTimeLine::Backward);
-#ifdef Q_OS_WINCE
QTest::qWait(1000);
-#else
- QTest::qWait(100);
-#endif
QVERIFY(timeLine.currentValue() < value);
timeLine.stop();
}
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 045216a..2d559c8 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -151,16 +151,6 @@ bool macHasAccessToWindowsServer()
#undef Bool
#endif
-// Will try to wait for the condition while allowing event processing
-// for a maximum of 2 seconds.
-#define WAIT_FOR_CONDITION(expr, expected) \
- do { \
- const int step = 100; \
- for (int i = 0; i < 2000 && expr != expected; i+=step) { \
- QTest::qWait(step); \
- } \
- } while(0)
-
//TESTED_CLASS=
//TESTED_FILES=
@@ -1665,13 +1655,11 @@ void tst_QWidget::focusChainOnHide()
child->setFocus();
qApp->processEvents();
- WAIT_FOR_CONDITION(child->hasFocus(), true);
- QCOMPARE(child->hasFocus(), true);
+ QTRY_COMPARE(child->hasFocus(), true);
child->hide();
qApp->processEvents();
- WAIT_FOR_CONDITION(parent->hasFocus(), true);
- QCOMPARE(parent->hasFocus(), true);
+ QTRY_COMPARE(parent->hasFocus(), true);
QCOMPARE(parent, qApp->focusWidget());
delete parent;
@@ -9241,7 +9229,8 @@ void tst_QWidget::syntheticEnterLeave()
QCOMPARE(grandChild->numLeaveEvents, 0);
QCOMPARE(child1->numLeaveEvents, 0);
- QCOMPARE(window.numEnterEvents, 1);
+ // This event arrives asynchronously
+ QTRY_COMPARE(window.numEnterEvents, 1);
QCOMPARE(child2->numEnterEvents, 1);
QCOMPARE(grandChild->numEnterEvents, 1);
QCOMPARE(child1->numEnterEvents, 0);
@@ -9332,7 +9321,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
child.show();
// Make sure the child gets enter event and no mouse move event.
- QCOMPARE(child.numEnterEvents, 1);
+ QTRY_COMPARE(child.numEnterEvents, 1);
QCOMPARE(child.numMouseMoveEvents, 0);
child.hide();
@@ -9343,7 +9332,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
// Make sure the child gets enter event and mouse move event.
// Note that we verify event->button() and event->buttons()
// in SELChild::mouseMoveEvent().
- QCOMPARE(child.numEnterEvents, 1);
+ QTRY_COMPARE(child.numEnterEvents, 1);
QCOMPARE(child.numMouseMoveEvents, 1);
// Sending synthetic enter/leave trough the parent's mousePressEvent handler.
@@ -9354,7 +9343,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
QTest::mouseClick(&parent, Qt::LeftButton);
// Make sure the child gets enter event and one mouse move event.
- QCOMPARE(child.numEnterEvents, 1);
+ QTRY_COMPARE(child.numEnterEvents, 1);
QCOMPARE(child.numMouseMoveEvents, 1);
child.hide();
@@ -9363,7 +9352,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave()
QTest::mouseClick(&parent, Qt::LeftButton);
// Make sure the child gets enter event and no mouse move event.
- QCOMPARE(child.numEnterEvents, 1);
+ QTRY_COMPARE(child.numEnterEvents, 1);
QCOMPARE(child.numMouseMoveEvents, 0);
}
#endif
diff --git a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp
index 53dc4b5..efe4838 100644
--- a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp
+++ b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp
@@ -187,12 +187,12 @@ void tst_QWidgetAction::visibilityUpdate()
action->setDefaultWidget(combo);
tb.addAction(action);
- qApp->processEvents(); //the call to show is delayed by the toolbar layout
- QVERIFY(combo->isVisible());
+ //the call to show is delayed by the toolbar layout
+ QTRY_VERIFY(combo->isVisible());
QVERIFY(action->isVisible());
action->setVisible(false);
- qApp->processEvents(); //the call to hide is delayed by the toolbar layout
+ //the call to hide is delayed by the toolbar layout
QTRY_VERIFY(!combo->isVisible());
delete action;