diff options
author | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-03-20 13:46:57 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@digia.com> | 2013-03-20 13:49:28 +0100 |
commit | 76c0be34cd4ff4564693162fa7528463e23ce9d8 (patch) | |
tree | f165b7bc319548fb0082365411a871028f92e89e /tests/auto/widgets/dialogs | |
parent | 27b4fe96b59e9e63d1e570e802c072e9afdfb2d4 (diff) | |
parent | 36cb3f3f655a9090c82de609010cbfb88651a0f3 (diff) |
Merge branch 'dev' into stable
This starts Qt 5.1 release cycle
Conflicts:
src/gui/text/qfontdatabase.cpp
src/gui/text/qharfbuzz_copy_p.h
src/widgets/kernel/qapplication.cpp
src/widgets/kernel/qcoreapplication.cpp
Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
Diffstat (limited to 'tests/auto/widgets/dialogs')
5 files changed, 39 insertions, 29 deletions
diff --git a/tests/auto/widgets/dialogs/dialogs.pro b/tests/auto/widgets/dialogs/dialogs.pro index 034f37c6e0..e767c9767e 100644 --- a/tests/auto/widgets/dialogs/dialogs.pro +++ b/tests/auto/widgets/dialogs/dialogs.pro @@ -20,3 +20,4 @@ wince*:SUBDIRS -= qabstractprintdialog qsidebar \ mac:qinputdialog.CONFIG += no_check_target # QTBUG-25496 +win32-g++*: SUBDIRS -= qfilesystemmodel # QTBUG-29403 diff --git a/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp b/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp index 9654f3ac5e..e091267889 100644 --- a/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp +++ b/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp @@ -61,7 +61,7 @@ void tst_QErrorMessage::dontShowAgain() QErrorMessage errorMessageDialog(0); - // show an error with plain string + // show an error with plain string errorMessageDialog.showMessage(plainString); QVERIFY(errorMessageDialog.isVisible()); checkBox = qFindChild<QCheckBox*>(&errorMessageDialog); diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro index 5606033240..78639e87a5 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/qfilesystemmodel.pro @@ -1,6 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test -win32:testcase.timeout = 900 # this testcase can be slow on Windows +# This testcase can be slow on Windows and may interfere with other file system tests. +win32:testcase.timeout = 900 QT += widgets widgets-private QT += core-private gui testlib diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index db80aa1b22..e36eaa5af2 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -48,6 +48,7 @@ #include <QFileIconProvider> #include <QTreeView> #include <QHeaderView> +#include <QStandardPaths> #include <QTime> #include <QStyle> #include <QtGlobal> @@ -109,6 +110,7 @@ private slots: void setData_data(); void setData(); + void sortPersistentIndex(); void sort_data(); void sort(); @@ -207,27 +209,30 @@ void tst_QFileSystemModel::rootPath() QCOMPARE(rootChanged.count(), 0); QString oldRootPath = model->rootPath(); - root = model->setRootPath(QDir::homePath()); + const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); + QVERIFY(!documentPaths.isEmpty()); + const QString documentPath = documentPaths.front(); + root = model->setRootPath(documentPath); QTRY_VERIFY(model->rowCount(root) >= 0); - QCOMPARE(model->rootPath(), QString(QDir::homePath())); + QCOMPARE(model->rootPath(), QString(documentPath)); QCOMPARE(rootChanged.count(), oldRootPath == model->rootPath() ? 0 : 1); - QCOMPARE(model->rootDirectory().absolutePath(), QDir::homePath()); + QCOMPARE(model->rootDirectory().absolutePath(), documentPath); model->setRootPath(QDir::rootPath()); int oldCount = rootChanged.count(); oldRootPath = model->rootPath(); - root = model->setRootPath(QDir::homePath() + QLatin1String("/.")); + root = model->setRootPath(documentPath + QLatin1String("/.")); QTRY_VERIFY(model->rowCount(root) >= 0); - QCOMPARE(model->rootPath(), QDir::homePath()); + QCOMPARE(model->rootPath(), documentPath); QCOMPARE(rootChanged.count(), oldRootPath == model->rootPath() ? oldCount : oldCount + 1); - QCOMPARE(model->rootDirectory().absolutePath(), QDir::homePath()); + QCOMPARE(model->rootDirectory().absolutePath(), documentPath); - QDir newdir = QDir::home(); + QDir newdir = documentPath; if (newdir.cdUp()) { oldCount = rootChanged.count(); oldRootPath = model->rootPath(); - root = model->setRootPath(QDir::homePath() + QLatin1String("/..")); + root = model->setRootPath(documentPath + QLatin1String("/..")); QTRY_VERIFY(model->rowCount(root) >= 0); QCOMPARE(model->rootPath(), newdir.path()); QCOMPARE(rootChanged.count(), oldCount + 1); @@ -310,9 +315,9 @@ void tst_QFileSystemModel::naturalCompare() void tst_QFileSystemModel::readOnly() { QCOMPARE(model->isReadOnly(), true); - QTemporaryFile file; + QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat")); file.open(); - QModelIndex root = model->setRootPath(QDir::tempPath()); + QModelIndex root = model->setRootPath(flatDirTestPath); QTRY_VERIFY(model->rowCount(root) > 0); QVERIFY(!(model->flags(model->index(file.fileName())) & Qt::ItemIsEditable)); @@ -358,7 +363,10 @@ void tst_QFileSystemModel::iconProvider() delete p; QFileSystemModel *myModel = new QFileSystemModel(); - myModel->setRootPath(QDir::homePath()); + const QStringList documentPaths = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation); + QVERIFY(!documentPaths.isEmpty()); + const QString documentPath = documentPaths.front(); + myModel->setRootPath(documentPath); //Let's wait to populate the model QTest::qWait(250); //We change the provider, icons must me updated @@ -791,6 +799,19 @@ void tst_QFileSystemModel::setData() QTRY_COMPARE(model->rowCount(root), files.count()); } +void tst_QFileSystemModel::sortPersistentIndex() +{ + QTemporaryFile file(flatDirTestPath + QStringLiteral("/XXXXXX.dat")); + file.open(); + QModelIndex root = model->setRootPath(flatDirTestPath); + QTRY_VERIFY(model->rowCount(root) > 0); + + QPersistentModelIndex idx = model->index(0, 1, root); + model->sort(0, Qt::AscendingOrder); + model->sort(0, Qt::DescendingOrder); + QVERIFY(idx.column() != 0); +} + class MyFriendFileSystemModel : public QFileSystemModel { friend class tst_QFileSystemModel; @@ -806,18 +827,6 @@ void tst_QFileSystemModel::sort_data() void tst_QFileSystemModel::sort() { - QTemporaryFile file; - file.open(); - QModelIndex root = model->setRootPath(QDir::tempPath()); - QTRY_VERIFY(model->rowCount(root) > 0); - - QPersistentModelIndex idx = model->index(0, 1, root); - model->sort(0, Qt::AscendingOrder); - model->sort(0, Qt::DescendingOrder); - QVERIFY(idx.column() != 0); - - model->setRootPath(QDir::homePath()); - QFETCH(bool, fileDialogMode); MyFriendFileSystemModel *myModel = new MyFriendFileSystemModel(); diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 3922cce5cc..ae5853f3c8 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -611,7 +611,7 @@ void tst_QWizard::addPage() arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toInt(), N + 52); - QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page"); + QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert null page"); wizard.addPage(0); // generates a warning QCOMPARE(spy.count(), 0); delete parent; @@ -638,7 +638,7 @@ void tst_QWizard::setPage() QCOMPARE(wizard.nextId(), -1); page = new QWizardPage(parent); - QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1"); + QTest::ignoreMessage(QtWarningMsg,"QWizard::setPage: Cannot insert page with ID -1"); wizard.setPage(-1, page); // gives a warning and does nothing QCOMPARE(spy.count(), 0); QVERIFY(!wizard.page(-2)); @@ -2453,7 +2453,7 @@ private: QLayout *layout_ = new QVBoxLayout(this); layout_->addWidget(treeWidget = new QTreeWidget); - + QSizePolicy policy = sizePolicy(); policy.setVerticalPolicy(verticalPolicy); treeWidget->setSizePolicy(policy); |