diff options
Diffstat (limited to 'tests')
13 files changed, 279 insertions, 77 deletions
diff --git a/tests/auto/declarative/qdeclarativeborderimage/data/colors-round-remote.sci b/tests/auto/declarative/qdeclarativeborderimage/data/colors-round-remote.sci new file mode 100644 index 0000000..c673bed --- /dev/null +++ b/tests/auto/declarative/qdeclarativeborderimage/data/colors-round-remote.sci @@ -0,0 +1,7 @@ +border.left:10 +border.top:20 +border.right:30 +border.bottom:40 +horizontalTileRule:Round +verticalTileRule:Repeat +source:http://127.0.0.1:14446/colors.png diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index e6543e6..bc2f170 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -294,6 +294,7 @@ void tst_qdeclarativeborderimage::sciSource_data() QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors-round.sci").toString() << true; QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.sci").toString() << false; QTest::newRow("remote") << SERVER_ADDR "/colors-round.sci" << true; + QTest::newRow("remote image") << SERVER_ADDR "/colors-round-remote.sci" << true; QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.sci" << false; } diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index b343010..9b6f04c 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -1329,6 +1329,19 @@ void tst_QDeclarativeListView::positionViewAtIndex() QTRY_COMPARE(item->y(), i*20.); } + // Position at End using last index + listview->positionViewAtIndex(model.count()-1, QDeclarativeListView::End); + QTRY_COMPARE(listview->contentY(), 480.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(contentItem, "wrapper").count(); + for (int i = 24; i < model.count(); ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); + } + // Position at End listview->positionViewAtIndex(20, QDeclarativeListView::End); QTRY_COMPARE(listview->contentY(), 100.); diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 358822e..bfa81ed 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -69,8 +69,9 @@ public: tst_QDeclarativeLoader(); private slots: - void sourceOrComponent(); - void sourceOrComponent_data(); + void url(); + void invalidUrl(); + void component(); void clear(); void urlToComponent(); void componentToUrl(); @@ -99,71 +100,56 @@ tst_QDeclarativeLoader::tst_QDeclarativeLoader() { } -void tst_QDeclarativeLoader::sourceOrComponent() +void tst_QDeclarativeLoader::url() { - QFETCH(QString, sourceDefinition); - QFETCH(QUrl, sourceUrl); - QFETCH(QString, errorString); - - bool error = !errorString.isEmpty(); - if (error) - QTest::ignoreMessage(QtWarningMsg, errorString.toUtf8().constData()); - QDeclarativeComponent component(&engine); - component.setData(QByteArray( - "import QtQuick 1.0\n" - "Loader {\n" - " property int onItemChangedCount: 0\n" - " property int onSourceChangedCount: 0\n" - " property int onStatusChangedCount: 0\n" - " property int onProgressChangedCount: 0\n" - " property int onLoadedCount: 0\n") - + sourceDefinition.toUtf8() - + QByteArray( - " onItemChanged: onItemChangedCount += 1\n" - " onSourceChanged: onSourceChangedCount += 1\n" - " onStatusChanged: onStatusChangedCount += 1\n" - " onProgressChanged: onProgressChangedCount += 1\n" - " onLoaded: onLoadedCount += 1\n" - "}") - , TEST_FILE("")); - + component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load: 0; onLoaded: did_load=123; source: \"Rect120x60.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); - QCOMPARE(loader->item() == 0, error); - QCOMPARE(loader->source(), sourceUrl); + QVERIFY(loader->item()); + QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml")); QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Ready); + QCOMPARE(loader->property("did_load").toInt(), 123); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - QCOMPARE(loader->status(), error ? QDeclarativeLoader::Error : QDeclarativeLoader::Ready); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), error ? 0: 1); + delete loader; +} - if (!error) { - QDeclarativeComponent *c = qobject_cast<QDeclarativeComponent*>(loader->QGraphicsObject::children().at(0)); - QVERIFY(c); - QCOMPARE(loader->sourceComponent(), c); - } +void tst_QDeclarativeLoader::component() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/SetSourceComponent.qml")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); - QCOMPARE(loader->property("onSourceChangedCount").toInt(), 1); - QCOMPARE(loader->property("onStatusChangedCount").toInt(), 1); - QCOMPARE(loader->property("onProgressChangedCount").toInt(), 1); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(item->QGraphicsObject::children().at(1)); + QVERIFY(loader); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Ready); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - QCOMPARE(loader->property("onItemChangedCount").toInt(), error ? 0 : 1); - QCOMPARE(loader->property("onLoadedCount").toInt(), error ? 0 : 1); + QDeclarativeComponent *c = qobject_cast<QDeclarativeComponent*>(item->QGraphicsObject::children().at(0)); + QVERIFY(c); + QCOMPARE(loader->sourceComponent(), c); - delete loader; + delete item; } -void tst_QDeclarativeLoader::sourceOrComponent_data() +void tst_QDeclarativeLoader::invalidUrl() { - QTest::addColumn<QString>("sourceDefinition"); - QTest::addColumn<QUrl>("sourceUrl"); - QTest::addColumn<QString>("errorString"); + QTest::ignoreMessage(QtWarningMsg, QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found").toUtf8().constData()); - QTest::newRow("source") << "source: 'Rect120x60.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml") << ""; - QTest::newRow("sourceComponent") << "Component { id: comp; Rectangle { width: 100; height: 50 } }\n sourceComponent: comp\n" << QUrl() << ""; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import QtQuick 1.0\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + QVERIFY(loader->item() == 0); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Error); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); - QTest::newRow("invalid source") << "source: 'IDontExist.qml'\n" << QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml") - << QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found"); + delete loader; } void tst_QDeclarativeLoader::clear() @@ -460,7 +446,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import QtQuick 1.0\nLoader { property int signalCount : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: signalCount += 1 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import QtQuick 1.0\nLoader { property int did_load : 0; source: \"http://127.0.0.1:14450/Rect120x60.qml\"; onLoaded: did_load=123 }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); if (component.isError()) qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); @@ -470,7 +456,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->property("signalCount").toInt(), 1); + QCOMPARE(loader->property("did_load").toInt(), 123); QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); delete loader; diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 615b919..ba1a95f 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -373,6 +373,8 @@ void tst_qdeclarativetextedit::alignments() QImage expect(expectfile); QCOMPARE(actual,expect); + + delete canvas; } @@ -745,6 +747,8 @@ void tst_qdeclarativetextedit::mouseSelection() QVERIFY(str.length() > 3); // don't reallly care *what* was selected (and it's too sensitive to platform) else QVERIFY(str.isEmpty()); + + delete canvas; } void tst_qdeclarativetextedit::inputMethodHints() @@ -759,6 +763,8 @@ void tst_qdeclarativetextedit::inputMethodHints() QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText); textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly); + + delete canvas; } void tst_qdeclarativetextedit::cursorDelegate() @@ -785,6 +791,8 @@ void tst_qdeclarativetextedit::cursorDelegate() //Test Delegate gets deleted textEditObject->setCursorDelegate(0); QVERIFY(!textEditObject->findChild<QDeclarativeItem*>("cursorInstance")); + + delete view; } void tst_qdeclarativetextedit::delegateLoading_data() @@ -867,6 +875,8 @@ void tst_qdeclarativetextedit::navigation() QVERIFY(input->hasActiveFocus() == false); simulateKey(canvas, Qt::Key_Left); QVERIFY(input->hasActiveFocus() == true); + + delete canvas; } void tst_qdeclarativetextedit::copyAndPaste() { @@ -941,6 +951,8 @@ void tst_qdeclarativetextedit::readOnly() simulateKey(canvas, Qt::Key_Space); simulateKey(canvas, Qt::Key_Escape); QCOMPARE(edit->text(), initial); + + delete canvas; } void tst_qdeclarativetextedit::simulateKey(QDeclarativeView *view, int key) diff --git a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp index fe216e7..b1876b0 100644 --- a/tests/auto/qfontdatabase/tst_qfontdatabase.cpp +++ b/tests/auto/qfontdatabase/tst_qfontdatabase.cpp @@ -224,9 +224,6 @@ void tst_QFontDatabase::addAppFont_data() void tst_QFontDatabase::addAppFont() { -#ifdef Q_OS_SYMBIAN - QSKIP( "Symbian: Application fonts are not yet supported", SkipAll ); -#else QFETCH(bool, useMemoryFont); QSignalSpy fontDbChangedSpy(QApplication::instance(), SIGNAL(fontDatabaseChanged())); @@ -276,7 +273,6 @@ void tst_QFontDatabase::addAppFont() QCOMPARE(fontDbChangedSpy.count(), 2); QVERIFY(db.families() == oldFamilies); -#endif } QTEST_MAIN(tst_QFontDatabase) diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 2fb445e..bac17b1 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -121,6 +121,11 @@ private slots: void avoidRecursionInInsertItem(); void styleInfoLeak(); void task236367_maxSizeHint(); + void spanningItem2x2_data(); + void spanningItem2x2(); + void spanningItem2x3_data(); + void spanningItem2x3(); + void spanningItem(); void heightForWidth(); void widthForHeight(); void heightForWidthWithSpanning(); @@ -3232,6 +3237,159 @@ void tst_QGraphicsGridLayout::heightForWidthWithSpanning() QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, 10000)); } +Q_DECLARE_METATYPE(QSizePolicy::Policy) +void tst_QGraphicsGridLayout::spanningItem2x2_data() +{ + QTest::addColumn<QSizePolicy::Policy>("sizePolicy"); + QTest::addColumn<int>("itemHeight"); + QTest::addColumn<int>("expectedHeight"); + + QTest::newRow("A larger spanning item with 2 widgets with fixed policy") << QSizePolicy::Fixed << 39 << 80; + QTest::newRow("A larger spanning item with 2 widgets with preferred policy") << QSizePolicy::Preferred << 39 << 80; + QTest::newRow("An equally-sized spanning item with 2 widgets with fixed policy") << QSizePolicy::Fixed << 40 << 80; + QTest::newRow("An equally-sized spanning item with 2 widgets with preferred policy") << QSizePolicy::Preferred << 40 << 80; + QTest::newRow("A smaller spanning item with 2 widgets with fixed policy") << QSizePolicy::Fixed << 41 << 82; + QTest::newRow("A smaller spanning item with 2 widgets with preferred policy") << QSizePolicy::Preferred << 41 << 82; +} + +void tst_QGraphicsGridLayout::spanningItem2x2() +{ + QFETCH(QSizePolicy::Policy, sizePolicy); + QFETCH(int, itemHeight); + QFETCH(int, expectedHeight); + QGraphicsWidget *form = new QGraphicsWidget(0, Qt::Window); + QGraphicsGridLayout *layout = new QGraphicsGridLayout(form); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + QGraphicsWidget *w1 = new QGraphicsWidget; + w1->setMinimumSize(80,80); + w1->setMaximumSize(80,80); + + QGraphicsWidget *w2 = new QGraphicsWidget; + w2->setMinimumSize(80,itemHeight); + w2->setPreferredSize(80,itemHeight); + w2->setSizePolicy(QSizePolicy::Fixed, sizePolicy); + + QGraphicsWidget *w3 = new QGraphicsWidget; + w3->setMinimumSize(80,itemHeight); + w3->setPreferredSize(80,itemHeight); + w3->setSizePolicy(QSizePolicy::Fixed, sizePolicy); + + layout->addItem(w1, 0, 0, 2, 1); + layout->addItem(w2, 0, 1); + layout->addItem(w3, 1, 1); + + QCOMPARE(layout->minimumSize(), QSizeF(160,expectedHeight)); + if(sizePolicy == QSizePolicy::Fixed) + QCOMPARE(layout->maximumSize(), QSizeF(160,expectedHeight)); + else + QCOMPARE(layout->maximumSize(), QSizeF(160,QWIDGETSIZE_MAX)); +} + +void tst_QGraphicsGridLayout::spanningItem2x3_data() +{ + QTest::addColumn<bool>("w1_fixed"); + QTest::addColumn<bool>("w2_fixed"); + QTest::addColumn<bool>("w3_fixed"); + QTest::addColumn<bool>("w4_fixed"); + QTest::addColumn<bool>("w5_fixed"); + + for(int w1 = 0; w1 < 2; w1++) + for(int w2 = 0; w2 < 2; w2++) + for(int w3 = 0; w3 < 2; w3++) + for(int w4 = 0; w4 < 2; w4++) + for(int w5 = 0; w5 < 2; w5++) { + QString description = QString("Fixed sizes:") + (w1?" w1":"") + (w2?" w2":"") + (w3?" w3":"") + (w4?" w4":"") + (w5?" w5":""); + QTest::newRow(description.toLatin1()) << (bool)w1 << (bool)w2 << (bool)w3 << (bool)w4 << (bool)w5; + } +} + +void tst_QGraphicsGridLayout::spanningItem2x3() +{ + QFETCH(bool, w1_fixed); + QFETCH(bool, w2_fixed); + QFETCH(bool, w3_fixed); + QFETCH(bool, w4_fixed); + QFETCH(bool, w5_fixed); + QGraphicsGridLayout *layout = new QGraphicsGridLayout; + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + QGraphicsWidget *w1 = new QGraphicsWidget; + w1->setMinimumSize(80,80); + w1->setMaximumSize(80,80); + if (w1_fixed) + w1->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + QGraphicsWidget *w2 = new QGraphicsWidget; + w2->setMinimumSize(80,48); + w2->setPreferredSize(80,48); + if (w2_fixed) + w2->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + QGraphicsWidget *w3 = new QGraphicsWidget; + w3->setMinimumSize(80,30); + w3->setPreferredSize(80,30); + if (w3_fixed) + w3->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + QGraphicsWidget *w4 = new QGraphicsWidget; + w4->setMinimumSize(80,30); + w4->setMaximumSize(80,30); + if (w4_fixed) + w4->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + QGraphicsWidget *w5 = new QGraphicsWidget; + w5->setMinimumSize(40,24); + w5->setMaximumSize(40,24); + if (w5_fixed) + w5->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + + layout->addItem(w1, 0, 0, 2, 1); + layout->addItem(w2, 0, 1); + layout->addItem(w3, 1, 1); + layout->addItem(w4, 0, 2); + layout->addItem(w5, 1, 2); + + QCOMPARE(layout->minimumSize(), QSizeF(240,80)); + // Only w2 and w3 grow vertically, so when they have a fixed vertical size policy, + // the whole layout cannot grow vertically. + if (w2_fixed && w3_fixed) + QCOMPARE(layout->maximumSize(), QSizeF(QWIDGETSIZE_MAX,80)); + else + QCOMPARE(layout->maximumSize(), QSizeF(QWIDGETSIZE_MAX,QWIDGETSIZE_MAX)); +} + +void tst_QGraphicsGridLayout::spanningItem() +{ + QGraphicsWidget *form = new QGraphicsWidget(0, Qt::Window); + QGraphicsGridLayout *layout = new QGraphicsGridLayout(form); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + QGraphicsWidget *w1 = new QGraphicsWidget; + w1->setMinimumSize(80,80); + w1->setMaximumSize(80,80); + + QGraphicsWidget *w2 = new QGraphicsWidget; + w2->setMinimumSize(80,38); + w2->setPreferredSize(80,38); + w2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + QGraphicsWidget *w3 = new QGraphicsWidget; + w3->setMinimumSize(80,38); + w3->setPreferredSize(80,38); + w3->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + layout->addItem(w1, 0, 0, 2, 1); + layout->addItem(w2, 0, 1); + layout->addItem(w3, 1, 1); + + QCOMPARE(layout->minimumSize(), QSizeF(160,80)); + QCOMPARE(layout->maximumSize(), QSizeF(160,80)); +} + void tst_QGraphicsGridLayout::stretchAndHeightForWidth() { QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index a024f65..62ba1b4 100644 --- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp @@ -106,6 +106,7 @@ private slots: void testAlignmentInLargerLayout(); void testOffByOneInLargerLayout(); void testDefaultAlignment(); + void combineSizePolicies(); // Task specific tests void task218400_insertStretchCrash(); @@ -1583,6 +1584,31 @@ void tst_QGraphicsLinearLayout::testDefaultAlignment() QCOMPARE(w2->geometry(), QRectF(0,50,100,100)); } +void tst_QGraphicsLinearLayout::combineSizePolicies() +{ + QGraphicsWidget *widget = new QGraphicsWidget; + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal, widget); + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + + QGraphicsWidget *w1 = new QGraphicsWidget; + w1->setMaximumSize(200,200); + w1->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + layout->addItem(w1); + + QGraphicsWidget *w2 = new QGraphicsWidget; + w2->setPreferredSize(50,50); + w2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + layout->addItem(w2); + QCOMPARE(layout->maximumHeight(), qreal(200)); + + // now remove the fixed vertical size policy, and set instead the maximum height to 50 + // this should in effect give the same maximumHeight + w2->setMaximumHeight(50); + w2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred); + QCOMPARE(layout->maximumHeight(), qreal(200)); +} + QTEST_MAIN(tst_QGraphicsLinearLayout) #include "tst_qgraphicslinearlayout.moc" diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp index f706228..61123c2 100644 --- a/tests/auto/qhttp/tst_qhttp.cpp +++ b/tests/auto/qhttp/tst_qhttp.cpp @@ -856,7 +856,7 @@ void tst_QHttp::proxy2() QTestEventLoop::instance().enterLoop(30); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(readyRead_ba.count("Welcome to fluke.troll.no"), 2); + QCOMPARE(readyRead_ba.count("Welcome to qt-test-server"), 2); readyRead_ba.clear(); } @@ -891,7 +891,7 @@ void tst_QHttp::proxy3() QTestEventLoop::instance().enterLoop(30); QVERIFY(!QTestEventLoop::instance().timeout()); - QCOMPARE(readyRead_ba.count("Welcome to fluke.troll.no"), 2); + QCOMPARE(readyRead_ba.count("Welcome to qt-test-server"), 2); readyRead_ba.clear(); } diff --git a/tests/auto/qlayout/qlayout.pro b/tests/auto/qlayout/qlayout.pro index dfa8584..bb1ae4a 100644 --- a/tests/auto/qlayout/qlayout.pro +++ b/tests/auto/qlayout/qlayout.pro @@ -10,5 +10,11 @@ wince*|symbian: { addFiles.files = baseline addFiles.path = . DEPLOYMENT += addFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" + + test_data.files = baseline/* + test_data.path = $${target.path}/baseline + INSTALLS += test_data } diff --git a/tests/auto/qlayout/tst_qlayout.cpp b/tests/auto/qlayout/tst_qlayout.cpp index 65eae55..3090ebb 100644 --- a/tests/auto/qlayout/tst_qlayout.cpp +++ b/tests/auto/qlayout/tst_qlayout.cpp @@ -156,7 +156,8 @@ void tst_QLayout::smartMaxSize() { QVector<int> expectedWidths; - QFile f(QLatin1String("baseline/smartmaxsize")); + QFile f(QLatin1String(SRCDIR "/baseline/smartmaxsize")); + QCOMPARE(f.open(QIODevice::ReadOnly | QIODevice::Text), true); QTextStream stream(&f); diff --git a/tests/auto/qmake/testcompiler.cpp b/tests/auto/qmake/testcompiler.cpp index 021fe9b..dbdeee8 100644 --- a/tests/auto/qmake/testcompiler.cpp +++ b/tests/auto/qmake/testcompiler.cpp @@ -142,23 +142,16 @@ bool TestCompiler::runCommand( QString cmdline ) bool failed = false; child.setReadChannel(QProcess::StandardError); - while (QProcess::Running == child.state()) { - if (child.waitForReadyRead(1000)) { - QString output = child.readAllStandardError(); - testOutput_.append(output); - - output.prepend('\n'); - if (output.contains("\nProject MESSAGE: FAILED")) - failed = true; - } - } - child.waitForFinished(-1); - return failed - ? false - : (child.exitStatus() == QProcess::NormalExit) - && (child.exitCode() == 0); + foreach (const QByteArray &output, child.readAllStandardError().split('\n')) { + testOutput_.append(QString::fromLocal8Bit(output)); + + if (output.startsWith("Project MESSAGE: FAILED")) + failed = true; + } + + return !failed && child.exitStatus() == QProcess::NormalExit && child.exitCode() == 0; } void TestCompiler::setBaseCommands( QString makeCmd, QString qmakeCmd ) diff --git a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp index be6049b..6aa0995 100644 --- a/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp +++ b/tests/auto/qtipc/qsharedmemory/tst_qsharedmemory.cpp @@ -348,6 +348,8 @@ void tst_QSharedMemory::attach() QVERIFY(sm.detach()); // Make sure detach doesn't screw up something and we can't re-attach. QVERIFY(sm.attach()); + QVERIFY(sm.data() != 0); + QVERIFY(sm.size() != 0); QVERIFY(sm.detach()); QCOMPARE(sm.size(), 0); QVERIFY(sm.data() == 0); @@ -374,7 +376,8 @@ void tst_QSharedMemory::lock() QVERIFY(shm.lock()); QTest::ignoreMessage(QtWarningMsg, "QSharedMemory::lock: already locked"); QVERIFY(shm.lock()); - // don't lock forever + // we didn't unlock(), so ignore the warning from auto-detach in destructor + QTest::ignoreMessage(QtWarningMsg, "QSharedMemory::lock: already locked"); } /*! |