diff options
author | David Boddie <david.boddie@nokia.com> | 2010-09-15 17:21:39 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2010-09-15 17:21:39 (GMT) |
commit | f23bce37a8a3536bfedce7cc2d57f0761b2d1e31 (patch) | |
tree | e7dd9c7f7724df3f12fe819321e44c63f4eb0c2c /tests/auto | |
parent | f41eac269d354ebeb797b9cb173b09fc996564cf (diff) | |
parent | b832dffc1eb85181aa2d99afd1a6c764b634091d (diff) | |
download | Qt-f23bce37a8a3536bfedce7cc2d57f0761b2d1e31.zip Qt-f23bce37a8a3536bfedce7cc2d57f0761b2d1e31.tar.gz Qt-f23bce37a8a3536bfedce7cc2d57f0761b2d1e31.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'tests/auto')
45 files changed, 1732 insertions, 176 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 1001278..da15a85 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -47,22 +47,13 @@ #include <private/qdeclarativeanimatedimage_p.h> #include "../shared/testhttpserver.h" +#include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir #define SRCDIR "." #endif -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 6; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - class tst_qdeclarativeanimatedimage : public QObject { Q_OBJECT @@ -152,14 +143,14 @@ void tst_qdeclarativeanimatedimage::remote() QDeclarativeEngine engine; QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14449/" + fileName)); - TRY_WAIT(component.isReady()); + QTRY_VERIFY(component.isReady()); QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); QVERIFY(anim); - TRY_WAIT(anim->isPlaying()); + QTRY_VERIFY(anim->isPlaying()); if (paused) { - TRY_WAIT(anim->isPaused()); + QTRY_VERIFY(anim->isPaused()); QCOMPARE(anim->currentFrame(), 2); } QVERIFY(anim->status() != QDeclarativeAnimatedImage::Error); diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 1b73cf7..c77d395 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -53,6 +53,7 @@ #include <QtDeclarative/qdeclarativecontext.h> #include "../shared/testhttpserver.h" +#include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -62,16 +63,6 @@ #define SERVER_PORT 14446 #define SERVER_ADDR "http://127.0.0.1:14446" -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 60; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - class tst_qdeclarativeborderimage : public QObject { @@ -154,18 +145,18 @@ void tst_qdeclarativeborderimage::imageSource() QVERIFY(obj != 0); if (remote) - TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); + QTRY_VERIFY(obj->status() == QDeclarativeBorderImage::Loading); QCOMPARE(obj->source(), remote ? source : QUrl(source)); if (error.isEmpty()) { - TRY_WAIT(obj->status() == QDeclarativeBorderImage::Ready); + QTRY_VERIFY(obj->status() == QDeclarativeBorderImage::Ready); QCOMPARE(obj->width(), 120.); QCOMPARE(obj->height(), 120.); QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch); QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch); } else { - TRY_WAIT(obj->status() == QDeclarativeBorderImage::Error); + QTRY_VERIFY(obj->status() == QDeclarativeBorderImage::Error); } delete obj; @@ -273,14 +264,14 @@ void tst_qdeclarativeborderimage::sciSource() QVERIFY(obj != 0); if (remote) - TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); + QTRY_VERIFY(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); + QTRY_VERIFY(obj->status() == QDeclarativeBorderImage::Ready); QCOMPARE(obj->border()->left(), 10); QCOMPARE(obj->border()->top(), 20); QCOMPARE(obj->border()->right(), 30); @@ -288,7 +279,7 @@ void tst_qdeclarativeborderimage::sciSource() QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Round); QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Repeat); } else { - TRY_WAIT(obj->status() == QDeclarativeBorderImage::Error); + QTRY_VERIFY(obj->status() == QDeclarativeBorderImage::Error); } delete obj; diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 33bf7ea..c10a110 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -52,6 +52,7 @@ #include <private/qdeclarativeglobalscriptclass_p.h> #include "testtypes.h" #include "testhttpserver.h" +#include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir @@ -2416,15 +2417,6 @@ void tst_qdeclarativeecmascript::function() delete o; } -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 6; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - // Test the "Qt.include" method void tst_qdeclarativeecmascript::include() { @@ -2496,8 +2488,8 @@ void tst_qdeclarativeecmascript::include() QObject *o = component.create(); QVERIFY(o != 0); - TRY_WAIT(o->property("done").toBool() == true); - TRY_WAIT(o->property("done2").toBool() == true); + QTRY_VERIFY(o->property("done").toBool() == true); + QTRY_VERIFY(o->property("done2").toBool() == true); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -2524,7 +2516,7 @@ void tst_qdeclarativeecmascript::include() QObject *o = component.create(); QVERIFY(o != 0); - TRY_WAIT(o->property("done").toBool() == true); + QTRY_VERIFY(o->property("done").toBool() == true); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index d4d8bf6..5fd373c 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -604,6 +604,8 @@ void tst_QDeclarativeGridView::currentIndex() // no wrap gridview->setCurrentIndex(0); QCOMPARE(gridview->currentIndex(), 0); + // confirm that the velocity is updated + QTRY_VERIFY(gridview->verticalVelocity() != 0.0); gridview->moveCurrentIndexUp(); QCOMPARE(gridview->currentIndex(), 0); diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 8cfb487..2686127 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -52,7 +52,9 @@ #include <private/qdeclarativeloader_p.h> #include <QtDeclarative/qdeclarativecontext.h> #include <QtDeclarative/qdeclarativeexpression.h> +#include <QtTest/QSignalSpy> +#include "../../../shared/util.h" #include "../shared/testhttpserver.h" #ifdef Q_OS_SYMBIAN @@ -63,18 +65,7 @@ #define SERVER_PORT 14451 #define SERVER_ADDR "http://127.0.0.1:14451" -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 60; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - class tst_qdeclarativeimage : public QObject - { Q_OBJECT public: @@ -91,6 +82,7 @@ private slots: void svg(); void big(); void tiling_QTBUG_6716(); + void noLoading(); private: template<typename T> @@ -173,18 +165,18 @@ void tst_qdeclarativeimage::imageSource() QVERIFY(obj->asynchronous() == true); if (remote || async) - TRY_WAIT(obj->status() == QDeclarativeImage::Loading); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); QCOMPARE(obj->source(), remote ? source : QUrl(source)); if (error.isEmpty()) { - TRY_WAIT(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); QCOMPARE(obj->width(), qreal(width)); QCOMPARE(obj->height(), qreal(height)); QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); QCOMPARE(obj->progress(), 1.0); } else { - TRY_WAIT(obj->status() == QDeclarativeImage::Error); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Error); } delete obj; @@ -355,6 +347,54 @@ void tst_qdeclarativeimage::tiling_QTBUG_6716() } } +void tst_qdeclarativeimage::noLoading() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png"); + + QString componentStr = "import Qt 4.7\nImage { source: srcImage }"; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart.png")); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + QVERIFY(obj->status() == QDeclarativeImage::Ready); + + QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(const QUrl &))); + QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal))); + QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QDeclarativeImageBase::Status))); + + // Loading local file + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + QTRY_COMPARE(sourceSpy.count(), 1); + QTRY_COMPARE(progressSpy.count(), 0); + QTRY_COMPARE(statusSpy.count(), 0); + + // Loading remote file + ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/oldcolors.png"); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); + QTRY_VERIFY(obj->progress() == 0.0); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + QTRY_COMPARE(sourceSpy.count(), 2); + QTRY_COMPARE(progressSpy.count(), 2); + QTRY_COMPARE(statusSpy.count(), 2); + + // Loading remote file again - should not go through 'Loading' state. + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/oldcolors.png"); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + QTRY_COMPARE(sourceSpy.count(), 4); + QTRY_COMPARE(progressSpy.count(), 2); + QTRY_COMPARE(statusSpy.count(), 2); +} + /* Find an item with the specified objectName. If index is supplied then the item must also evaluate the {index} expression equal to index diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro index bdb6423..3bf0ea1 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -8,11 +8,7 @@ SOURCES += tst_qdeclarativeimageprovider.cpp # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov -symbian: { - importFiles.sources = data - importFiles.path = . - DEPLOYMENT = importFiles -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index d0afc8a..d38160d 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -45,26 +45,15 @@ #include <private/qdeclarativeimage_p.h> #include <QImageReader> #include <QWaitCondition> +#include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN // In Symbian OS test data is located in applications private dir #define SRCDIR "." #endif -// QDeclarativeImageProvider::request() is run in an idle thread where possible -// Be generous in our timeout. -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 10; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(100); \ - } \ - QVERIFY((expr)); \ - } while (false) - Q_DECLARE_METATYPE(QDeclarativeImageProvider*); - class tst_qdeclarativeimageprovider : public QObject { Q_OBJECT @@ -212,13 +201,13 @@ void tst_qdeclarativeimageprovider::runTest(bool async, QDeclarativeImageProvide QVERIFY(obj != 0); if (async) - TRY_WAIT(obj->status() == QDeclarativeImage::Loading); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); QCOMPARE(obj->source(), QUrl(source)); if (error.isEmpty()) { if (async) - TRY_WAIT(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); else QVERIFY(obj->status() == QDeclarativeImage::Ready); QCOMPARE(obj->width(), qreal(size.width())); @@ -229,7 +218,7 @@ void tst_qdeclarativeimageprovider::runTest(bool async, QDeclarativeImageProvide QCOMPARE(obj->progress(), 1.0); } else { if (async) - TRY_WAIT(obj->status() == QDeclarativeImage::Error); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Error); else QVERIFY(obj->status() == QDeclarativeImage::Error); } @@ -391,7 +380,7 @@ void tst_qdeclarativeimageprovider::threadTest() provider->cond.wakeAll(); QTest::qWait(250); foreach(QDeclarativeImage *img, images) { - TRY_WAIT(img->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(img->status() == QDeclarativeImage::Ready); } } diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index e4b59a7..cd17fad 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1016,6 +1016,8 @@ void tst_QDeclarativeListView::currentIndex() // no wrap listview->setCurrentIndex(0); QCOMPARE(listview->currentIndex(), 0); + // confirm that the velocity is updated + QTRY_VERIFY(listview->verticalVelocity() != 0.0); listview->incrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 1); diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 3baf848..b62392d 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -61,15 +61,6 @@ inline QUrl TEST_FILE(const QString &filename) return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); } -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 6; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - class tst_QDeclarativeLoader : public QObject { @@ -460,7 +451,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); - TRY_WAIT(loader->status() == QDeclarativeLoader::Ready); + QTRY_VERIFY(loader->status() == QDeclarativeLoader::Ready); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); @@ -491,7 +482,7 @@ void tst_QDeclarativeLoader::networkComponent() QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(item->QGraphicsObject::children().at(1)); QVERIFY(loader); - TRY_WAIT(loader->status() == QDeclarativeLoader::Ready); + QTRY_VERIFY(loader->status() == QDeclarativeLoader::Ready); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); @@ -515,7 +506,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); - TRY_WAIT(loader->status() == QDeclarativeLoader::Error); + QTRY_VERIFY(loader->status() == QDeclarativeLoader::Error); QVERIFY(loader->item() == 0); QCOMPARE(loader->progress(), 0.0); diff --git a/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml new file mode 100644 index 0000000..9cddf1b --- /dev/null +++ b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Item { + id: root + property int clicked: 0 + property int doubleClicked: 0 + + MouseArea { + width: 200; height: 200 + onClicked: { root.clicked++ } + onDoubleClicked: { root.doubleClicked++ } + } +} + diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp index c9bb467..e4ec01f 100644 --- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -62,6 +62,7 @@ private slots: void updateMouseAreaPosOnResize(); void noOnClickedWithPressAndHold(); void onMousePressRejected(); + void doubleClick(); private: QDeclarativeView *createView(); @@ -390,6 +391,37 @@ void tst_QDeclarativeMouseArea::onMousePressRejected() QVERIFY(!canvas->rootObject()->property("mr2_released").toBool()); } +void tst_QDeclarativeMouseArea::doubleClick() +{ + QDeclarativeView *canvas = createView(); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/doubleclick.qml")); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QGraphicsScene *scene = canvas->scene(); + QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress); + pressEvent.setScenePos(QPointF(100, 100)); + pressEvent.setButton(Qt::LeftButton); + pressEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &pressEvent); + + QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease); + releaseEvent.setScenePos(QPointF(100, 100)); + releaseEvent.setButton(Qt::LeftButton); + releaseEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &releaseEvent); + + QGraphicsSceneMouseEvent dblClickEvent(QEvent::GraphicsSceneMouseDoubleClick); + dblClickEvent.setScenePos(QPointF(100, 100)); + dblClickEvent.setButton(Qt::LeftButton); + dblClickEvent.setButtons(Qt::LeftButton); + QApplication::sendEvent(scene, &dblClickEvent); + + QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1); + QCOMPARE(canvas->rootObject()->property("doubleClicked").toInt(), 1); +} + QTEST_MAIN(tst_QDeclarativeMouseArea) #include "tst_qdeclarativemousearea.moc" diff --git a/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml new file mode 100644 index 0000000..be92aba --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml @@ -0,0 +1,30 @@ +import Qt 4.7 + +Rectangle { + width: 400; height: 400 + Rectangle { + id: myRect + objectName: "MyRect" + x: 5; y: 5 + width: 100; height: 100 + color: "red" + } + MouseArea { + id: clickable + anchors.fill: parent + } + + Item { + id: newParent + rotation: 180 + } + + states: State { + name: "reparented" + when: clickable.pressed + ParentChange { + target: myRect + parent: newParent + } + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 6ae2759..0621602 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -581,6 +581,21 @@ void tst_qdeclarativestates::parentChange() //do a non-qFuzzyCompare fuzzy compare QVERIFY(innerRect->y() < qreal(0.00001) && innerRect->y() > qreal(-0.00001)); } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange6.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QDeclarativeItemPrivate::get(rect)->setState("reparented"); + QCOMPARE(innerRect->rotation(), qreal(180)); + QCOMPARE(innerRect->scale(), qreal(1)); + QCOMPARE(innerRect->x(), qreal(-105)); + QCOMPARE(innerRect->y(), qreal(-105)); + } } void tst_qdeclarativestates::parentChangeErrors() diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 658f381..f683d98 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -608,6 +608,17 @@ void tst_qdeclarativetext::style() QCOMPARE((int)textObject->style(), (int)styles.at(i)); QCOMPARE(textObject->styleColor(), QColor("white")); } + QString componentStr = "import Qt 4.7\nText { text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QRectF brPre = textObject->boundingRect(); + textObject->setStyle(QDeclarativeText::Outline); + QRectF brPost = textObject->boundingRect(); + + QVERIFY(brPre.width() < brPost.width()); + QVERIFY(brPre.height() < brPost.height()); } void tst_qdeclarativetext::color() diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index ecce349..89252fb 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -45,6 +45,7 @@ #include <QDebug> #include <QNetworkCookieJar> #include "testhttpserver.h" +#include "../../../shared/util.h" #define SERVER_PORT 14445 @@ -156,16 +157,6 @@ void tst_qdeclarativexmlhttprequest::domExceptionCodes() delete object; } -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 6; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - void tst_qdeclarativexmlhttprequest::callbackException_data() { QTest::addColumn<QString>("which"); @@ -193,7 +184,7 @@ void tst_qdeclarativexmlhttprequest::callbackException() object->setProperty("which", which); component.completeCreate(); - TRY_WAIT(object->property("threw").toBool() == true); + QTRY_VERIFY(object->property("threw").toBool() == true); delete object; } @@ -289,7 +280,7 @@ void tst_qdeclarativexmlhttprequest::open() QCOMPARE(object->property("responseText").toBool(), true); QCOMPARE(object->property("responseXML").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete server; delete object; @@ -372,7 +363,7 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader() object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -442,7 +433,7 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader_illegalName() QCOMPARE(object->property("responseText").toBool(), true); QCOMPARE(object->property("responseXML").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -464,7 +455,7 @@ void tst_qdeclarativexmlhttprequest::setRequestHeader_sent() QCOMPARE(object->property("test").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -501,7 +492,7 @@ void tst_qdeclarativexmlhttprequest::send_alreadySent() QVERIFY(object != 0); QCOMPARE(object->property("test").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -523,7 +514,7 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData() object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -542,7 +533,7 @@ void tst_qdeclarativexmlhttprequest::send_ignoreData() object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -566,7 +557,7 @@ void tst_qdeclarativexmlhttprequest::send_withdata() object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); component.completeCreate(); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -601,7 +592,7 @@ void tst_qdeclarativexmlhttprequest::abort_unsent() QCOMPARE(object->property("responseText").toBool(), true); QCOMPARE(object->property("responseXML").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -622,7 +613,7 @@ void tst_qdeclarativexmlhttprequest::abort_opened() QCOMPARE(object->property("responseText").toBool(), true); QCOMPARE(object->property("responseXML").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -647,7 +638,7 @@ void tst_qdeclarativexmlhttprequest::abort() QCOMPARE(object->property("didNotSeeUnsent").toBool(), true); QCOMPARE(object->property("endStateUnsent").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); delete object; } @@ -674,7 +665,7 @@ void tst_qdeclarativexmlhttprequest::getResponseHeader() QCOMPARE(object->property("readyState").toBool(), true); QCOMPARE(object->property("openedState").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("headersReceivedState").toBool(), true); QCOMPARE(object->property("headersReceivedNullHeader").toBool(), true); @@ -722,7 +713,7 @@ void tst_qdeclarativexmlhttprequest::getResponseHeader_args() QObject *object = component.create(); QVERIFY(object != 0); - TRY_WAIT(object->property("exceptionThrown").toBool() == true); + QTRY_VERIFY(object->property("exceptionThrown").toBool() == true); delete object; } @@ -748,7 +739,7 @@ void tst_qdeclarativexmlhttprequest::getAllResponseHeaders() QCOMPARE(object->property("readyState").toBool(), true); QCOMPARE(object->property("openedState").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("headersReceivedState").toBool(), true); QCOMPARE(object->property("headersReceivedHeader").toBool(), true); @@ -790,7 +781,7 @@ void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_args() QObject *object = component.create(); QVERIFY(object != 0); - TRY_WAIT(object->property("exceptionThrown").toBool() == true); + QTRY_VERIFY(object->property("exceptionThrown").toBool() == true); delete object; } @@ -813,7 +804,7 @@ void tst_qdeclarativexmlhttprequest::status() object->setProperty("expectedStatus", status); component.completeCreate(); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("unsentException").toBool(), true); QCOMPARE(object->property("openedException").toBool(), true); @@ -853,7 +844,7 @@ void tst_qdeclarativexmlhttprequest::statusText() object->setProperty("expectedStatus", statusText); component.completeCreate(); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("unsentException").toBool(), true); QCOMPARE(object->property("openedException").toBool(), true); @@ -894,7 +885,7 @@ void tst_qdeclarativexmlhttprequest::responseText() object->setProperty("expectedText", responseText); component.completeCreate(); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("unsent").toBool(), true); QCOMPARE(object->property("opened").toBool(), true); @@ -931,7 +922,7 @@ void tst_qdeclarativexmlhttprequest::nonUtf8() object->setProperty("fileName", fileName); QMetaObject::invokeMethod(object, "startRequest"); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("responseText").toString(), responseText); @@ -1000,7 +991,7 @@ void tst_qdeclarativexmlhttprequest::redirects() object->setProperty("expectedText", ""); component.completeCreate(); - TRY_WAIT(object->property("done").toBool() == true); + QTRY_VERIFY(object->property("done").toBool() == true); QCOMPARE(object->property("dataOK").toBool(), true); delete object; @@ -1019,7 +1010,7 @@ void tst_qdeclarativexmlhttprequest::redirects() object->setProperty("expectedText", ""); component.completeCreate(); - TRY_WAIT(object->property("done").toBool() == true); + QTRY_VERIFY(object->property("done").toBool() == true); QCOMPARE(object->property("dataOK").toBool(), true); delete object; @@ -1056,7 +1047,7 @@ void tst_qdeclarativexmlhttprequest::responseXML_invalid() QObject *object = component.create(); QVERIFY(object != 0); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("xmlNull").toBool(), true); @@ -1070,7 +1061,7 @@ void tst_qdeclarativexmlhttprequest::document() QObject *object = component.create(); QVERIFY(object != 0); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("xmlTest").toBool(), true); @@ -1084,7 +1075,7 @@ void tst_qdeclarativexmlhttprequest::element() QObject *object = component.create(); QVERIFY(object != 0); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("xmlTest").toBool(), true); @@ -1098,7 +1089,7 @@ void tst_qdeclarativexmlhttprequest::attr() QObject *object = component.create(); QVERIFY(object != 0); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("xmlTest").toBool(), true); @@ -1112,7 +1103,7 @@ void tst_qdeclarativexmlhttprequest::text() QObject *object = component.create(); QVERIFY(object != 0); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("xmlTest").toBool(), true); @@ -1126,7 +1117,7 @@ void tst_qdeclarativexmlhttprequest::cdata() QObject *object = component.create(); QVERIFY(object != 0); - TRY_WAIT(object->property("dataOK").toBool() == true); + QTRY_VERIFY(object->property("dataOK").toBool() == true); QCOMPARE(object->property("xmlTest").toBool(), true); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png Binary files differnew file mode 100644 index 0000000..bf02e1a --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png Binary files differnew file mode 100644 index 0000000..ae71dc8 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png Binary files differnew file mode 100644 index 0000000..6f631b0 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml new file mode 100644 index 0000000..3124973 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml @@ -0,0 +1,795 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "2c6600b50a18c415032fa95fe5089da6" + } + Frame { + msec: 32 + hash: "aefd5a2570cc0252be102644ec1e49e3" + } + Frame { + msec: 48 + hash: "6183d0554a8b812bee02719dc4df21d1" + } + Frame { + msec: 64 + hash: "e1b3a94d033626338de0e04dba7b6df9" + } + Frame { + msec: 80 + hash: "7d1a5a265fb20ac4d741d76ab7b3a41f" + } + Frame { + msec: 96 + hash: "0ce7d2acda3e5ccb7b2364e2a7b409a4" + } + Frame { + msec: 112 + hash: "21f3a66ee80fcb2dd4dce0d1666aa4dd" + } + Frame { + msec: 128 + hash: "ea5b81ff2805210111cb388ab9be0d8f" + } + Frame { + msec: 144 + hash: "a8a54a3c524dcf6777b71d99ae2d50bd" + } + Frame { + msec: 160 + hash: "6b658c468af8a88e4a282d57fdcbc3b0" + } + Frame { + msec: 176 + hash: "986121c9d928cc9ceb912a975f75760a" + } + Frame { + msec: 192 + hash: "4bf3593d0edc4347cf77670a48ba4440" + } + Frame { + msec: 208 + hash: "ea00f25295fb019f949930fb7109ceb4" + } + Frame { + msec: 224 + hash: "ad6cc7563e2720c405842317d0ce731a" + } + Frame { + msec: 240 + hash: "8a03a1207cdb5bd92f5227b25a7b638e" + } + Frame { + msec: 256 + hash: "f355321aa47d18e8b6dde503565d0e97" + } + Frame { + msec: 272 + hash: "e18f671cac8e68948f32a468bf2630cf" + } + Frame { + msec: 288 + hash: "264bca92fba53f25439d240afef62880" + } + Frame { + msec: 304 + hash: "a1a226c73fb97d5302ce683f901ee5c4" + } + Frame { + msec: 320 + hash: "05578552476372fc58e463e84a147ddd" + } + Frame { + msec: 336 + hash: "0a3e0a651f9eb3e6a44a55a6786e60ff" + } + Frame { + msec: 352 + hash: "4ca362f079f96a01360ee8062fbb8238" + } + Frame { + msec: 368 + hash: "ba512c117d97ce16ff92d03ce2b08056" + } + Frame { + msec: 384 + hash: "8688355f0f97afe000d02f71c841d5dc" + } + Frame { + msec: 400 + hash: "a2ea6ad008da95a67d3bc70e11e3811d" + } + Frame { + msec: 416 + hash: "83bc9c444ab8618438dc2b8b14716f7b" + } + Frame { + msec: 432 + hash: "fafbba34fc8f9d33b559e6fcd0c5f1c6" + } + Frame { + msec: 448 + hash: "92d245951b759f74182602a7a337cb0f" + } + Frame { + msec: 464 + hash: "e0634d25088a6855df8d86d84fe37cd7" + } + Frame { + msec: 480 + hash: "7f4d05f4c3b1a365732e448f2c751740" + } + Frame { + msec: 496 + hash: "fcd6f55929f753f77b1617c0984b8690" + } + Frame { + msec: 512 + hash: "7e88f100a7012d739cd3c97c4e7f4b45" + } + Frame { + msec: 528 + hash: "8f9d029b3850ee2f11cdf6630d100682" + } + Frame { + msec: 544 + hash: "b915f712b24f187ee759b3337fb0df7a" + } + Frame { + msec: 560 + hash: "eae400a0c72d38156f7ae0f16ab9ee66" + } + Frame { + msec: 576 + hash: "e913a1e317cca355b06a393f44cc0243" + } + Frame { + msec: 592 + hash: "abf075ea63a6f5cce43c38e20dbcdbb2" + } + Frame { + msec: 608 + hash: "a6e85caa1eb933343a4605bc434e2841" + } + Frame { + msec: 624 + hash: "8e33e2582dd127d3f04017bf493b0ac6" + } + Frame { + msec: 640 + hash: "959e4062262bcc759abfc7b0bf3e10b6" + } + Frame { + msec: 656 + hash: "9529e2241df0d90ea640fdb3752b0837" + } + Frame { + msec: 672 + hash: "5595b64495996ce66b5f6892e9457456" + } + Frame { + msec: 688 + hash: "532259c3577553622093eba907ae82d3" + } + Frame { + msec: 704 + hash: "85c4332100b6f5256702b594c83f4eff" + } + Frame { + msec: 720 + hash: "b96292d85b12fa8e68c5de3deb29b980" + } + Frame { + msec: 736 + hash: "64febec9c8b58e2b93249f19c57b7aba" + } + Frame { + msec: 752 + hash: "88e588af29131cf942e02b1080e564e5" + } + Frame { + msec: 768 + hash: "07f911478be2f36d0c1b9cb878f4fe47" + } + Frame { + msec: 784 + hash: "8ffbf2381efefcbca413f6e3455018fb" + } + Frame { + msec: 800 + hash: "6e456af680e40799d3f38bdde29a85f9" + } + Frame { + msec: 816 + hash: "48a8dbc64d7823164c992f55b270115d" + } + Frame { + msec: 832 + hash: "a6d28eb1d0aafd387e35ca7b362bec53" + } + Frame { + msec: 848 + hash: "2e9f2b2ebf1b24f01fc986ded320d7c9" + } + Frame { + msec: 864 + hash: "d0cafd9be3263193c207c39eeb051bb8" + } + Frame { + msec: 880 + hash: "8dee1a5365fa3ccd7036c8afa6a805cc" + } + Frame { + msec: 896 + hash: "42f893afb80633f0ffb82f1725bb097f" + } + Frame { + msec: 912 + hash: "f466a404940abcd4c8f3180696da1a29" + } + Frame { + msec: 928 + hash: "e5746e33b3eb155a354bc5900b7593ee" + } + Frame { + msec: 944 + hash: "a1c2eb7048356f4ebc803d9d5439db24" + } + Frame { + msec: 960 + image: "smoothedfollow.0.png" + } + Frame { + msec: 976 + hash: "338aec0e679a8f2e79f6a5503dfbd6c3" + } + Frame { + msec: 992 + hash: "59321f1eb26c379e9e2a37b6890d922d" + } + Frame { + msec: 1008 + hash: "f37a821b9cf9f67fd011c6790a2757f0" + } + Frame { + msec: 1024 + hash: "c3f1b8722c616ecd55d8496e76a9bf06" + } + Frame { + msec: 1040 + hash: "ca6aff9addda2e3ac51e5e2013393365" + } + Frame { + msec: 1056 + hash: "17d1aa7821ce8169a3100a3cd3a0df2b" + } + Frame { + msec: 1072 + hash: "d85dd272f35868d6832316e862db4ec1" + } + Frame { + msec: 1088 + hash: "8bce5bdadfa974655dc7e020ad43edeb" + } + Frame { + msec: 1104 + hash: "b97f71587a5187d5175e5d9f1409c00a" + } + Frame { + msec: 1120 + hash: "53d438e601c25aebfd2ecb0064cdf5cc" + } + Frame { + msec: 1136 + hash: "18c43dd35b3e0d8f9ab5c8de3e48886a" + } + Frame { + msec: 1152 + hash: "e4ab585684d083de118b7862ef5cbd63" + } + Frame { + msec: 1168 + hash: "48ab046a2e2ca1a1225574b94925482e" + } + Frame { + msec: 1184 + hash: "c4bd06a5c329ef6975a60453f588bce7" + } + Frame { + msec: 1200 + hash: "864393a984dce3e9dd2daec56ddb3fe7" + } + Frame { + msec: 1216 + hash: "fcdf4cfcd8a6d8667868ba9633475fe0" + } + Frame { + msec: 1232 + hash: "5ac2b96158045c9b9eb35f1cbabe5b1f" + } + Frame { + msec: 1248 + hash: "83c409e5d3e6fe9e953d9ce14d731b3b" + } + Frame { + msec: 1264 + hash: "01805526b04e17b89238e7b929be48dd" + } + Frame { + msec: 1280 + hash: "4708345219b3732f9aaf8b40645f65d2" + } + Frame { + msec: 1296 + hash: "12716f84b6f648df2cbe08cfea58764c" + } + Frame { + msec: 1312 + hash: "6cce1e6354bd338f364bcca84a5fd081" + } + Frame { + msec: 1328 + hash: "c5da6f6b00402e0de00490792b963cdf" + } + Frame { + msec: 1344 + hash: "0eacadf69c0818e818abaf3aaf823aff" + } + Frame { + msec: 1360 + hash: "c68cd79bf0d329a3c672896b9ce2044d" + } + Frame { + msec: 1376 + hash: "26786f921ddddd9d2f975e1193943d2d" + } + Frame { + msec: 1392 + hash: "68c7c1779bb19ee5cd9370b5c06f4ce7" + } + Frame { + msec: 1408 + hash: "5e87c3e00ef7fab01c17d9e89c661aab" + } + Frame { + msec: 1424 + hash: "0b459122be303c38d3564dd7fea53fc1" + } + Frame { + msec: 1440 + hash: "3b13101a45b470fd04fa02f34548984b" + } + Frame { + msec: 1456 + hash: "6308fa1ed015bb698251af0d1b9be084" + } + Frame { + msec: 1472 + hash: "f219427d8fdf826f33351ba64db55d33" + } + Frame { + msec: 1488 + hash: "0c9ad8c5224d3cdefb8ac793cac3ca79" + } + Frame { + msec: 1504 + hash: "38438307162bceef76afb043c82b6a82" + } + Frame { + msec: 1520 + hash: "78b367e6bab0463fe08f5e634cfbced2" + } + Frame { + msec: 1536 + hash: "81e56f9d3bb9b360a07dc85697a59340" + } + Frame { + msec: 1552 + hash: "cef4fdb8c12485d3590e598090312297" + } + Frame { + msec: 1568 + hash: "8ea0c90a100c583558f92843030543cc" + } + Frame { + msec: 1584 + hash: "0037f0f17a50bdfe3bf0de810ff837f1" + } + Frame { + msec: 1600 + hash: "2b060ac0dfa045b916d3fd5ff6f84bfb" + } + Frame { + msec: 1616 + hash: "b20705dcc6176efd83cff6927991ff0a" + } + Frame { + msec: 1632 + hash: "0af69e490bdc54f27d3e50c1fdfd12a8" + } + Frame { + msec: 1648 + hash: "8e4cceadc01de5b51082889efabcbb7e" + } + Frame { + msec: 1664 + hash: "b64958786a7007686fb1734783d553f5" + } + Frame { + msec: 1680 + hash: "e0b9d98bb3a596fd235d58b6a761a0e0" + } + Frame { + msec: 1696 + hash: "1a5d7dc4dfd3ee86a36978d4effd299c" + } + Frame { + msec: 1712 + hash: "4946561f008635599651bf24b9aa0594" + } + Frame { + msec: 1728 + hash: "8427d33046af64c6e63939238c101e86" + } + Frame { + msec: 1744 + hash: "cdcfab5cea86c33f276c3613d76067c4" + } + Frame { + msec: 1760 + hash: "966005d62bd69b53d77459e5ab65116c" + } + Frame { + msec: 1776 + hash: "8a3c4ff083a973325c4ab09e09027ef6" + } + Frame { + msec: 1792 + hash: "737ffd6f52fa3d812ecaf835a30495af" + } + Frame { + msec: 1808 + hash: "6731007c97ba3ba60e73ab50803868e5" + } + Frame { + msec: 1824 + hash: "caa4ea08c5c330e77a7445cc1adf1666" + } + Frame { + msec: 1840 + hash: "73778bfbae55a81557a128acb4a197c8" + } + Frame { + msec: 1856 + hash: "7d8609f1336ddf4e25b505e54142114e" + } + Frame { + msec: 1872 + hash: "d8b4514d2bd77dbe67e27d400dc1a2f3" + } + Frame { + msec: 1888 + hash: "ac3e7040f1e9fc680f52f46d25eb3faa" + } + Frame { + msec: 1904 + hash: "509c21774f0fca9dde0657133a1cc363" + } + Frame { + msec: 1920 + image: "smoothedfollow.1.png" + } + Frame { + msec: 1936 + hash: "545bcb0c362a083ee698a5c8cd225014" + } + Frame { + msec: 1952 + hash: "77370c9b2880c55fecf07457dd0d455b" + } + Frame { + msec: 1968 + hash: "6c44209f31f5f010f1b3e05490468821" + } + Frame { + msec: 1984 + hash: "2dffac0c44e52f2984525d3d3700e6ed" + } + Frame { + msec: 2000 + hash: "d70f2db1b166b2de3bef74bc4bf94a80" + } + Frame { + msec: 2016 + hash: "50e4f6a82f498066fc9b6588762f59f9" + } + Frame { + msec: 2032 + hash: "956a7d7db9aef1b7abefac1a69622f02" + } + Frame { + msec: 2048 + hash: "13f19d5baefb6c8c9f71c16163663a27" + } + Frame { + msec: 2064 + hash: "076ff84405ddb29a12ed30d27cee558b" + } + Frame { + msec: 2080 + hash: "6af0261639f809da8f7e4831559596d3" + } + Frame { + msec: 2096 + hash: "a0500b18e99bfe3a48d52cc62b4a946b" + } + Frame { + msec: 2112 + hash: "bb0ea576c9136fb70720d4540731d2ca" + } + Frame { + msec: 2128 + hash: "d9b12ad9bf54d7db0ef1b36297a6dd6c" + } + Frame { + msec: 2144 + hash: "2de77e082872f072a849ba9ea93e3aec" + } + Frame { + msec: 2160 + hash: "69e186c3e8e6b2c75da2ca87043129da" + } + Frame { + msec: 2176 + hash: "0c2f23b0cbedb45a68f0cbe6132b4820" + } + Frame { + msec: 2192 + hash: "533bad00e5624611ea8a15d5fa98f0f2" + } + Frame { + msec: 2208 + hash: "d9c60bc821205aa4ea38d846e5b00f3a" + } + Frame { + msec: 2224 + hash: "d4de041edf15c6b6806d7f5992146711" + } + Frame { + msec: 2240 + hash: "100145df5271efaaee1d619bd50b69fc" + } + Frame { + msec: 2256 + hash: "22905b794fee24f3a25e4944d5505e96" + } + Frame { + msec: 2272 + hash: "aeed7adea08fe6e8b60310082cf87b6c" + } + Frame { + msec: 2288 + hash: "82bf8d40b6ed8aae9d6172eae76d1859" + } + Frame { + msec: 2304 + hash: "b1881778936744db3df0898638e4b0df" + } + Frame { + msec: 2320 + hash: "87195016996f8786a8a2430c54f13494" + } + Frame { + msec: 2336 + hash: "56f99b14320662b90eb10e77845bba30" + } + Frame { + msec: 2352 + hash: "69a84022d8d2b3cdb1d7eae6ce5ccef2" + } + Frame { + msec: 2368 + hash: "578ca8c66da6aa64392b253ab6cccbc0" + } + Frame { + msec: 2384 + hash: "4c2058e4708001f82f3bcb8110d6a54f" + } + Frame { + msec: 2400 + hash: "a838be752168bc6feb3151327147bb23" + } + Frame { + msec: 2416 + hash: "bf6cde06f0ee814cd4a23f3d43e7d270" + } + Frame { + msec: 2432 + hash: "9162ec43bc84261c0eb9ea2425da0b8a" + } + Frame { + msec: 2448 + hash: "7be19df0ee54f9bb31ebee2d786addc8" + } + Frame { + msec: 2464 + hash: "542a4c004f5b1b8efa7588b27cc2ba43" + } + Frame { + msec: 2480 + hash: "f9e2edd343be212a9679f1e2ad0e73b3" + } + Frame { + msec: 2496 + hash: "b6d4e9169fc4446cdbd3a36f485b943b" + } + Frame { + msec: 2512 + hash: "0d3b7a652a94162b71e88ed213559af4" + } + Frame { + msec: 2528 + hash: "9d4a2383a4d43ac94ff0a344f217b22d" + } + Frame { + msec: 2544 + hash: "719d402379c40de5cd6d4c8fa92f5472" + } + Frame { + msec: 2560 + hash: "78fb55f5b9c2033a91e41100229e4465" + } + Frame { + msec: 2576 + hash: "0a9ec91eee6c7c770ce2e414fa881229" + } + Frame { + msec: 2592 + hash: "5d9f81f1becf486a09f086e15a64d1f0" + } + Frame { + msec: 2608 + hash: "0f5e18af1eac31e6993ea2df51a143f0" + } + Frame { + msec: 2624 + hash: "08a292373756b06c3a624b8f3bf06236" + } + Frame { + msec: 2640 + hash: "f3c8101429753ce8f0ee094fe0db98ac" + } + Frame { + msec: 2656 + hash: "1603ad220d68ae0a2f613687533c2ebc" + } + Frame { + msec: 2672 + hash: "e2b8049d18fd36fff0180bd4bc199732" + } + Frame { + msec: 2688 + hash: "d1bfeadaa9046ec5013734938a8f4af1" + } + Frame { + msec: 2704 + hash: "3cb3a0e9dc73e76101288395ffeb2b7b" + } + Frame { + msec: 2720 + hash: "104a10e6bd48dacfedf5c98cf641ae93" + } + Frame { + msec: 2736 + hash: "f04a2985e7c203dd6fce46b60fcb23fc" + } + Frame { + msec: 2752 + hash: "30cb747f4604c208d7dc697d5fe2af6b" + } + Frame { + msec: 2768 + hash: "b9eca6ee8fe29351cadeb9a2caf36fa6" + } + Frame { + msec: 2784 + hash: "7bc56e712d713a00a684e07cf3d09907" + } + Frame { + msec: 2800 + hash: "0d7a5e2ff588b71e77abb72723c763b2" + } + Frame { + msec: 2816 + hash: "0d961843e54cbe5ba76c11bcd634bc39" + } + Frame { + msec: 2832 + hash: "6328b52965a002944c501d9888928caa" + } + Frame { + msec: 2848 + hash: "63e668a7688167b604b641929843d0cf" + } + Frame { + msec: 2864 + hash: "7f5e71332268be68de9dcb25f173d2e0" + } + Frame { + msec: 2880 + image: "smoothedfollow.2.png" + } + Frame { + msec: 2896 + hash: "dc6e83fcc5a403913a94c498f1571098" + } + Frame { + msec: 2912 + hash: "8deb275bd08df9b3abdcf3e2796a0601" + } + Frame { + msec: 2928 + hash: "6c08a25a442b97a8cb359792b6a01641" + } + Frame { + msec: 2944 + hash: "5f7ccd5706c77f0b0ddced41ed6352d8" + } + Frame { + msec: 2960 + hash: "6668d1936524f0fdc490720a962a3698" + } + Frame { + msec: 2976 + hash: "e36f901fb4b8ad754592642a7575e4ee" + } + Frame { + msec: 2992 + hash: "7453182980e458d827f3ff83aa3f2c88" + } + Frame { + msec: 3008 + hash: "0e15d75b2a7f2e4a39906093b930d6a8" + } + Frame { + msec: 3024 + hash: "822ccc6c629eabf38fd5ac56abb638f5" + } + Frame { + msec: 3040 + hash: "331ef5b3e3dd5642f8532d337fd22def" + } + Frame { + msec: 3056 + hash: "3c29aae83f28239f31125ef02f523d02" + } + Frame { + msec: 3072 + hash: "56ed674bf2d345861eb235a4239078e2" + } + Frame { + msec: 3088 + hash: "5412b9ad01a6780b67bc59b80a274cd5" + } + Frame { + msec: 3104 + hash: "a6f9ae09a7386f06a84c251083660dd6" + } + Frame { + msec: 3120 + hash: "83f07277c9bec7419dd6a4d40d8accf7" + } + Frame { + msec: 3136 + hash: "e6cb74961dfef68a32f255176e0ebff3" + } + Frame { + msec: 3152 + hash: "9e6c3ac0190beaf30754155a5d64b81c" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml index 0df727b..63dba47 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml @@ -1,15 +1,15 @@ import Qt 4.7 Rectangle { - width: 800; height: 240; color: "gray" + width: 800; height: 720; color: "gray" Rectangle { id: rect width: 50; height: 20; y: 30; color: "black" SequentialAnimation on x { loops: Animation.Infinite - NumberAnimation { from: 50; to: 700; duration: 2000 } - NumberAnimation { from: 700; to: 50; duration: 2000 } + NumberAnimation { from: 50; to: 700; duration: 1000 } + NumberAnimation { from: 700; to: 50; duration: 1000 } } } @@ -25,16 +25,104 @@ Rectangle { Rectangle { width: 50; height: 20; x: rect.x; y: 120; color: "green" - Behavior on x { SmoothedAnimation { reversingMode: SmoothedAnimation.Sync } } + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } } Rectangle { width: 50; height: 20; x: rect.x; y: 150; color: "purple" - Behavior on x { SmoothedAnimation { maximumEasingTime: 200 } } + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } } Rectangle { width: 50; height: 20; x: rect.x; y: 180; color: "blue" - Behavior on x { SmoothedAnimation { duration: 300 } } + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } + } + + //rect2 has jerky movement, but the rects following it should be smooth + Rectangle { + id: rect2 + property int dir: 1 + width: 50; height: 20; x:50; y: 240; color: "black" + function advance(){ + if(x >= 700) + dir = -1; + if(x <= 50) + dir = 1; + x += 130.0 * dir; + } + } + Timer{ + interval: 200 + running: true + repeat: true + onTriggered: rect2.advance(); + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 270; color: "red" + Behavior on x { SmoothedAnimation { velocity: 400 } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 300; color: "yellow" + Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 330; color: "green" + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 360; color: "purple" + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 390; color: "blue" + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } + } + + //rect3 just jumps , but the rects following it should be smooth + Rectangle { + id: rect3 + width: 50; height: 20; x:50; y: 480; color: "black" + function advance(){ + if(x == 50) + x = 700; + else + x = 50; + } + } + Timer{ + interval: 1000 + running: true + repeat: true + onTriggered: rect3.advance(); + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 510; color: "red" + Behavior on x { SmoothedAnimation { velocity: 400 } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 540; color: "yellow" + Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 570; color: "green" + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 600; color: "purple" + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 630; color: "blue" + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } } } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index ddc3939..667cdd3 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -41,6 +41,7 @@ #include <QtTest/QtTest> +#include <QtTest/qtesttouch.h> #include "../../shared/util.h" #include <qevent.h> @@ -361,6 +362,7 @@ private slots: void partialGesturePropagation(); void testQGestureRecognizerCleanup(); void testReuseCanceledGestures(); + void bug_13501_gesture_not_accepted(); }; tst_Gestures::tst_Gestures() @@ -2306,5 +2308,29 @@ void tst_Gestures::conflictingGesturesInGraphicsView() QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); } +class NoConsumeWidgetBug13501 :public QWidget +{ + Q_OBJECT +protected: + bool event(QEvent *e) { + if(e->type() == QEvent::Gesture) { + return false; + } + return QWidget::event(e); + } +}; + +void tst_Gestures::bug_13501_gesture_not_accepted() +{ + // Create a gesture event that is not accepted by any widget + // make sure this does not lead to an assert in QGestureManager + NoConsumeWidgetBug13501 w; + w.grabGesture(Qt::TapGesture); + w.show(); + QTest::qWaitForWindowShown(&w); + //QTest::mousePress(&ignoreEvent, Qt::LeftButton); + QTest::touchEvent(&w).press(0, QPoint(10, 10), &w); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp index f58f932..706e8d0 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/main.cpp @@ -302,3 +302,44 @@ static inline QString message2() } } + + + +// QTBUG-11426: operator overloads +class LotsaFun : public QObject +{ + Q_OBJECT +public: + int operator<<(int left, int right); +}; + +int LotsaFun::operator<<(int left, int right) +{ + tr("this is inside operator<<"); + return left << right; +} + + + +// QTBUG-12683: define in re-opened namespace +namespace NameSchpace { + +class YetMoreFun : public QObject +{ + Q_OBJECT +public: + void funStuff(); +}; + +} + +namespace NameSchpace { + +#define somevar 1 + +void YetMoreFun::funStuff() +{ + tr("funStuff!"); +} + +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result index 7ac318e..f73fc64 100644 --- a/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/parsecpp/project.ts.result @@ -141,6 +141,22 @@ backslashed \ stuff.</source> </message> </context> <context> + <name>LotsaFun</name> + <message> + <location filename="main.cpp" line="318"/> + <source>this is inside operator<<</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>NameSchpace::YetMoreFun</name> + <message> + <location filename="main.cpp" line="342"/> + <source>funStuff!</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> <name>Plurals, QCoreApplication</name> <message numerus="yes"> <location filename="main.cpp" line="81"/> diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index f9c3ccb..bb23f49 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -1077,10 +1077,10 @@ void tst_Moc::qprivateslots() class PrivatePropertyTest : public QObject { Q_OBJECT - Q_PROPERTY(int foo READ foo WRITE setFoo); - Q_PRIVATE_PROPERTY(d, int bar READ bar WRITE setBar); - Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int plop READ plop WRITE setPlop); - Q_PRIVATE_PROPERTY(PrivatePropertyTest::d_func(), int baz READ baz WRITE setBaz); + Q_PROPERTY(int foo READ foo WRITE setFoo) + Q_PRIVATE_PROPERTY(d, int bar READ bar WRITE setBar) + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int plop READ plop WRITE setPlop) + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d_func(), int baz READ baz WRITE setBaz) class MyDPointer { public: MyDPointer() : mBar(0), mPlop(0) {} diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp index 90bf806..93de251 100644 --- a/tests/auto/q3table/tst_q3table.cpp +++ b/tests/auto/q3table/tst_q3table.cpp @@ -502,7 +502,7 @@ void tst_Q3Table::pageUpDownNavigation() void tst_Q3Table::simpleKeyboardNavigation() { QApplication::setActiveWindow(testWidget); - QTRY_COMPARE(QApplication::activeWindow(), testWidget); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(testWidget)); QWidget *w; // Test for task #24726 @@ -1208,7 +1208,7 @@ void tst_Q3Table::editCheck() table.show(); QApplication::setActiveWindow(&table); QTest::qWaitForWindowShown(&table); - QTRY_COMPARE(QApplication::activeWindow(), &table); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&table)); table.setCurrentCell(0, 0); #ifdef WAITS QTest::qWait(50); @@ -1345,7 +1345,7 @@ void tst_Q3Table::valueChanged() testWidget->show(); QApplication::setActiveWindow(testWidget); QTest::qWaitForWindowShown(testWidget); - QTRY_COMPARE(QApplication::activeWindow(), testWidget); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(testWidget)); #ifdef WAITS QTest::qWait(50); #endif @@ -1395,7 +1395,7 @@ void tst_Q3Table::dateTimeEdit() testWidget->show(); QApplication::setActiveWindow(testWidget); QTest::qWaitForWindowShown(testWidget); - QTRY_COMPARE(QApplication::activeWindow(), testWidget); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(testWidget)); #ifdef WAITS QTest::qWait(50); #endif diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp index 6f158f0..dbcccc9 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -1208,6 +1208,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent() QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QPersistentModelIndex persistentSource = sourceIndex; ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); moveCommand->setAncestorRowNumbers(QList<int>() << 5); @@ -1228,7 +1229,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent() QCOMPARE(beforeSignal.at(4).toInt(), destRow); QCOMPARE(afterSignal.size(), 5); - QCOMPARE(afterSignal.at(0).value<QModelIndex>(), sourceIndex); + QCOMPARE(afterSignal.at(0).value<QModelIndex>(), static_cast<QModelIndex>(persistentSource)); QCOMPARE(afterSignal.at(1).toInt(), startRow); QCOMPARE(afterSignal.at(2).toInt(), endRow); QCOMPARE(afterSignal.at(3).value<QModelIndex>(), QModelIndex()); @@ -1351,6 +1352,7 @@ void tst_QAbstractItemModel::testMoveToSibling() QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QPersistentModelIndex persistentDest = destIndex; ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); moveCommand->setNumCols(4); @@ -1374,7 +1376,7 @@ void tst_QAbstractItemModel::testMoveToSibling() QCOMPARE(afterSignal.at(0).value<QModelIndex>(), sourceIndex); QCOMPARE(afterSignal.at(1).toInt(), startRow); QCOMPARE(afterSignal.at(2).toInt(), endRow); - QCOMPARE(afterSignal.at(3).value<QModelIndex>(), destIndex); + QCOMPARE(afterSignal.at(3).value<QModelIndex>(), static_cast<QModelIndex>(persistentDest)); QCOMPARE(afterSignal.at(4).toInt(), destRow); for (int i = 0; i < indexList.size(); i++) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index a62720b..1590528 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1324,7 +1324,7 @@ void tst_QCompleter::task253125_lineEditCompletion() #endif QTest::qWait(10); QApplication::setActiveWindow(&edit); - QTRY_COMPARE(QApplication::activeWindow(), &edit); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&edit)); QTest::keyClick(&edit, 'i'); QCOMPARE(edit.completer()->currentCompletion(), QString("iota")); @@ -1362,7 +1362,7 @@ void tst_QCompleter::task247560_keyboardNavigation() QTest::qWait(10); QApplication::setActiveWindow(&edit); - QTRY_COMPARE(QApplication::activeWindow(), &edit); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&edit)); QTest::keyClick(&edit, 'r'); QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index c8c835f..fb83a5a 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -167,6 +167,8 @@ private slots: void longFileName(); void updateFileLists(); + + void detachingOperations(); }; // Testing get/set functions @@ -1541,6 +1543,103 @@ void tst_QDir::updateFileLists() QCOMPARE(dir.entryList(), QStringList() << "sub-dir1" << "sub-dir2" << "file1.txt"); } +void tst_QDir::detachingOperations() +{ + QString const defaultPath("."); + QStringList const defaultNameFilters = QStringList("*"); + QDir::SortFlags const defaultSorting = QDir::Name | QDir::IgnoreCase; + QDir::Filters const defaultFilter = QDir::AllEntries; + + QString const path1(".."); + QString const path2("./foo"); + QStringList const nameFilters = QStringList(QString("*.txt")); + QDir::SortFlags const sorting = QDir::Name | QDir::DirsLast | QDir::Reversed; + QDir::Filters const filter = QDir::Writable; + + QDir dir1; + + QCOMPARE(dir1.path(), defaultPath); + QCOMPARE(dir1.filter(), defaultFilter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setPath(path1); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), defaultFilter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setFilter(filter); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setNameFilters(nameFilters); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setSorting(sorting); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + dir1.setPath(path2); + QCOMPARE(dir1.path(), path2); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + { + QDir dir2(dir1); + QCOMPARE(dir2.path(), path2); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + } + + { + QDir dir2; + QCOMPARE(dir2.path(), defaultPath); + QCOMPARE(dir2.filter(), defaultFilter); + QCOMPARE(dir2.nameFilters(), defaultNameFilters); + QCOMPARE(dir2.sorting(), defaultSorting); + + dir2 = dir1; + QCOMPARE(dir2.path(), path2); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + + dir2 = path1; + QCOMPARE(dir2.path(), path1); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + } + + dir1.refresh(); + QCOMPARE(dir1.path(), path2); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + QString const currentPath = QDir::currentPath(); + QVERIFY(dir1.cd(currentPath)); + QCOMPARE(dir1.path(), currentPath); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + QVERIFY(dir1.cdUp()); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); +} + QTEST_MAIN(tst_QDir) #include "tst_qdir.moc" diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp index 124f900..2411ab6 100644 --- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp @@ -153,19 +153,19 @@ void tst_QEasingCurve::propertyDefaults() QEasingCurve curve(QEasingCurve::InElastic); QCOMPARE(curve.period(), 0.3); QCOMPARE(curve.amplitude(), 1.0); - QCOMPARE(curve.overshoot(), qreal(1.70158f)); + QCOMPARE(curve.overshoot(), qreal(1.70158)); curve.setType(QEasingCurve::InBounce); QCOMPARE(curve.period(), 0.3); QCOMPARE(curve.amplitude(), 1.0); - QCOMPARE(curve.overshoot(), qreal(1.70158f)); + QCOMPARE(curve.overshoot(), qreal(1.70158)); curve.setType(QEasingCurve::Linear); QCOMPARE(curve.period(), 0.3); QCOMPARE(curve.amplitude(), 1.0); - QCOMPARE(curve.overshoot(), qreal(1.70158f)); + QCOMPARE(curve.overshoot(), qreal(1.70158)); curve.setType(QEasingCurve::InElastic); QCOMPARE(curve.period(), 0.3); QCOMPARE(curve.amplitude(), 1.0); - QCOMPARE(curve.overshoot(), qreal(1.70158f)); + QCOMPARE(curve.overshoot(), qreal(1.70158)); curve.setPeriod(0.4); curve.setAmplitude(0.6); curve.setOvershoot(1.0); @@ -490,7 +490,7 @@ void tst_QEasingCurve::operators() // operator== curve.setType(QEasingCurve::InBack); curve2 = curve; - curve2.setOvershoot(qreal(1.70158f)); + curve2.setOvershoot(qreal(1.70158)); QCOMPARE(curve.overshoot(), curve2.overshoot()); QVERIFY(curve2 == curve); @@ -505,6 +505,15 @@ void tst_QEasingCurve::operators() curve2.setType(QEasingCurve::InBack); QCOMPARE(curve.overshoot(), curve2.overshoot()); QVERIFY(curve2 == curve); + + QEasingCurve curve3; + QEasingCurve curve4; + curve4.setAmplitude(curve4.amplitude()); + QEasingCurve curve5; + curve5.setAmplitude(0.12345); + QVERIFY(curve3 == curve4); // default value and not assigned + QVERIFY(curve3 != curve5); // unassinged and other value + QVERIFY(curve4 != curve5); } class tst_QEasingProperties : public QObject @@ -527,7 +536,7 @@ void tst_QEasingCurve::properties() tst_QEasingProperties obj; QEasingCurve inOutBack(QEasingCurve::InOutBack); - qreal overshoot = 1.5f; + qreal overshoot = 1.5; inOutBack.setOvershoot(overshoot); qreal amplitude = inOutBack.amplitude(); qreal period = inOutBack.period(); diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index 93b1891..208110a 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -172,6 +172,8 @@ private slots: void equalOperator() const; void equalOperatorWithDifferentSlashes() const; void notEqualOperator() const; + + void detachingOperations(); }; tst_QFileInfo::tst_QFileInfo() @@ -228,13 +230,13 @@ void tst_QFileInfo::copy() QFileInfo info2(info); QFileInfoPrivate *privateInfo = getPrivate(info); QFileInfoPrivate *privateInfo2 = getPrivate(info2); - QCOMPARE(privateInfo->data, privateInfo2->data); + QCOMPARE(privateInfo, privateInfo2); //operator = QFileInfo info3 = info; QFileInfoPrivate *privateInfo3 = getPrivate(info3); - QCOMPARE(privateInfo->data, privateInfo3->data); - QCOMPARE(privateInfo2->data, privateInfo3->data); + QCOMPARE(privateInfo, privateInfo3); + QCOMPARE(privateInfo2, privateInfo3); //refreshing info3 will detach it QFile file(info.absoluteFilePath()); @@ -256,9 +258,10 @@ void tst_QFileInfo::copy() QTest::qWait(5000); #endif info3.refresh(); - QVERIFY(privateInfo->data != privateInfo3->data); - QVERIFY(privateInfo2->data != privateInfo3->data); - QCOMPARE(privateInfo->data, privateInfo2->data); + privateInfo3 = getPrivate(info3); + QVERIFY(privateInfo != privateInfo3); + QVERIFY(privateInfo2 != privateInfo3); + QCOMPARE(privateInfo, privateInfo2); } void tst_QFileInfo::isFile_data() @@ -1182,8 +1185,8 @@ void tst_QFileInfo::isLocalFs() QFileInfo info(path); QFileInfoPrivate *privateInfo = getPrivate(info); - QVERIFY(privateInfo->data->fileEngine); - QCOMPARE(bool(privateInfo->data->fileEngine->fileFlags(QAbstractFileEngine::LocalDiskFlag) + QVERIFY(privateInfo->fileEngine); + QCOMPARE(bool(privateInfo->fileEngine->fileFlags(QAbstractFileEngine::LocalDiskFlag) & QAbstractFileEngine::LocalDiskFlag), isLocalFs); } @@ -1376,5 +1379,51 @@ void tst_QFileInfo::notEqualOperator() const QVERIFY(QFileInfo() != QFileInfo()); } +void tst_QFileInfo::detachingOperations() +{ + QFileInfo info1; + QVERIFY(info1.caching()); + info1.setCaching(false); + + { + QFileInfo info2 = info1; + + QVERIFY(!info1.caching()); + QVERIFY(!info2.caching()); + + info2.setCaching(true); + QVERIFY(info2.caching()); + + info1.setFile("foo"); + QVERIFY(!info1.caching()); + } + + { + QFile file("foo"); + info1.setFile(file); + QVERIFY(!info1.caching()); + } + + info1.setFile(QDir(), "foo"); + QVERIFY(!info1.caching()); + + { + QFileInfo info3; + QVERIFY(info3.caching()); + + info3 = info1; + QVERIFY(!info3.caching()); + } + + info1.refresh(); + QVERIFY(!info1.caching()); + + QVERIFY(info1.makeAbsolute()); + QVERIFY(!info1.caching()); + + info1.detach(); + QVERIFY(!info1.caching()); +} + QTEST_MAIN(tst_QFileInfo) #include "tst_qfileinfo.moc" diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index fa6a5ec..e1bfb79 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -76,6 +76,7 @@ private slots: void dropShadowClipping(); void childrenVisibilityShouldInvalidateCache(); void prepareGeometryChangeInvalidateCache(); + void itemHasNoContents(); }; void tst_QGraphicsEffect::initTestCase() @@ -675,6 +676,34 @@ void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache() QCOMPARE(item->nbPaint, 0); } +void tst_QGraphicsEffect::itemHasNoContents() +{ + QGraphicsRectItem *parent = new QGraphicsRectItem; + parent->setFlag(QGraphicsItem::ItemHasNoContents); + + MyGraphicsItem *child = new MyGraphicsItem; + child->setParentItem(parent); + child->resize(200, 200); + + QGraphicsScene scene; + scene.addItem(parent); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(child->nbPaint, 1); + + CustomEffect *effect = new CustomEffect; + parent->setGraphicsEffect(effect); + QTRY_COMPARE(effect->numRepaints, 1); + + for (int i = 0; i < 3; ++i) { + effect->reset(); + effect->update(); + QTRY_COMPARE(effect->numRepaints, 1); + } +} + QTEST_MAIN(tst_QGraphicsEffect) #include "tst_qgraphicseffect.moc" diff --git a/tests/auto/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp b/tests/auto/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp index 879e12b..dbffa6e 100644 --- a/tests/auto/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp +++ b/tests/auto/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp @@ -75,6 +75,7 @@ private slots: void setPreferredSize_data(); void setPreferredSize(); void setSizePolicy_data(); + void setPreferredSize2(); void setSizePolicy(); }; @@ -343,6 +344,13 @@ void tst_QGraphicsLayoutItem::setPreferredSize() } } +void tst_QGraphicsLayoutItem::setPreferredSize2() +{ + SubQGraphicsLayoutItem layoutItem; + layoutItem.setPreferredSize(QSizeF(30, -1)); + QCOMPARE(layoutItem.preferredWidth(), qreal(30)); +} + void tst_QGraphicsLayoutItem::setSizePolicy_data() { QTest::addColumn<QSizePolicy>("policy"); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index c145623..b8e729e 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -287,6 +287,7 @@ private slots: void taskQTBUG_5904_crashWithDeviceCoordinateCache(); void taskQT657_paintIntoCacheWithTransparentParts(); void taskQTBUG_7863_paintIntoCacheWithTransparentParts(); + void taskQT_3674_doNotCrash(); }; void tst_QGraphicsScene::initTestCase() @@ -4565,6 +4566,25 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() } } +void tst_QGraphicsScene::taskQT_3674_doNotCrash() +{ + QGraphicsScene scene; + + QGraphicsView view(&scene); + view.resize(200, 200); + + QPixmap pixmap(view.size()); + QPainter painter(&pixmap); + view.render(&painter); + painter.end(); + + scene.addItem(new QGraphicsWidget); + scene.setBackgroundBrush(Qt::green); + + QApplication::processEvents(); + QApplication::processEvents(); +} + void tst_QGraphicsScene::zeroScale() { //should not crash diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index ec0ecec..b446941 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -156,14 +156,14 @@ void tst_QImage::create() { bool cr = true; #if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) - try { + QT_TRY { #endif //QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian); QImage image(7000000, 7000000, QImage::Format_Indexed8); image.setColorCount(256); cr = !image.isNull(); #if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) - } catch (...) { + } QT_CATCH (...) { } #endif QVERIFY( !cr ); diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 52e655b..d077bc1 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -884,6 +884,27 @@ void tst_QInputContext::symbianTestCoeFepInputContext_data() << QString("44") << QString(""); events.clear(); + + // Test that the symbol key successfully does nothing when in number-only mode. + events << FepReplayEvent(EEventKeyDown, EStdKeyLeftFunc, 0, 0, 0); + events << FepReplayEvent(EEventKeyUp, EStdKeyLeftFunc, 0, 0, 0); + QTest::newRow("Dead symbols key") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Normal + << events + << QString("") + << QString(""); + QTest::newRow("Dead symbols key and password") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Password + << events + << QString("") + << QString(""); + events.clear(); #endif } diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 717b32d..93bd447 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -275,6 +275,7 @@ private slots: #endif void taskQTBUG_7395_readOnlyShortcut(); void QTBUG697_paletteCurrentColorGroup(); + void QTBUG13520_textNotVisible(); #ifdef QT3_SUPPORT void validateAndSet_data(); @@ -3034,6 +3035,8 @@ public: }; State state; + + friend class tst_QLineEdit; }; Q_DECLARE_METATYPE(LineEdit::State); @@ -3741,5 +3744,21 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::red).rgb()); } +void tst_QLineEdit::QTBUG13520_textNotVisible() +{ + LineEdit le; + le.setAlignment( Qt::AlignRight | Qt::AlignVCenter); + le.show(); + QTest::qWaitForWindowShown(&le); + le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg"); + le.setCursorPosition(0); + QTest::qWait(100); //just make sure we get he lineedit correcly painted + + QVERIFY(le.cursorRect().center().x() < le.width() / 2); + + +} + + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index 1273e85..5a69d9c 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -1449,8 +1449,7 @@ Q_DECLARE_METATYPE(MoveList) void MoveSeparator::apply(QMainWindow *mw) const { - - QMainWindowLayout *l = qobject_cast<QMainWindowLayout*>(mw->layout()); + QMainWindowLayout *l = qFindChild<QMainWindowLayout *>(mw); QVERIFY(l); QList<int> path; diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index 08b7c19..5f6262e 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -3243,16 +3243,16 @@ void tst_QObject::overloads() QCOMPARE(obj2.s_num, 101); emit obj1.sig(&obj2, &obj3); //this signal is connected QCOMPARE(obj1.s_num, 11); - QCOMPARE(obj1.o1_obj, &obj2); + QCOMPARE(obj1.o1_obj, (QObject *)&obj2); QCOMPARE(obj1.o2_obj, &obj3); QCOMPARE(obj1.o3_obj, (QObject *)0); //default arg of the signal - QCOMPARE(obj1.o4_obj, qApp); //default arg of the slot + QCOMPARE(obj1.o4_obj, (QObject *)qApp); //default arg of the slot QCOMPARE(obj2.s_num, 111); - QCOMPARE(obj2.o1_obj, &obj2); + QCOMPARE(obj2.o1_obj, (QObject *)&obj2); QCOMPARE(obj2.o2_obj, &obj3); QCOMPARE(obj2.o3_obj, (QObject *)0); //default arg of the signal - QCOMPARE(obj2.o4_obj, qApp); //default arg of the slot + QCOMPARE(obj2.o4_obj, (QObject *)qApp); //default arg of the slot } class ManySignals : public QObject diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 4cff043..f96aea6 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -174,6 +174,10 @@ private slots: void reentrency(); void newFixedStaticScopeObject(); void newGrowingStaticScopeObject(); + void dateRoundtripJSQtJS(); + void dateRoundtripQtJSQt(); + void dateConversionJSQt(); + void dateConversionQtJS(); }; tst_QScriptEngine::tst_QScriptEngine() @@ -5037,6 +5041,68 @@ void tst_QScriptEngine::qRegExpInport() } } +// QScriptValue::toDateTime() returns a local time, whereas JS dates +// are always stored as UTC. QtScript must respect the current time +// zone, and correctly adjust for daylight saving time that may be in +// effect at a given date (QTBUG-9770). +void tst_QScriptEngine::dateRoundtripJSQtJS() +{ + uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t(); + QScriptEngine eng; + for (int i = 0; i < 8000; ++i) { + QScriptValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0)); + QDateTime qtDate = jsDate.toDateTime(); + QScriptValue jsDate2 = eng.newDate(qtDate); + if (jsDate2.toNumber() != jsDate.toNumber()) + QFAIL(qPrintable(jsDate.toString())); + secs += 2*60*60; + } +} + +void tst_QScriptEngine::dateRoundtripQtJSQt() +{ + QDateTime qtDate = QDateTime(QDate(2009, 1, 1)); + QScriptEngine eng; + for (int i = 0; i < 8000; ++i) { + QScriptValue jsDate = eng.newDate(qtDate); + QDateTime qtDate2 = jsDate.toDateTime(); + if (qtDate2 != qtDate) + QFAIL(qPrintable(qtDate.toString())); + qtDate = qtDate.addSecs(2*60*60); + } +} + +void tst_QScriptEngine::dateConversionJSQt() +{ + uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t(); + QScriptEngine eng; + for (int i = 0; i < 8000; ++i) { + QScriptValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0)); + QDateTime qtDate = jsDate.toDateTime(); + QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); + QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString(); + jsUTCDateStr.chop(5); // get rid of milliseconds (".000Z") + if (qtUTCDateStr != jsUTCDateStr) + QFAIL(qPrintable(jsDate.toString())); + secs += 2*60*60; + } +} + +void tst_QScriptEngine::dateConversionQtJS() +{ + QDateTime qtDate = QDateTime(QDate(2009, 1, 1)); + QScriptEngine eng; + for (int i = 0; i < 8000; ++i) { + QScriptValue jsDate = eng.newDate(qtDate); + QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString(); + jsUTCDateStr.chop(5); // get rid of milliseconds (".000Z") + QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); + if (jsUTCDateStr != qtUTCDateStr) + QFAIL(qPrintable(qtDate.toString())); + qtDate = qtDate.addSecs(2*60*60); + } +} + static QScriptValue createAnotherEngine(QScriptContext *, QScriptEngine *) { QScriptEngine eng; diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index e154528..e16be8b 100644 --- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -381,7 +381,7 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() QCOMPARE(a1_s_o2->currentLoopTime(), 250); QCOMPARE(notTimeDriven->currentLoopTime(), 0); QCOMPARE(loopsForever->currentLoopTime(), 0); - QCOMPARE(group.currentAnimation(), notTimeDriven); + QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation *>(notTimeDriven)); // Current time = 505 group.setCurrentTime(505); @@ -391,7 +391,7 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation() QCOMPARE(a1_s_o2->currentLoopTime(), 250); QCOMPARE(notTimeDriven->currentLoopTime(), 5); QCOMPARE(loopsForever->currentLoopTime(), 0); - QCOMPARE(group.currentAnimation(), notTimeDriven); + QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation *>(notTimeDriven)); QCOMPARE(sequence->state(), QAnimationGroup::Stopped); QCOMPARE(a1_s_o1->state(), QAnimationGroup::Stopped); QCOMPARE(a1_s_o2->state(), QAnimationGroup::Stopped); diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp index 058a750..0395eff 100644 --- a/tests/auto/qsettings/tst_qsettings.cpp +++ b/tests/auto/qsettings/tst_qsettings.cpp @@ -60,6 +60,10 @@ #include <io.h> #endif +#if defined(Q_OS_WIN) +#include <QtCore/qt_windows.h> +#endif + #ifndef QSETTINGS_P_H_VERSION #define QSETTINGS_P_H_VERSION 1 #endif @@ -127,6 +131,9 @@ private slots: #if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN) void dontReorderIniKeysNeedlessly(); #endif +#if defined(Q_OS_WIN) + void qtbug_13249(); +#endif /* These tests were developed for the Qt 3 QSettings class. @@ -3801,6 +3808,62 @@ void tst_QSettings::setPathBug() } #endif +#if defined(Q_OS_WIN) + +static DWORD readKeyType(HKEY handle, const QString &rSubKey) +{ + DWORD dataType; + DWORD dataSize; + LONG res = RegQueryValueEx(handle, reinterpret_cast<const wchar_t *>(rSubKey.utf16()), 0, &dataType, 0, &dataSize); + + if (res == ERROR_SUCCESS) + return dataType; + + return 0; +} + +void tst_QSettings::qtbug_13249() +{ + QSettings settings1(QSettings::UserScope, "software.org", "KillerAPP"); + + qint32 x = 1024; + settings1.setValue("qtbug_13249_a", (qint32)x); + QCOMPARE(settings1.value("qtbug_13249_a").toInt(), (qint32)1024); + settings1.setValue("qtbug_13249_b", (quint32)x); + QCOMPARE(settings1.value("qtbug_13249_b").toUInt(), (quint32)1024); + settings1.setValue("qtbug_13249_c", (qint64)x); + QCOMPARE(settings1.value("qtbug_13249_c").toLongLong(), (qint64)1024); + settings1.setValue("qtbug_13249_d", (quint64)x); + QCOMPARE(settings1.value("qtbug_13249_d").toULongLong(), (quint64)1024); + settings1.sync(); + + HKEY handle; + LONG res; + QString keyName = "Software\\software.org\\KillerAPP"; + res = RegOpenKeyEx(HKEY_CURRENT_USER, reinterpret_cast<const wchar_t *>(keyName.utf16()), 0, KEY_READ, &handle); + if (res == ERROR_SUCCESS) + { + DWORD dataType; + dataType = readKeyType(handle, QString("qtbug_13249_a")); + if (dataType != 0) { + QCOMPARE((int)REG_DWORD, (int)dataType); + } + dataType = readKeyType(handle, QString("qtbug_13249_b")); + if (dataType != 0) { + QCOMPARE((int)REG_DWORD, (int)dataType); + } + dataType = readKeyType(handle, QString("qtbug_13249_c")); + if (dataType != 0) { + QCOMPARE((int)REG_QWORD, (int)dataType); + } + dataType = readKeyType(handle, QString("qtbug_13249_d")); + if (dataType != 0) { + QCOMPARE((int)REG_QWORD, (int)dataType); + } + RegCloseKey(handle); + } +} +#endif /* // Not tested at the moment. void tst_QSettings::oldSubkeyList() diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 53fefee..66caf4a 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -143,6 +143,7 @@ private slots: void taskQTBUG_10287_unnecessaryMapCreation(); void testMultipleProxiesWithSelection(); + void mapSelectionFromSource(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -3075,6 +3076,44 @@ void tst_QSortFilterProxyModel::testMultipleProxiesWithSelection() } +static bool isValid(const QItemSelection &selection) { + foreach(const QItemSelectionRange &range, selection) + if (!range.isValid()) + return false; + return true; +} + +void tst_QSortFilterProxyModel::mapSelectionFromSource() +{ + QStringListModel model; + const QStringList initial = QString("bravo charlie delta echo").split(" "); + model.setStringList(initial); + + QSortFilterProxyModel proxy; + proxy.setDynamicSortFilter(true); + proxy.setFilterRegExp("d.*"); + proxy.setSourceModel(&model); + + // Only "delta" remains. + QVERIFY(proxy.rowCount() == 1); + + QItemSelection selection; + QModelIndex charlie = model.index(1, 0); + selection.append(QItemSelectionRange(charlie, charlie)); + QModelIndex delta = model.index(2, 0); + selection.append(QItemSelectionRange(delta, delta)); + QModelIndex echo = model.index(3, 0); + selection.append(QItemSelectionRange(echo, echo)); + + QVERIFY(isValid(selection)); + + QItemSelection proxiedSelection = proxy.mapSelectionFromSource(selection); + + // Only "delta" is in the mapped result. + QVERIFY(proxiedSelection.size() == 1); + QVERIFY(isValid(proxiedSelection)); +} + class Model10287 : public QStandardItemModel { Q_OBJECT diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 2a60e9e..68c3ea9 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -91,6 +91,8 @@ private slots: void drawStruckOutText(); void drawOverlinedText(); void drawUnderlinedText(); + + void unprintableCharacter_qtbug12614(); }; void tst_QStaticText::init() @@ -753,5 +755,14 @@ void tst_QStaticText::drawUnderlinedText() QCOMPARE(imageDrawText, imageDrawStaticText); } +void tst_QStaticText::unprintableCharacter_qtbug12614() +{ + QString s(QChar(0x200B)); // U+200B, ZERO WIDTH SPACE + + QStaticText staticText(s); + + QVERIFY(staticText.size().isValid()); // Force layout. Should not crash. +} + QTEST_MAIN(tst_QStaticText) #include "tst_qstatictext.moc" diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index b651187..73b3452 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -87,6 +87,8 @@ private slots: void cancelLongTimer(); void singleShotStaticFunctionZeroTimeout(); void recurseOnTimeoutAndStopTimer(); + + void QTBUG13633_dontBlockEvents(); }; class TimerHelper : public QObject @@ -269,13 +271,7 @@ void tst_QTimer::livelock() QCOMPARE(tester.timeoutsForFirst, 1); QCOMPARE(tester.timeoutsForExtra, 0); QCOMPARE(tester.timeoutsForSecond, 1); -#if defined(Q_OS_MAC) - QEXPECT_FAIL("zero timer", "Posted events source are handled AFTER timers", Continue); - QEXPECT_FAIL("non-zero timer", "Posted events source are handled AFTER timers", Continue); -#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) && !defined(Q_OS_WINCE) +#if 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) @@ -668,5 +664,64 @@ void tst_QTimer::recurseOnTimeoutAndStopTimer() QVERIFY(!t.two->isActive()); } + + +class DontBlockEvents : public QObject +{ + Q_OBJECT +public: + DontBlockEvents(); + void timerEvent(QTimerEvent*); + + int count; + int total; + QBasicTimer m_timer; + +public slots: + void paintEvent(); + +}; + +DontBlockEvents::DontBlockEvents() +{ + count = 0; + total = 0; + + //QTBUG-13633 need few unrelated timer running to reproduce the bug. + (new QTimer(this))->start(2000); + (new QTimer(this))->start(2500); + (new QTimer(this))->start(3000); + (new QTimer(this))->start(5000); + (new QTimer(this))->start(1000); + (new QTimer(this))->start(2000); + + m_timer.start(1, this); +} + +void DontBlockEvents::timerEvent(QTimerEvent* event) +{ + if (event->timerId() == m_timer.timerId()) { + m_timer.start(0, this); + QMetaObject::invokeMethod(this, "paintEvent", Qt::QueuedConnection); + count++; + QCOMPARE(count, 1); + total++; + } +} + +void DontBlockEvents::paintEvent() +{ + count--; + QCOMPARE(count, 0); +} + + +void tst_QTimer::QTBUG13633_dontBlockEvents() +{ + DontBlockEvents t; + QTest::qWait(60); + QVERIFY(t.total > 2); +} + QTEST_MAIN(tst_QTimer) #include "tst_qtimer.moc" diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 370bd13..63f9721 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -2266,7 +2266,9 @@ void tst_QUrl::ipv6() QCOMPARE(url.isValid(), isValid); if (url.isValid()) { - QCOMPARE(url.toString(), ipv6Auth); + QCOMPARE(url.toString(), ipv6Auth); + url.setHost(url.host()); + QCOMPARE(url.toString(), ipv6Auth); } }; @@ -2290,6 +2292,8 @@ void tst_QUrl::ipv6_2() QUrl url(input); QCOMPARE(url.toString(), output); + url.setHost(url.host()); + QCOMPARE(url.toString(), output); } void tst_QUrl::moreIpv6() @@ -2474,16 +2478,26 @@ void tst_QUrl::isValid() QUrl url = QUrl::fromEncoded("http://strange;hostname/here"); QVERIFY(!url.isValid()); QCOMPARE(url.path(), QString("/here")); + url.setAuthority("strange;hostname"); + QVERIFY(!url.isValid()); url.setAuthority("foobar@bar"); QVERIFY(url.isValid()); + url.setAuthority("strange;hostname"); + QVERIFY(!url.isValid()); + QVERIFY(url.errorString().contains("invalid hostname")); } { QUrl url = QUrl::fromEncoded("foo://stuff;1/g"); QVERIFY(!url.isValid()); QCOMPARE(url.path(), QString("/g")); + url.setHost("stuff;1"); + QVERIFY(!url.isValid()); url.setHost("stuff-1"); QVERIFY(url.isValid()); + url.setHost("stuff;1"); + QVERIFY(!url.isValid()); + QVERIFY(url.errorString().contains("invalid hostname")); } } |