diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/bic/tst_bic.cpp | 4 | ||||
-rw-r--r-- | tests/auto/linguist/lconvert/tst_lconvert.cpp | 8 | ||||
-rw-r--r-- | tests/auto/linguist/lrelease/tst_lrelease.cpp | 8 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/testlupdate.cpp | 4 | ||||
-rw-r--r-- | tests/auto/linguist/lupdate/tst_lupdate.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qabstractslider/tst_qabstractslider.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qcombobox/tst_qcombobox.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qdockwidget/tst_qdockwidget.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qgl/tst_qgl.cpp | 5 | ||||
-rw-r--r-- | tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 26 | ||||
-rw-r--r-- | tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp | 65 | ||||
-rw-r--r-- | tests/auto/qtreewidget/tst_qtreewidget.cpp | 28 | ||||
-rw-r--r-- | tests/auto/qworkspace/tst_qworkspace.cpp | 3 |
14 files changed, 149 insertions, 31 deletions
diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp index 8c6056e..b7c79cf 100644 --- a/tests/auto/bic/tst_bic.cpp +++ b/tests/auto/bic/tst_bic.cpp @@ -96,6 +96,9 @@ tst_Bic::tst_Bic() /* QtOpenGL includes qt_windows.h, and some SDKs dont have these structs present */ bic.addBlacklistedClass(QLatin1String("tagTITLEBARINFO")); + bic.addBlacklistedClass(QLatin1String("tagMENUITEMINFOA")); + bic.addBlacklistedClass(QLatin1String("tagMENUITEMINFOW")); + bic.addBlacklistedClass(QLatin1String("tagENHMETAHEADER")); /* some bug in gcc also reported template instanciations */ bic.addBlacklistedClass(QLatin1String("QTypeInfo<*>")); @@ -115,6 +118,7 @@ tst_Bic::tst_Bic() bic.addBlacklistedClass(QLatin1String("QObjectData")); bic.addBlacklistedClass(QLatin1String("QAtomic")); bic.addBlacklistedClass(QLatin1String("QBasicAtomic")); + bic.addBlacklistedClass(QLatin1String("QRegion::QRegionData")); /* Jambi-related classes in Designer */ bic.addBlacklistedClass(QLatin1String("QDesignerLanguageExtension")); diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index e38e22c..10098a4 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -105,7 +105,7 @@ void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn) QList<QByteArray> actual = actualDev->readAll().split('\n'); QFile file(expectedFn); - QVERIFY(file.open(QIODevice::ReadOnly)); + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); QList<QByteArray> expected = file.readAll().split('\n'); int i = 0, ei = expected.size(), gi = actual.size(); @@ -179,7 +179,7 @@ void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outF if (!argList.isEmpty()) args += argList[i]; args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1]; - cvts.at(i)->start(binDir + "/lconvert", args); + cvts.at(i)->start(binDir + "/lconvert", args, QIODevice::ReadWrite | QIODevice::Text); } int st = 0; foreach (QProcess *cvt, cvts) @@ -243,7 +243,9 @@ void tst_lconvert::converts() QString outFileNameFq = dataDir + outFileName; QProcess cvt; - cvt.start(binDir + "/lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format); + cvt.start(binDir + "/lconvert", + QStringList() << "-i" << (dataDir + inFileName) << "-of" << format, + QIODevice::ReadWrite | QIODevice::Text); doWait(&cvt, 0); if (QTest::currentTestFailed()) return; diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp index 93cb97c..c9e774f 100644 --- a/tests/auto/linguist/lrelease/tst_lrelease.cpp +++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp @@ -72,8 +72,8 @@ private: void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedFn) { QFile file(expectedFn); - QVERIFY(file.open(QIODevice::ReadOnly)); - QStringList expected = QString(file.readAll()).trimmed().remove('\r').split('\n'); + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + QStringList expected = QString(file.readAll()).trimmed().split('\n'); int i = 0, ei = expected.size(), gi = actual.size(); for (; ; i++) { @@ -226,10 +226,10 @@ void tst_lrelease::markuntranslated() void tst_lrelease::dupes() { QProcess proc; - proc.start(binDir + "/lrelease testdata/dupes.ts"); + proc.start(binDir + "/lrelease testdata/dupes.ts", QIODevice::ReadWrite | QIODevice::Text); QVERIFY(proc.waitForFinished()); QVERIFY(proc.exitStatus() == QProcess::NormalExit); - doCompare(QString(proc.readAllStandardError()).trimmed().remove('\r').split('\n'), "testdata/dupes.errors"); + doCompare(QString(proc.readAllStandardError()).trimmed().split('\n'), "testdata/dupes.errors"); } QTEST_MAIN(tst_lrelease) diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp index 8e57323..d43fbc4 100644 --- a/tests/auto/linguist/lupdate/testlupdate.cpp +++ b/tests/auto/linguist/lupdate/testlupdate.cpp @@ -98,9 +98,9 @@ bool TestLUpdate::runChild( bool showOutput, const QString &program, const QStri connect(childProc, SIGNAL(finished(int)), this, SLOT(childReady(int))); childProc->setProcessChannelMode(QProcess::MergedChannels); if (argList.isEmpty()) { - childProc->start( program ); + childProc->start( program, QIODevice::ReadWrite | QIODevice::Text ); } else { - childProc->start( program, argList ); + childProc->start( program, argList, QIODevice::ReadWrite | QIODevice::Text ); } bool ok; diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index 230392c..7140ede 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -80,8 +80,8 @@ private: void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn, bool err) { QFile file(expectedFn); - QVERIFY(file.open(QIODevice::ReadOnly)); - QStringList expected = QString(file.readAll()).trimmed().remove('\r').split('\n'); + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + QStringList expected = QString(file.readAll()).trimmed().split('\n'); int i = 0, ei = expected.size(), gi = actual.size(); for (; ; i++) { @@ -141,8 +141,8 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn void tst_lupdate::doCompare(const QString &actualFn, const QString &expectedFn, bool err) { QFile afile(actualFn); - QVERIFY(afile.open(QIODevice::ReadOnly)); - QStringList actual = QString(afile.readAll()).trimmed().remove('\r').split('\n'); + QVERIFY(afile.open(QIODevice::ReadOnly | QIODevice::Text)); + QStringList actual = QString(afile.readAll()).trimmed().split('\n'); doCompare(actual, expectedFn, err); } @@ -180,7 +180,7 @@ void tst_lupdate::good() QString lupdatecmd; QFile file(dir + "/lupdatecmd"); if (file.exists()) { - QVERIFY(file.open(QIODevice::ReadOnly)); + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); while (!file.atEnd()) { QByteArray cmdstring = file.readLine().simplified(); if (cmdstring.startsWith('#')) @@ -226,7 +226,7 @@ void tst_lupdate::output_ts() QString lupdatecmd; QFile file(dir + "/lupdatecmd"); if (file.exists()) { - QVERIFY(file.open(QIODevice::ReadOnly)); + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); while (!file.atEnd()) { QByteArray cmdstring = file.readLine().simplified(); if (cmdstring.startsWith('#')) diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp index d9574df..ee1ba19 100644 --- a/tests/auto/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp @@ -742,11 +742,9 @@ void tst_QAbstractSlider::wheelEvent_data() << 1 // delta << int(Qt::Horizontal) // orientation of slider << int(Qt::Vertical) // orientation of wheel - << 0 // expected position after + << 1 // expected position after << QPoint(1,1); - // Scrolling in a slider of a different orientation than the wheel works - // if the mouse pointer is within the widget's rect QTest::newRow("Different orientation2")<< 0 // initial position << 0 // minimum << 100 // maximum diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp index cc59b62..e903ab5 100644 --- a/tests/auto/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/qcombobox/tst_qcombobox.cpp @@ -2479,6 +2479,10 @@ void tst_QComboBox::keyBoardNavigationWithMouse() QCOMPARE(combo.currentText(), QLatin1String("0")); +#ifdef Q_OS_WINCE + QSKIP("When calling cursor function, Windows CE responds with: This function is not supported on this system.", SkipAll); +#endif + QCursor::setPos(combo.view()->mapToGlobal(combo.view()->rect().center())); QTest::qWait(200); diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp index c9a7f1c..8f72e39 100644 --- a/tests/auto/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp @@ -50,6 +50,7 @@ #include <qlineedit.h> #include <QDesktopWidget> #include <QtGui/QPainter> +#include "private/qdockwidget_p.h" bool hasFeature(QDockWidget *dockwidget, QDockWidget::DockWidgetFeature feature) { return (dockwidget->features() & feature) == feature; } @@ -865,7 +866,9 @@ void tst_QDockWidget::taskQTBUG_1665_closableChanged() dock.show(); QTest::qWaitForWindowShown(&dock); - if (dock.windowFlags() & Qt::FramelessWindowHint) + QDockWidgetLayout *l = qobject_cast<QDockWidgetLayout*>(dock.layout()); + + if (l && !l->nativeWindowDeco()) QSKIP("this machine doesn't support native dock widget", SkipAll); QVERIFY(dock.windowFlags() & Qt::WindowCloseButtonHint); diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp index ccb08c3..5dc072d 100644 --- a/tests/auto/qgl/tst_qgl.cpp +++ b/tests/auto/qgl/tst_qgl.cpp @@ -1842,6 +1842,7 @@ void tst_QGL::shareRegister() QVERIFY(qt_shared_test()->value(glw1->context()) == res1); // Create another context that shares with the first. + QVERIFY(!glw1->isSharing()); QGLWidget *glw2 = new QGLWidget(0, glw1); if (!glw2->isSharing()) { delete glw2; @@ -1880,6 +1881,7 @@ void tst_QGL::shareRegister() // Create a third context, not sharing with the others. QGLWidget *glw3 = new QGLWidget(); + QVERIFY(!glw3->isSharing()); // Create a guard on the standalone context. QGLSharedResourceGuard guard3(glw3->context()); @@ -1928,6 +1930,9 @@ void tst_QGL::shareRegister() // Delete the first context. delete glw1; + // The second context should no longer register as sharing. + QVERIFY(!glw2->isSharing()); + // The first context's resource should transfer to the second context. QCOMPARE(tst_QGLResource::deletions, 0); QVERIFY(qt_shared_test()->value(glw2->context()) == res1); diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index c7ed309..2ad024f 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -85,6 +85,7 @@ private slots: void simplificationVsOrder(); void parallelSimplificationOfCenter(); void simplificationVsRedundance(); + void spacingPersistency(); }; class RectWidget : public QGraphicsWidget @@ -1866,5 +1867,30 @@ void tst_QGraphicsAnchorLayout::simplificationVsRedundance() QCOMPARE(usedSimplex(l, Qt::Vertical), false); } +/* + Avoid regression where the saved prefSize would be lost. This was + solved by saving the original spacing in the QGraphicsAnchorPrivate class +*/ +void tst_QGraphicsAnchorLayout::spacingPersistency() +{ + QGraphicsWidget w; + QGraphicsWidget *a = createItem(); + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&w); + + l->addAnchors(l, a, Qt::Horizontal); + QGraphicsAnchor *anchor = l->anchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft); + + anchor->setSpacing(-30); + QCOMPARE(anchor->spacing(), -30.0); + + anchor->setSpacing(30); + QCOMPARE(anchor->spacing(), 30.0); + + anchor->setSizePolicy(QSizePolicy::Ignored); + w.effectiveSizeHint(Qt::PreferredSize); + + QCOMPARE(anchor->spacing(), 30.0); +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index 0fbd069..bca59c3 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -1722,7 +1722,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() QRectF expected = truncate(item.rect); QRectF actual = truncate(widgets[item.index]->geometry()); - QCOMPARE(expected, actual); + QCOMPARE(actual, expected); } // Test mirrored mode @@ -1739,7 +1739,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() QRectF expected = truncate(mirroredRect); QRectF actual = truncate(widgets[item.index]->geometry()); - QCOMPARE(expected, actual); + QCOMPARE(actual, expected); delete widgets[item.index]; } diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp index 77c259c..269afbd 100644 --- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -92,6 +92,7 @@ private slots: void task252069_rowIntersectsSelection(); void task232634_childrenDeselectionSignal(); void task260134_layoutChangedWithAllSelected(); + void QTBUG5671_layoutChangedWithAllSelected(); private: QAbstractItemModel *model; @@ -2025,24 +2026,24 @@ void tst_QItemSelectionModel::task220420_selectedIndexes() class QtTestTableModel: public QAbstractTableModel { Q_OBJECT - + public: QtTestTableModel(int rows = 0, int columns = 0, QObject *parent = 0) : QAbstractTableModel(parent), row_count(rows), column_count(columns) {} - + int rowCount(const QModelIndex& = QModelIndex()) const { return row_count; } int columnCount(const QModelIndex& = QModelIndex()) const { return column_count; } bool isEditable(const QModelIndex &) const { return true; } - + QVariant data(const QModelIndex &idx, int role) const { if (role == Qt::DisplayRole || role == Qt::EditRole) return QString("[%1,%2]").arg(idx.row()).arg(idx.column()); return QVariant(); } - + int row_count; int column_count; friend class tst_QItemSelectionModel; @@ -2055,7 +2056,7 @@ void tst_QItemSelectionModel::task240734_layoutChanged() QItemSelectionModel selectionModel(&model); selectionModel.select(model.index(0,0), QItemSelectionModel::Select); QCOMPARE(selectionModel.selectedIndexes().count() , 1); - + emit model.layoutAboutToBeChanged(); model.row_count = 5; emit model.layoutChanged(); @@ -2107,7 +2108,7 @@ void tst_QItemSelectionModel::merge_data() << QItemSelection(model->index(2, 2) , model->index(3, 4)) << int(QItemSelectionModel::Deselect) << QItemSelection(model->index(2, 1) , model->index(3, 1)); - + QItemSelection r1(model->index(2, 1) , model->index(3, 1)); r1.select(model->index(2, 4) , model->index(3, 4)); QTest::newRow("Toggle") @@ -2274,5 +2275,57 @@ void tst_QItemSelectionModel::task260134_layoutChangedWithAllSelected() } +void tst_QItemSelectionModel::QTBUG5671_layoutChangedWithAllSelected() +{ + struct MyFilterModel : public QSortFilterProxyModel + { // Override sort filter proxy to remove even numbered rows. + bool filtering; + virtual bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const + { + return !filtering || !( source_row & 1 ); + } + }; + + //same as task260134_layoutChangedWithAllSelected but with a sightly bigger model + + enum { cNumRows=30, cNumCols=20 }; + + QStandardItemModel model(cNumRows, cNumCols); + MyFilterModel proxy; + proxy.filtering = true; + proxy.setSourceModel(&model); + QItemSelectionModel selection(&proxy); + + // Populate the tree view. + for (unsigned int i = 0; i < cNumCols; i++) + model.setHeaderData( i, Qt::Horizontal, QString::fromLatin1("Column %1").arg(i)); + + for (unsigned int r = 0; r < cNumRows; r++) { + for (unsigned int c = 0; c < cNumCols; c++) { + model.setData(model.index(r, c, QModelIndex()), + QString::fromLatin1("r:%1/c:%2").arg(r, c)); + } + } + + + QCOMPARE(model.rowCount(), int(cNumRows)); + QCOMPARE(proxy.rowCount(), int(cNumRows/2)); + + selection.select( QItemSelection(proxy.index(0,0), proxy.index(proxy.rowCount() - 1, proxy.columnCount() - 1)), QItemSelectionModel::Select); + + QList<QPersistentModelIndex> indexList; + foreach(const QModelIndex &id, selection.selectedIndexes()) + indexList << id; + + proxy.filtering = false; + proxy.invalidate(); + QCOMPARE(proxy.rowCount(), int(cNumRows)); + + //let's check the selection hasn't changed + QCOMPARE(selection.selectedIndexes().count(), indexList.count()); + foreach(QPersistentModelIndex index, indexList) + QVERIFY(selection.isSelected(index)); +} + QTEST_MAIN(tst_QItemSelectionModel) #include "tst_qitemselectionmodel.moc" diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index 6defd7b..621072c 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -167,6 +167,7 @@ private slots: void setCurrentItemExpandsParent(); void task239150_editorWidth(); void setTextUpdate(); + void taskQTBUG2844_visualItemRect(); public slots: void itemSelectionChanged(); @@ -601,9 +602,9 @@ void tst_QTreeWidget::setItemHidden() testWidget->scrollToItem(child); QVERIFY(testWidget->visualItemRect(parent).isValid() - && testWidget->viewport()->rect().contains(testWidget->visualItemRect(parent))); + && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(parent))); QVERIFY(testWidget->visualItemRect(child).isValid() - && testWidget->viewport()->rect().contains(testWidget->visualItemRect(child))); + && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(child))); QVERIFY(!testWidget->isItemHidden(parent)); QVERIFY(!testWidget->isItemHidden(child)); @@ -611,9 +612,9 @@ void tst_QTreeWidget::setItemHidden() testWidget->setItemHidden(parent, true); QVERIFY(!(testWidget->visualItemRect(parent).isValid() - && testWidget->viewport()->rect().contains(testWidget->visualItemRect(parent)))); + && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(parent)))); QVERIFY(!(testWidget->visualItemRect(child).isValid() - && testWidget->viewport()->rect().contains(testWidget->visualItemRect(child)))); + && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(child)))); QVERIFY(testWidget->isItemHidden(parent)); QVERIFY(!testWidget->isItemHidden(child)); @@ -3271,6 +3272,25 @@ void tst_QTreeWidget::setTextUpdate() QTRY_VERIFY(delegate.numPaints > 0); } +void tst_QTreeWidget::taskQTBUG2844_visualItemRect() +{ + CustomTreeWidget tree; + tree.resize(150, 100); + tree.setColumnCount(3); + QTreeWidgetItem item(&tree); + + QRect itemRect = tree.visualItemRect(&item); + + QRect rectCol0 = tree.visualRect(tree.indexFromItem(&item, 0)); + QRect rectCol1 = tree.visualRect(tree.indexFromItem(&item, 1)); + QRect rectCol2 = tree.visualRect(tree.indexFromItem(&item, 2)); + + QCOMPARE(tree.visualItemRect(&item), rectCol0 | rectCol2); + tree.setColumnHidden(2, true); + QCOMPARE(tree.visualItemRect(&item), rectCol0 | rectCol1); +} + + QTEST_MAIN(tst_QTreeWidget) diff --git a/tests/auto/qworkspace/tst_qworkspace.cpp b/tests/auto/qworkspace/tst_qworkspace.cpp index c1fe3e0..35f8a4d 100644 --- a/tests/auto/qworkspace/tst_qworkspace.cpp +++ b/tests/auto/qworkspace/tst_qworkspace.cpp @@ -426,6 +426,9 @@ void tst_QWorkspace::showWindows() void tst_QWorkspace::changeWindowTitle() { +#ifdef Q_OS_WINCE + QSKIP( "Test fails on Windows CE due to QWorkspace state handling", SkipAll); +#endif const QString mwc( "MainWindow's Caption" ); const QString mwc2( "MainWindow's New Caption" ); const QString wc( "Widget's Caption" ); |