diff options
Diffstat (limited to 'tests/auto/widgets/dialogs')
23 files changed, 318 insertions, 487 deletions
diff --git a/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro b/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro index c379e67ec5..c8ddedb401 100644 --- a/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro +++ b/tests/auto/widgets/dialogs/qcolordialog/qcolordialog.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qcolordialog QT += widgets testlib SOURCES += tst_qcolordialog.cpp diff --git a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp index c5e31a4bd4..0df0544a06 100644 --- a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp +++ b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -50,12 +45,6 @@ public slots: void testGetRgba(); void testNativeActiveModalWidget(); -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void defaultOkButton(); void native_activeModalWidget(); @@ -108,22 +97,6 @@ void tst_QColorDialog::native_activeModalWidget() qApp->exec(); } -void tst_QColorDialog::initTestCase() -{ -} - -void tst_QColorDialog::cleanupTestCase() -{ -} - -void tst_QColorDialog::init() -{ -} - -void tst_QColorDialog::cleanup() -{ -} - void tst_QColorDialog::postKeyReturn() { QWidgetList list = QApplication::topLevelWidgets(); for (int i=0; i<list.count(); ++i) { diff --git a/tests/auto/widgets/dialogs/qdialog/qdialog.pro b/tests/auto/widgets/dialogs/qdialog/qdialog.pro index c7917e8ff6..0a065b1a87 100644 --- a/tests/auto/widgets/dialogs/qdialog/qdialog.pro +++ b/tests/auto/widgets/dialogs/qdialog/qdialog.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdialog QT += widgets testlib gui-private core-private SOURCES += tst_qdialog.cpp diff --git a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp index dc796dbd73..e6a0c5e86b 100644 --- a/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp +++ b/tests/auto/widgets/dialogs/qdialog/tst_qdialog.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro b/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro index a88f449494..b4cf05e347 100644 --- a/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro +++ b/tests/auto/widgets/dialogs/qerrormessage/qerrormessage.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TEMPLATE = app TARGET = tst_qerrormessage diff --git a/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp b/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp index 26531ec0a6..a4204da20e 100644 --- a/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp +++ b/tests/auto/widgets/dialogs/qerrormessage/tst_qerrormessage.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp index 05f42cf685..d182d2edec 100644 --- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -68,7 +63,7 @@ #include <unistd.h> // for pathconf() on OS X #ifdef QT_BUILD_INTERNAL QT_BEGIN_NAMESPACE -extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded = 0); +extern Q_GUI_EXPORT QString qt_tildeExpansion(const QString &path); QT_END_NAMESPACE #endif #endif @@ -85,32 +80,14 @@ static inline bool isCaseSensitiveFileSystem(const QString &path) #endif } - -class QNonNativeFileDialog : public QFileDialog -{ - Q_OBJECT -public: - QNonNativeFileDialog(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString()) - : QFileDialog(parent, caption, directory, filter) - { - setOption(QFileDialog::DontUseNativeDialog, true); - } -}; - class tst_QFiledialog : public QObject { Q_OBJECT -public: - tst_QFiledialog(); - virtual ~tst_QFiledialog(); - -public slots: +private slots: void initTestCase(); void init(); void cleanup(); - -private slots: void currentChangedSignal(); #ifdef QT_BUILD_INTERNAL void directoryEnteredSignal(); @@ -155,7 +132,6 @@ private slots: void saveButtonText(); void clearLineEdit(); void enableChooseButton(); - void widgetlessNativeDialog(); void selectedFilesWithoutWidgets(); void trailingDotsAndSpaces(); #ifdef Q_OS_UNIX @@ -167,18 +143,24 @@ private slots: void rejectModalDialogs(); void QTBUG49600_nativeIconProviderCrash(); + // NOTE: Please keep widgetlessNativeDialog() as the LAST test! + // + // widgetlessNativeDialog() is the only test function that creates + // a native file dialog instance. GTK+ versions prior 3.15.5 have + // a nasty bug (https://bugzilla.gnome.org/show_bug.cgi?id=725164) + // in GtkFileChooserWidget, which makes it leak its folder change + // callback, causing a crash "at some point later". Running the + // native test last is enough to avoid spinning the event loop after + // the test, and that way circumvent the crash. + // + // The crash has been fixed in GTK+ 3.15.5, but the RHEL 7.2 CI has + // GTK+ 3.14.13 installed (QTBUG-55276). + void widgetlessNativeDialog(); + private: void cleanupSettingsFile(); }; -tst_QFiledialog::tst_QFiledialog() -{ -} - -tst_QFiledialog::~tst_QFiledialog() -{ -} - void tst_QFiledialog::cleanupSettingsFile() { // clean up the sidebar between each test @@ -199,9 +181,11 @@ void tst_QFiledialog::initTestCase() void tst_QFiledialog::init() { + // all tests, except widgetlessNativeDialog, use non-native dialogs + QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs); QFileDialogPrivate::setLastVisitedDirectory(QUrl()); // populate the sidebar with some default settings - QNonNativeFileDialog fd; + QFileDialog fd; #if defined(Q_OS_WINCE) QTest::qWait(1000); #endif @@ -223,7 +207,7 @@ public: // emitted any time the selection model emits current changed void tst_QFiledialog::currentChangedSignal() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString))); @@ -249,8 +233,7 @@ void tst_QFiledialog::currentChangedSignal() #if defined QT_BUILD_INTERNAL void tst_QFiledialog::directoryEnteredSignal() { - QNonNativeFileDialog fd(0, "", QDir::root().path()); - fd.setOptions(QFileDialog::DontUseNativeDialog); + QFileDialog fd(0, "", QDir::root().path()); QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar"); QVERIFY(sidebar); if (sidebar->model()->rowCount() < 2) @@ -315,9 +298,8 @@ void tst_QFiledialog::filesSelectedSignal_data() // emitted when the dialog closes with the selected files void tst_QFiledialog::filesSelectedSignal() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); - fd.setOptions(QFileDialog::DontUseNativeDialog); QDir testDir(SRCDIR); fd.setDirectory(testDir); QFETCH(QFileDialog::FileMode, fileMode); @@ -359,7 +341,7 @@ void tst_QFiledialog::filesSelectedSignal() // only emitted when the combo box is activated void tst_QFiledialog::filterSelectedSignal() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setAcceptMode(QFileDialog::AcceptSave); fd.show(); QSignalSpy spyFilterSelected(&fd, SIGNAL(filterSelected(QString))); @@ -387,7 +369,7 @@ void tst_QFiledialog::args() QString caption = "caption"; QString directory = QDir::tempPath(); QString filter = "*.mp3"; - QNonNativeFileDialog fd(parent, caption, directory, filter); + QFileDialog fd(parent, caption, directory, filter); QCOMPARE(fd.parent(), (QObject *)parent); QCOMPARE(fd.windowTitle(), caption); #ifndef Q_OS_WIN @@ -398,7 +380,7 @@ void tst_QFiledialog::args() void tst_QFiledialog::directory() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); @@ -432,12 +414,12 @@ void tst_QFiledialog::directory() #else QCOMPARE(list.at(0)->rootIndex().data().toString(), temp.dirName()); #endif - QNonNativeFileDialog *dlg = new QNonNativeFileDialog(0, "", tempPath); + QFileDialog *dlg = new QFileDialog(0, "", tempPath); QCOMPARE(model->index(tempPath), model->index(dlg->directory().absolutePath())); QCOMPARE(model->index(tempPath).data(QFileSystemModel::FileNameRole).toString(), model->index(dlg->directory().absolutePath()).data(QFileSystemModel::FileNameRole).toString()); delete dlg; - dlg = new QNonNativeFileDialog(); + dlg = new QFileDialog(); QCOMPARE(model->index(tempPath), model->index(dlg->directory().absolutePath())); delete dlg; } @@ -494,10 +476,9 @@ void tst_QFiledialog::completer() } // ### flesh this out more - QNonNativeFileDialog fd(0, QLatin1String(QTest::currentTestFunction()) + QFileDialog fd(0, QLatin1String(QTest::currentTestFunction()) + QStringLiteral(" \"") + QLatin1String(QTest::currentDataTag()) + QLatin1Char('"'), startPath); - fd.setOptions(QFileDialog::DontUseNativeDialog); fd.show(); QVERIFY(QTest::qWaitForWindowExposed(&fd)); QVERIFY(fd.isVisible()); @@ -592,8 +573,7 @@ void tst_QFiledialog::completer() void tst_QFiledialog::completer_up() { - QNonNativeFileDialog fd; - fd.setOptions(QFileDialog::DontUseNativeDialog); + QFileDialog fd; QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString))); QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(QString))); QSignalSpy spyFilesSelected(&fd, SIGNAL(filesSelected(QStringList))); @@ -616,7 +596,7 @@ void tst_QFiledialog::completer_up() void tst_QFiledialog::acceptMode() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.show(); QToolButton* newButton = fd.findChild<QToolButton*>("newFolderButton"); @@ -638,7 +618,7 @@ void tst_QFiledialog::acceptMode() void tst_QFiledialog::confirmOverwrite() { - QNonNativeFileDialog fd; + QFileDialog fd; QCOMPARE(fd.confirmOverwrite(), true); fd.setConfirmOverwrite(true); QCOMPARE(fd.confirmOverwrite(), true); @@ -650,7 +630,7 @@ void tst_QFiledialog::confirmOverwrite() void tst_QFiledialog::defaultSuffix() { - QNonNativeFileDialog fd; + QFileDialog fd; QCOMPARE(fd.defaultSuffix(), QString()); fd.setDefaultSuffix("txt"); QCOMPARE(fd.defaultSuffix(), QString("txt")); @@ -662,7 +642,7 @@ void tst_QFiledialog::defaultSuffix() void tst_QFiledialog::fileMode() { - QNonNativeFileDialog fd; + QFileDialog fd; QCOMPARE(fd.fileMode(), QFileDialog::AnyFile); fd.setFileMode(QFileDialog::ExistingFile); QCOMPARE(fd.fileMode(), QFileDialog::ExistingFile); @@ -676,7 +656,7 @@ void tst_QFiledialog::fileMode() void tst_QFiledialog::caption() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setWindowTitle("testing"); fd.setFileMode(QFileDialog::Directory); QCOMPARE(fd.windowTitle(), QString("testing")); @@ -684,8 +664,7 @@ void tst_QFiledialog::caption() void tst_QFiledialog::filters() { - QNonNativeFileDialog fd; - fd.setOptions(QFileDialog::DontUseNativeDialog); + QFileDialog fd; QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString))); QSignalSpy spyDirectoryEntered(&fd, SIGNAL(directoryEntered(QString))); QSignalSpy spyFilesSelected(&fd, SIGNAL(filesSelected(QStringList))); @@ -720,7 +699,7 @@ void tst_QFiledialog::filters() QCOMPARE(spyFilterSelected.count(), 0); //Let check if filters with whitespaces - QNonNativeFileDialog fd2; + QFileDialog fd2; QStringList expected; expected << "C++ Source Files(*.cpp)"; expected << "Any(*.*)"; @@ -738,7 +717,7 @@ void tst_QFiledialog::filters() void tst_QFiledialog::selectFilter() { - QNonNativeFileDialog fd; + QFileDialog fd; QSignalSpy spyFilterSelected(&fd, SIGNAL(filterSelected(QString))); QCOMPARE(fd.selectedNameFilter(), QString("All Files (*)")); QStringList filters; @@ -761,7 +740,7 @@ void tst_QFiledialog::selectFilter() void tst_QFiledialog::history() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); @@ -803,7 +782,7 @@ void tst_QFiledialog::history() void tst_QFiledialog::iconProvider() { - QNonNativeFileDialog *fd = new QNonNativeFileDialog(); + QFileDialog *fd = new QFileDialog(); QVERIFY(fd->iconProvider() != 0); QFileIconProvider *ip = new QFileIconProvider(); fd->setIconProvider(ip); @@ -814,7 +793,7 @@ void tst_QFiledialog::iconProvider() void tst_QFiledialog::isReadOnly() { - QNonNativeFileDialog fd; + QFileDialog fd; QPushButton* newButton = fd.findChild<QPushButton*>("newFolderButton"); QAction* renameAction = fd.findChild<QAction*>("qt_rename_action"); @@ -838,7 +817,7 @@ void tst_QFiledialog::isReadOnly() void tst_QFiledialog::itemDelegate() { - QNonNativeFileDialog fd; + QFileDialog fd; QVERIFY(fd.itemDelegate() != 0); QItemDelegate *id = new QItemDelegate(&fd); fd.setItemDelegate(id); @@ -847,7 +826,7 @@ void tst_QFiledialog::itemDelegate() void tst_QFiledialog::labelText() { - QNonNativeFileDialog fd; + QFileDialog fd; QDialogButtonBox buttonBox; QPushButton *cancelButton = buttonBox.addButton(QDialogButtonBox::Cancel); QCOMPARE(fd.labelText(QFileDialog::LookIn), QString("Look in:")); @@ -870,7 +849,7 @@ void tst_QFiledialog::labelText() void tst_QFiledialog::resolveSymlinks() { - QNonNativeFileDialog fd; + QFileDialog fd; // default QCOMPARE(fd.resolveSymlinks(), true); @@ -896,7 +875,7 @@ void tst_QFiledialog::selectFile() { QFETCH(QString, file); QFETCH(int, count); - QScopedPointer<QNonNativeFileDialog> fd(new QNonNativeFileDialog); + QScopedPointer<QFileDialog> fd(new QFileDialog); QFileSystemModel *model = fd->findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); fd->setDirectory(QDir::currentPath()); @@ -933,7 +912,7 @@ void tst_QFiledialog::selectFileWrongCaseSaveAs() QString wrongCasePath = path; for (int c = 0; c < wrongCasePath.size(); c += 2) wrongCasePath[c] = wrongCasePath.at(c).isLower() ? wrongCasePath.at(c).toUpper() : wrongCasePath.at(c).toLower(); - QNonNativeFileDialog fd(0, "QTBUG-38162", wrongCasePath); + QFileDialog fd(0, "QTBUG-38162", wrongCasePath); fd.setAcceptMode(QFileDialog::AcceptSave); fd.selectFile(wrongCasePath); const QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit"); @@ -947,7 +926,7 @@ void tst_QFiledialog::selectFiles() QVERIFY2(tempDir.isValid(), qPrintable(tempDir.errorString())); const QString tempPath = tempDir.path(); { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); fd.setDirectory(tempPath); QSignalSpy spyCurrentChanged(&fd, SIGNAL(currentChanged(QString))); @@ -959,7 +938,7 @@ void tst_QFiledialog::selectFiles() QString filesPath = fd.directory().absolutePath(); for (int i=0; i < 5; ++i) { - QFile file(filesPath + QString::fromLatin1("/qfiledialog_auto_test_not_pres_%1").arg(i)); + QFile file(filesPath + QLatin1String("/qfiledialog_auto_test_not_pres_") + QString::number(i)); file.open(QIODevice::WriteOnly); file.resize(1024); file.flush(); @@ -973,7 +952,7 @@ void tst_QFiledialog::selectFiles() QListView* listView = fd.findChild<QListView*>("listView"); QVERIFY(listView); for (int i = 0; i < list.count(); ++i) { - fd.selectFile(fd.directory().path() + "/" + list.at(i)); + fd.selectFile(fd.directory().path() + QLatin1Char('/') + list.at(i)); QTRY_VERIFY(!listView->selectionModel()->selectedRows().isEmpty()); toSelect.append(listView->selectionModel()->selectedRows().last()); } @@ -997,7 +976,7 @@ void tst_QFiledialog::selectFiles() { //If the selection is invalid then we fill the line edit but without the / - QNonNativeFileDialog dialog( 0, "Save" ); + QFileDialog dialog( 0, "Save" ); dialog.setFileMode( QFileDialog::AnyFile ); dialog.setAcceptMode( QFileDialog::AcceptSave ); dialog.selectFile(tempPath + QStringLiteral("/blah")); @@ -1011,7 +990,7 @@ void tst_QFiledialog::selectFiles() void tst_QFiledialog::viewMode() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); fd.show(); @@ -1049,7 +1028,7 @@ void tst_QFiledialog::viewMode() void tst_QFiledialog::proxymodel() { - QNonNativeFileDialog fd; + QFileDialog fd; QCOMPARE(fd.proxyModel(), (QAbstractProxyModel*)0); fd.setProxyModel(0); @@ -1065,7 +1044,7 @@ void tst_QFiledialog::proxymodel() void tst_QFiledialog::setEmptyNameFilter() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setNameFilter(QString()); fd.setNameFilters(QStringList()); } @@ -1106,7 +1085,7 @@ void tst_QFiledialog::setNameFilter() QFETCH(QString, selectFilter); QFETCH(QString, expectedSelectedFilter); - QNonNativeFileDialog fd; + QFileDialog fd; fd.setNameFilters(filters); fd.setNameFilterDetailsVisible(nameFilterDetailsVisible); fd.selectNameFilter(selectFilter); @@ -1115,7 +1094,7 @@ void tst_QFiledialog::setNameFilter() void tst_QFiledialog::focus() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setDirectory(QDir::currentPath()); fd.show(); QApplication::setActiveWindow(&fd); @@ -1137,7 +1116,7 @@ void tst_QFiledialog::focus() void tst_QFiledialog::historyBack() { - QNonNativeFileDialog fd; + QFileDialog fd; QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); QToolButton *backButton = fd.findChild<QToolButton*>("backButton"); @@ -1184,7 +1163,7 @@ void tst_QFiledialog::historyBack() void tst_QFiledialog::historyForward() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setDirectory(QDir::currentPath()); QToolButton *backButton = fd.findChild<QToolButton*>("backButton"); QVERIFY(backButton); @@ -1260,7 +1239,7 @@ void tst_QFiledialog::disableSaveButton() QFETCH(QString, path); QFETCH(bool, isEnabled); - QNonNativeFileDialog fd(0, "caption", path); + QFileDialog fd(0, "caption", path); fd.setAcceptMode(QFileDialog::AcceptSave); QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox"); QPushButton *button = buttonBox->button(QDialogButtonBox::Save); @@ -1287,7 +1266,7 @@ void tst_QFiledialog::saveButtonText() QFETCH(QString, label); QFETCH(QString, caption); - QNonNativeFileDialog fd(0, "auto test", QDir::temp().absolutePath()); + QFileDialog fd(0, "auto test", QDir::temp().absolutePath()); fd.setAcceptMode(QFileDialog::AcceptSave); if (!label.isNull()) fd.setLabelText(QFileDialog::Accept, label); @@ -1302,10 +1281,9 @@ void tst_QFiledialog::saveButtonText() void tst_QFiledialog::clearLineEdit() { - QNonNativeFileDialog fd(0, "caption", "foo"); + QFileDialog fd(0, "caption", "foo"); fd.setViewMode(QFileDialog::List); fd.setFileMode(QFileDialog::AnyFile); - fd.setOptions(QFileDialog::DontUseNativeDialog); fd.show(); //play it really safe by creating a directory @@ -1339,7 +1317,7 @@ void tst_QFiledialog::clearLineEdit() // selecting a dir the text should be cleared so one can just hit ok // and it selects that directory - fd.setFileMode(QNonNativeFileDialog::Directory); + fd.setFileMode(QFileDialog::Directory); fd.setDirectory(QDir::home()); QTest::qWait(1000); @@ -1360,7 +1338,7 @@ void tst_QFiledialog::clearLineEdit() void tst_QFiledialog::enableChooseButton() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setFileMode(QFileDialog::Directory); fd.show(); QDialogButtonBox *buttonBox = fd.findChild<QDialogButtonBox*>("buttonBox"); @@ -1373,6 +1351,7 @@ void tst_QFiledialog::widgetlessNativeDialog() { if (!QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(QPlatformTheme::FileDialog)) QSKIP("This platform always uses widgets to realize its QFileDialog, instead of the native file dialog."); + QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, false); QFileDialog fd; fd.setWindowModality(Qt::ApplicationModal); fd.show(); @@ -1381,6 +1360,7 @@ void tst_QFiledialog::widgetlessNativeDialog() QVERIFY(!model); QPushButton *button = fd.findChild<QPushButton*>(); QVERIFY(!button); + QApplication::setAttribute(Qt::AA_DontUseNativeDialogs, true); } void tst_QFiledialog::selectedFilesWithoutWidgets() @@ -1396,10 +1376,9 @@ void tst_QFiledialog::trailingDotsAndSpaces() #ifndef Q_OS_WIN QSKIP("This is only tested on Windows"); #endif - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); fd.setFileMode(QFileDialog::ExistingFile); - fd.setOptions(QFileDialog::DontUseNativeDialog); fd.show(); QLineEdit *lineEdit = fd.findChild<QLineEdit *>("fileNameEdit"); QVERIFY(lineEdit); @@ -1425,15 +1404,18 @@ void tst_QFiledialog::tildeExpansion_data() QTest::addColumn<QString>("tildePath"); QTest::addColumn<QString>("expandedPath"); + const QString tilde = QStringLiteral("~"); + const QString tildeUser = tilde + QString(qgetenv("USER")); + const QLatin1String someSubDir("/some/sub/dir"); + const QString homePath = QDir::homePath(); + const QString invalid = QStringLiteral("~thisIsNotAValidUserName"); + QTest::newRow("empty path") << QString() << QString(); - QTest::newRow("~") << QString::fromLatin1("~") << QDir::homePath(); - QTest::newRow("~/some/sub/dir/") << QString::fromLatin1("~/some/sub/dir") << QDir::homePath() - + QString::fromLatin1("/some/sub/dir"); - QString userHome = QString(qgetenv("USER")); - userHome.prepend('~'); - QTest::newRow("current user (~<user> syntax)") << userHome << QDir::homePath(); - QString invalid = QString::fromLatin1("~thisIsNotAValidUserName"); - QTest::newRow("invalid user name") << invalid << invalid; + QTest::newRow("~") << tilde << homePath; + QTest::newRow("~/some/sub/dir/") << tilde + someSubDir << homePath + someSubDir; + QTest::newRow("~<user>") << tildeUser << homePath; + QTest::newRow("~<user>/some/sub/dir") << tildeUser + someSubDir << homePath + someSubDir; + QTest::newRow("invalid user name") << invalid << invalid; } #endif // QT_BUILD_INTERNAL @@ -1472,35 +1454,28 @@ public slots: void tst_QFiledialog::rejectModalDialogs() { // QTBUG-38672 , static functions should return empty Urls - const QFileDialog::Options options = QFileDialog::DontUseNativeDialog; DialogRejecter dr; - QUrl url = QFileDialog::getOpenFileUrl(0, QStringLiteral("getOpenFileUrl"), - QUrl(), QString(), Q_NULLPTR, options); + QUrl url = QFileDialog::getOpenFileUrl(0, QStringLiteral("getOpenFileUrl")); QVERIFY(url.isEmpty()); QVERIFY(!url.isValid()); - url = QFileDialog::getExistingDirectoryUrl(0, QStringLiteral("getExistingDirectoryUrl"), - QUrl(), options | QFileDialog::ShowDirsOnly); + url = QFileDialog::getExistingDirectoryUrl(0, QStringLiteral("getExistingDirectoryUrl")); QVERIFY(url.isEmpty()); QVERIFY(!url.isValid()); - url = QFileDialog::getSaveFileUrl(0, QStringLiteral("getSaveFileUrl"), - QUrl(), QString(), Q_NULLPTR, options); + url = QFileDialog::getSaveFileUrl(0, QStringLiteral("getSaveFileUrl")); QVERIFY(url.isEmpty()); QVERIFY(!url.isValid()); // Same test with local files - QString file = QFileDialog::getOpenFileName(0, QStringLiteral("getOpenFileName"), - QString(), QString(), Q_NULLPTR, options); + QString file = QFileDialog::getOpenFileName(0, QStringLiteral("getOpenFileName")); QVERIFY(file.isEmpty()); - file = QFileDialog::getExistingDirectory(0, QStringLiteral("getExistingDirectory"), - QString(), options | QFileDialog::ShowDirsOnly); + file = QFileDialog::getExistingDirectory(0, QStringLiteral("getExistingDirectory")); QVERIFY(file.isEmpty()); - file = QFileDialog::getSaveFileName(0, QStringLiteral("getSaveFileName"), - QString(), QString(), Q_NULLPTR, options); + file = QFileDialog::getSaveFileName(0, QStringLiteral("getSaveFileName")); QVERIFY(file.isEmpty()); } diff --git a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp index b457558879..82934982c4 100644 --- a/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/widgets/dialogs/qfiledialog2/tst_qfiledialog2.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -70,17 +65,6 @@ Q_GUI_EXPORT void qt_test_resetFetchedRoot(); QT_END_NAMESPACE #endif -class QNonNativeFileDialog : public QFileDialog -{ - Q_OBJECT -public: - QNonNativeFileDialog(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString()) - : QFileDialog(parent, caption, directory, filter) - { - setOption(QFileDialog::DontUseNativeDialog, true); - } -}; - static QByteArray msgDoesNotExist(const QString &name) { return (QLatin1Char('"') + QDir::toNativeSeparators(name) @@ -93,14 +77,12 @@ Q_OBJECT public: tst_QFileDialog2(); - virtual ~tst_QFileDialog2(); -public slots: +private slots: void initTestCase(); void init(); void cleanup(); -private slots: #ifdef QT_BUILD_INTERNAL void deleteDirAndFiles(); void listRoot(); @@ -155,15 +137,12 @@ private: tst_QFileDialog2::tst_QFileDialog2() : tempDir(QDir::tempPath() + "/tst_qfiledialog2.XXXXXX") { + QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs); #if defined(Q_OS_WINCE) qApp->setAutoMaximizeThreshold(-1); #endif } -tst_QFileDialog2::~tst_QFileDialog2() -{ -} - void tst_QFileDialog2::cleanupSettingsFile() { // clean up the sidebar between each test @@ -187,7 +166,7 @@ void tst_QFileDialog2::init() { QFileDialogPrivate::setLastVisitedDirectory(QUrl()); // populate the sidebar with some default settings - QNonNativeFileDialog fd; + QFileDialog fd; #if defined(Q_OS_WINCE) QTest::qWait(1000); #endif @@ -206,7 +185,7 @@ void tst_QFileDialog2::listRoot() QTest::qWait(1500); qt_test_resetFetchedRoot(); QString dir(QDir::currentPath()); - QNonNativeFileDialog fd(0, QString(), dir); + QFileDialog fd(0, QString(), dir); fd.show(); QCOMPARE(qt_test_isFetchedRoot(),false); fd.setDirectory(""); @@ -221,15 +200,15 @@ void tst_QFileDialog2::listRoot() void tst_QFileDialog2::heapCorruption() { - QVector<QNonNativeFileDialog*> dialogs; + QVector<QFileDialog*> dialogs; for (int i=0; i < 10; i++) { - QNonNativeFileDialog *f = new QNonNativeFileDialog(NULL); + QFileDialog *f = new QFileDialog(NULL); dialogs << f; } qDeleteAll(dialogs); } -struct FriendlyQFileDialog : public QNonNativeFileDialog +struct FriendlyQFileDialog : public QFileDialog { friend class tst_QFileDialog2; Q_DECLARE_PRIVATE(QFileDialog) @@ -260,7 +239,6 @@ void tst_QFileDialog2::deleteDirAndFiles() t->close(); delete t; FriendlyQFileDialog fd; - fd.setOption(QFileDialog::DontUseNativeDialog); fd.d_func()->removeDirectory(tempPath); QFileInfo info(tempPath); QTest::qWait(2000); @@ -270,7 +248,7 @@ void tst_QFileDialog2::deleteDirAndFiles() void tst_QFileDialog2::filter() { - QNonNativeFileDialog fd; + QFileDialog fd; QAction *hiddenAction = fd.findChild<QAction*>("qt_show_hidden_action"); QVERIFY(hiddenAction); QVERIFY(hiddenAction->isEnabled()); @@ -283,7 +261,7 @@ void tst_QFileDialog2::filter() void tst_QFileDialog2::showNameFilterDetails() { - QNonNativeFileDialog fd; + QFileDialog fd; QComboBox *filters = fd.findChild<QComboBox*>("fileTypeCombo"); QVERIFY(filters); QVERIFY(fd.isNameFilterDetailsVisible()); @@ -315,7 +293,7 @@ void tst_QFileDialog2::unc() QString dir(QDir::currentPath()); #endif QVERIFY2(QFile::exists(dir), msgDoesNotExist(dir).constData()); - QNonNativeFileDialog fd(0, QString(), dir); + QFileDialog fd(0, QString(), dir); QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); QCOMPARE(model->index(fd.directory().absolutePath()), model->index(dir)); @@ -323,7 +301,7 @@ void tst_QFileDialog2::unc() void tst_QFileDialog2::emptyUncPath() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.show(); QLineEdit *lineEdit = fd.findChild<QLineEdit*>("fileNameEdit"); QVERIFY(lineEdit); @@ -392,7 +370,7 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior() QVERIFY(ctx.file.permissions() & QFile::WriteUser); ctx.file.close(); - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); fd.setDirectory(ctx.test.absolutePath()); fd.show(); @@ -433,7 +411,7 @@ void tst_QFileDialog2::task143519_deleteAndRenameActionBehavior() void tst_QFileDialog2::task178897_minimumSize() { - QNonNativeFileDialog fd; + QFileDialog fd; QSize oldMs = fd.layout()->minimumSize(); QStringList history = fd.history(); history << QDir::toNativeSeparators("/verylongdirectory/" @@ -473,7 +451,7 @@ void tst_QFileDialog2::task180459_lastDirectory() if (!QGuiApplication::platformName().compare(QLatin1String("cocoa"), Qt::CaseInsensitive)) QSKIP("Insignificant on OSX"); //QTBUG-39183 //first visit the temp directory and close the dialog - QNonNativeFileDialog *dlg = new QNonNativeFileDialog(0, "", tempDir.path()); + QFileDialog *dlg = new QFileDialog(0, "", tempDir.path()); QFileSystemModel *model = dlg->findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); QCOMPARE(model->index(tempDir.path()), model->index(dlg->directory().absolutePath())); @@ -484,7 +462,7 @@ void tst_QFileDialog2::task180459_lastDirectory() QFETCH(bool, isEnabled); QFETCH(QString, result); - dlg = new QNonNativeFileDialog(0, "", path); + dlg = new QFileDialog(0, "", path); model = dlg->findChild<QFileSystemModel*>("qt_filesystem_model"); QVERIFY(model); dlg->setAcceptMode(QFileDialog::AcceptSave); @@ -521,7 +499,7 @@ protected: path = parentIndex.child(source_row,0).data(Qt::DisplayRole).toString(); do { - path = parentIndex.data(Qt::DisplayRole).toString() + "/" + path; + path = parentIndex.data(Qt::DisplayRole).toString() + QLatin1Char('/') + path; parentIndex = parentIndex.parent(); } while(parentIndex.isValid()); @@ -560,14 +538,14 @@ protected: } }; -class CrashDialog : public QNonNativeFileDialog +class CrashDialog : public QFileDialog { Q_OBJECT public: CrashDialog(QWidget *parent, const QString &caption, const QString &dir, const QString &filter) - : QNonNativeFileDialog(parent, caption, dir, filter) + : QFileDialog(parent, caption, dir, filter) { sortProxy *proxyModel = new sortProxy(this); setProxyModel(proxyModel); @@ -577,7 +555,7 @@ QString &dir, const QString &filter) #ifdef QT_BUILD_INTERNAL void tst_QFileDialog2::task227304_proxyOnFileDialog() { - QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0); + QFileDialog fd(0, "", QDir::currentPath(), 0); fd.setProxyModel(new FilterDirModel(QDir::currentPath())); fd.show(); QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit"); @@ -600,7 +578,7 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog() dialog->close(); fd.close(); - QNonNativeFileDialog fd2(0, "I should not crash with a proxy", tempDir.path(), 0); + QFileDialog fd2(0, "I should not crash with a proxy", tempDir.path(), 0); QSortFilterProxyModel *pm = new QSortFilterProxyModel; fd2.setProxyModel(pm); fd2.show(); @@ -628,7 +606,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() QVERIFY(file2.open(QIODevice::WriteOnly | QIODevice::Text)); current.cdUp(); current.mkdir("test2"); - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); fd.setDirectory(current.absolutePath()); fd.show(); @@ -659,7 +637,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior() #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows() { - QNonNativeFileDialog fd; + QFileDialog fd; fd.setDirectory(QDir::root().path()); fd.show(); QLineEdit *edit = fd.findChild<QLineEdit*>("fileNameEdit"); @@ -685,7 +663,7 @@ void tst_QFileDialog2::task226366_lowerCaseHardDriveWindows() void tst_QFileDialog2::completionOnLevelAfterRoot() { - QNonNativeFileDialog fd; + QFileDialog fd; #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) fd.setDirectory("C:/"); QDir current = fd.directory(); @@ -752,7 +730,7 @@ void tst_QFileDialog2::task233037_selectingDirectory() { QDir current = QDir::currentPath(); current.mkdir("test"); - QNonNativeFileDialog fd; + QFileDialog fd; fd.setViewMode(QFileDialog::List); fd.setDirectory(current.absolutePath()); fd.setAcceptMode( QFileDialog::AcceptSave); @@ -786,7 +764,7 @@ void tst_QFileDialog2::task235069_hideOnEscape() QFETCH(QFileDialog::ViewMode, viewMode); QDir current = QDir::currentPath(); - QNonNativeFileDialog fd; + QFileDialog fd; QSignalSpy spyFinished(&fd, &QDialog::finished); QVERIFY(spyFinished.isValid()); QSignalSpy spyRejected(&fd, &QDialog::rejected); @@ -834,7 +812,7 @@ void tst_QFileDialog2::task203703_returnProperSeparator() { QDir current = QDir::currentPath(); current.mkdir("aaaaaaaaaaaaaaaaaa"); - QNonNativeFileDialog fd; + QFileDialog fd; fd.setDirectory(current.absolutePath()); fd.setViewMode(QFileDialog::List); fd.setFileMode(QFileDialog::Directory); @@ -871,7 +849,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() QVERIFY2(tempFile->open(), qPrintable(tempFile->errorString())); current.cdUp(); - QNonNativeFileDialog fd; + QFileDialog fd; fd.setDirectory(current.absolutePath()); fd.setViewMode(QFileDialog::Detail); fd.show(); @@ -891,7 +869,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() #else QTest::qWait(500); #endif - QNonNativeFileDialog fd2; + QFileDialog fd2; fd2.setFileMode(QFileDialog::Directory); fd2.restoreState(fd.saveState()); current.cd("aaaaaaaaaaaaaaaaaa"); @@ -916,9 +894,9 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() #else QTest::qWait(500); #endif - QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QChar('/') + QLatin1String("g")); + QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QLatin1String("/g")); - QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName()); + QFileDialog fd3(0, "This is a third file dialog", tempFile->fileName()); fd3.restoreState(fd.saveState()); fd3.setFileMode(QFileDialog::Directory); fd3.show(); @@ -959,7 +937,7 @@ void tst_QFileDialog2::task228844_ensurePreviousSorting() void tst_QFileDialog2::task239706_editableFilterCombo() { - QNonNativeFileDialog d; + QFileDialog d; d.setNameFilter("*.cpp *.h"); d.show(); @@ -984,7 +962,7 @@ void tst_QFileDialog2::task218353_relativePaths() { QDir appDir = QDir::current(); QVERIFY(appDir.cdUp() != false); - QNonNativeFileDialog d(0, "TestDialog", ".."); + QFileDialog d(0, "TestDialog", ".."); QCOMPARE(d.directory().absolutePath(), appDir.absolutePath()); d.setDirectory(appDir.absolutePath() + QLatin1String("/non-existing-directory/../another-non-existing-dir/../")); @@ -1000,7 +978,7 @@ void tst_QFileDialog2::task218353_relativePaths() #ifdef QT_BUILD_INTERNAL void tst_QFileDialog2::task251321_sideBarHiddenEntries() { - QNonNativeFileDialog fd; + QFileDialog fd; QDir current = QDir::currentPath(); current.mkdir(".hidden"); @@ -1060,7 +1038,7 @@ public : #ifdef QT_BUILD_INTERNAL void tst_QFileDialog2::task251341_sideBarRemoveEntries() { - QNonNativeFileDialog fd; + QFileDialog fd; QDir current = QDir::currentPath(); current.mkdir("testDir"); @@ -1129,7 +1107,7 @@ void tst_QFileDialog2::task254490_selectFileMultipleTimes() t = new QTemporaryFile; QVERIFY2(t->open(), qPrintable(t->errorString())); t->open(); - QNonNativeFileDialog fd(0, "TestFileDialog"); + QFileDialog fd(0, "TestFileDialog"); fd.setDirectory(tempPath); fd.setViewMode(QFileDialog::List); @@ -1162,8 +1140,8 @@ void tst_QFileDialog2::task257579_sideBarWithNonCleanUrls() QLatin1String dirname("autotest_task257579"); dir.rmdir(dirname); //makes sure it doesn't exist any more QVERIFY(dir.mkdir(dirname)); - QString url = QString::fromLatin1("%1/%2/..").arg(dir.absolutePath()).arg(dirname); - QNonNativeFileDialog fd; + QString url = dir.absolutePath() + QLatin1Char('/') + dirname + QLatin1String("/.."); + QFileDialog fd; fd.setSidebarUrls(QList<QUrl>() << QUrl::fromLocalFile(url)); QSidebar *sidebar = fd.findChild<QSidebar*>("sidebar"); QCOMPARE(sidebar->urls().count(), 1); @@ -1183,7 +1161,7 @@ void tst_QFileDialog2::task257579_sideBarWithNonCleanUrls() void tst_QFileDialog2::task259105_filtersCornerCases() { - QNonNativeFileDialog fd(0, "TestFileDialog"); + QFileDialog fd(0, "TestFileDialog"); fd.setNameFilter(QLatin1String("All Files! (*);;Text Files (*.txt)")); fd.setOption(QFileDialog::HideNameFilterDetails, true); fd.show(); @@ -1230,7 +1208,7 @@ void tst_QFileDialog2::QTBUG4419_lineEditSelectAll() QString tempPath = tempDir.path(); QTemporaryFile temporaryFile(tempPath + "/tst_qfiledialog2_lineEditSelectAll.XXXXXX"); QVERIFY2(temporaryFile.open(), qPrintable(temporaryFile.errorString())); - QNonNativeFileDialog fd(0, "TestFileDialog", temporaryFile.fileName()); + QFileDialog fd(0, "TestFileDialog", temporaryFile.fileName()); fd.setDirectory(tempPath); fd.setViewMode(QFileDialog::List); @@ -1273,7 +1251,7 @@ void tst_QFileDialog2::QTBUG6558_showDirsOnly() out << "The magic number is: " << 49 << "\n"; tempFile.close(); - QNonNativeFileDialog fd(0, "TestFileDialog"); + QFileDialog fd(0, "TestFileDialog"); fd.setDirectory(dir.absolutePath()); fd.setViewMode(QFileDialog::List); @@ -1322,7 +1300,7 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails() filtersStr << "Images (*.png *.xpm *.jpg)" << "Text files (*.txt)" << "XML files (*.xml)"; QString chosenFilterString("Text files (*.txt)"); - QNonNativeFileDialog fd(0, "TestFileDialog"); + QFileDialog fd(0, "TestFileDialog"); fd.setAcceptMode(QFileDialog::AcceptSave); fd.setOption(QFileDialog::HideNameFilterDetails, true); fd.setNameFilters(filtersStr); @@ -1338,7 +1316,7 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails() //We compare the current combobox text with the stripped version QCOMPARE(filters->currentText(), QString("Text files")); - QNonNativeFileDialog fd2(0, "TestFileDialog"); + QFileDialog fd2(0, "TestFileDialog"); fd2.setAcceptMode(QFileDialog::AcceptSave); fd2.setOption(QFileDialog::HideNameFilterDetails, false); fd2.setNameFilters(filtersStr); @@ -1358,7 +1336,7 @@ void tst_QFileDialog2::QTBUG4842_selectFilterWithHideNameFilterDetails() void tst_QFileDialog2::dontShowCompleterOnRoot() { - QNonNativeFileDialog fd(0, "TestFileDialog"); + QFileDialog fd(0, "TestFileDialog"); fd.setAcceptMode(QFileDialog::AcceptSave); fd.show(); diff --git a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp index af92f0735d..ad7600c784 100644 --- a/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp +++ b/tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -395,8 +390,9 @@ void tst_QFileSystemModel::rowsInserted_data() QTest::addColumn<int>("count"); QTest::addColumn<int>("ascending"); for (int i = 0; i < 4; ++i) { - QTest::newRow(QString("Qt::AscendingOrder %1").arg(i).toLocal8Bit().constData()) << i << (int)Qt::AscendingOrder; - QTest::newRow(QString("Qt::DescendingOrder %1").arg(i).toLocal8Bit().constData()) << i << (int)Qt::DescendingOrder; + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("Qt::AscendingOrder " + iB).constData()) << i << (int)Qt::AscendingOrder; + QTest::newRow(("Qt::DescendingOrder " + iB).constData()) << i << (int)Qt::DescendingOrder; } } @@ -424,7 +420,7 @@ void tst_QFileSystemModel::rowsInserted() int oldCount = model->rowCount(root); QStringList files; for (int i = 0; i < count; ++i) - files.append(QString("c%1").arg(i)); + files.append(QLatin1Char('c') + QString::number(i)); QVERIFY(createFiles(tmp, files, 5)); TRY_WAIT(model->rowCount(root) == oldCount + count); QTRY_COMPARE(model->rowCount(root), oldCount + count); @@ -957,8 +953,8 @@ void tst_QFileSystemModel::dirsBeforeFiles() for (int i = 0; i < 3; ++i) { QLatin1Char c('a' + i); - dir.mkdir(QString("%1-dir").arg(c)); - QFile file(flatDirTestPath + QString("/%1-file").arg(c)); + dir.mkdir(c + QLatin1String("-dir")); + QFile file(flatDirTestPath + QLatin1Char('/') + c + QLatin1String("-file")); file.open(QIODevice::ReadWrite); file.close(); } @@ -1035,7 +1031,7 @@ void tst_QFileSystemModel::permissions() // checks QTBUG-20503 QFETCH(bool, readOnly); const QString tmp = flatDirTestPath; - const QString file = tmp + '/' + "f"; + const QString file = tmp + QLatin1String("/f"); QVERIFY(createFiles(tmp, QStringList() << "f")); QVERIFY(QFile::setPermissions(file, QFile::Permissions(permissions))); diff --git a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST index 669ec50978..b62f3e3344 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST +++ b/tests/auto/widgets/dialogs/qfontdialog/BLACKLIST @@ -1,3 +1,4 @@ [task256466_wrongStyle] opensuse-13.1 rhel-7.1 +rhel-7.2 diff --git a/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro b/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro index dc1702971e..320d6ee3b5 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro +++ b/tests/auto/widgets/dialogs/qfontdialog/qfontdialog.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfontdialog QT += widgets widgets-private testlib @@ -9,9 +8,9 @@ SOURCES += tst_qfontdialog.cpp RESOURCES += testfonts.qrc -mac { +osx { # ### fixme # OBJECTIVE_SOURCES += tst_qfontdialog_mac_helpers.mm -# LIBS += -framework Cocoa +# LIBS += -framework AppKit } diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp index 9aacd3105e..a5aaf62855 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp +++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm index 0d29f5b7a2..44b6423f1c 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm +++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog_mac_helpers.mm @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp index c3b80304a2..bbb6883238 100644 --- a/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/widgets/dialogs/qinputdialog/tst_qinputdialog.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -168,10 +163,10 @@ void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0) const ValueType origValue = sbox->value(); testInvalidateAndRestore<SpinBoxType, ValueType>(sbox, okButton, ledit); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(sbox->minimum())); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(sbox->maximum())); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(sbox->minimum() - 1)); - testTypingValue<SpinBoxType>(sbox, okButton, QString("%1").arg(sbox->maximum() + 1)); + testTypingValue<SpinBoxType>(sbox, okButton, QString::number(sbox->minimum())); + testTypingValue<SpinBoxType>(sbox, okButton, QString::number(sbox->maximum())); + testTypingValue<SpinBoxType>(sbox, okButton, QString::number(sbox->minimum() - 1)); + testTypingValue<SpinBoxType>(sbox, okButton, QString::number(sbox->maximum() + 1)); testTypingValue<SpinBoxType>(sbox, okButton, "0"); testTypingValue<SpinBoxType>(sbox, okButton, "0.0"); testTypingValue<SpinBoxType>(sbox, okButton, "foobar"); diff --git a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro index e9f220101b..91848fee24 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro +++ b/tests/auto/widgets/dialogs/qmessagebox/qmessagebox.pro @@ -2,6 +2,5 @@ TEMPLATE = app TARGET = tst_qmessagebox QT += gui-private core-private widgets testlib CONFIG += testcase -CONFIG += parallel_test SOURCES += tst_qmessagebox.cpp diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp index 1a4f9077d9..d6b3ce07e8 100644 --- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -616,7 +611,7 @@ void tst_QMessageBox::detailsButtonText() QAbstractButton* btn = NULL; foreach(btn, list) { if (btn && (btn->inherits("QPushButton"))) { - if (btn->text().remove("&") != QMessageBox::tr("OK") + if (btn->text().remove(QLatin1Char('&')) != QMessageBox::tr("OK") && btn->text() != QMessageBox::tr("Show Details...")) { QFAIL(qPrintable(QString("Unexpected messagebox button text: %1").arg(btn->text()))); } diff --git a/tests/auto/widgets/dialogs/qprogressdialog/qprogressdialog.pro b/tests/auto/widgets/dialogs/qprogressdialog/qprogressdialog.pro index 290374f825..10aeaace71 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/qprogressdialog.pro +++ b/tests/auto/widgets/dialogs/qprogressdialog/qprogressdialog.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qprogressdialog QT += widgets testlib SOURCES += tst_qprogressdialog.cpp diff --git a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp index 9231de0698..44b7894c53 100644 --- a/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp +++ b/tests/auto/widgets/dialogs/qprogressdialog/tst_qprogressdialog.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** diff --git a/tests/auto/widgets/dialogs/qsidebar/qsidebar.pro b/tests/auto/widgets/dialogs/qsidebar/qsidebar.pro index ce485504e2..18e637199a 100644 --- a/tests/auto/widgets/dialogs/qsidebar/qsidebar.pro +++ b/tests/auto/widgets/dialogs/qsidebar/qsidebar.pro @@ -1,8 +1,6 @@ CONFIG += testcase -CONFIG += parallel_test QT += core-private QT += widgets widgets-private testlib SOURCES += tst_qsidebar.cpp TARGET = tst_qsidebar -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp index 943e86e9dc..78d0372ac0 100644 --- a/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp +++ b/tests/auto/widgets/dialogs/qsidebar/tst_qsidebar.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -39,14 +34,6 @@ class tst_QSidebar : public QObject { Q_OBJECT -public: - tst_QSidebar(); - virtual ~tst_QSidebar(); - -public Q_SLOTS: - void init(); - void cleanup(); - private slots: void setUrls(); void selectUrls(); @@ -55,22 +42,6 @@ private slots: void goToUrl(); }; -tst_QSidebar::tst_QSidebar() -{ -} - -tst_QSidebar::~tst_QSidebar() -{ -} - -void tst_QSidebar::init() -{ -} - -void tst_QSidebar::cleanup() -{ -} - void tst_QSidebar::setUrls() { QList<QUrl> urls; @@ -113,7 +84,7 @@ void tst_QSidebar::addUrls() QAbstractItemModel *model = qsidebar.model(); QDir testDir = QDir::home(); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) // temp and home is the same directory on Android testDir.mkdir(QStringLiteral("test")); QVERIFY(testDir.cd(QStringLiteral("test"))); diff --git a/tests/auto/widgets/dialogs/qwizard/qwizard.pro b/tests/auto/widgets/dialogs/qwizard/qwizard.pro index a1d72e854a..c6e5bcea7a 100644 --- a/tests/auto/widgets/dialogs/qwizard/qwizard.pro +++ b/tests/auto/widgets/dialogs/qwizard/qwizard.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwizard QT += widgets testlib SOURCES += tst_qwizard.cpp tst_qwizard_2.cpp diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp index 5789f0ca42..0f63baa0e6 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** @@ -59,11 +54,8 @@ class tst_QWizard : public QObject public: tst_QWizard(); -public slots: - void init(); - void cleanup(); - private slots: + void cleanup(); void buttonText(); void setButtonLayout(); void setButton(); @@ -138,10 +130,6 @@ private slots: tst_QWizard::tst_QWizard() { -} - -void tst_QWizard::init() -{ #ifdef Q_OS_WINCE //disable magic for WindowsCE qApp->setAutoMaximizeThreshold(-1); #endif @@ -547,8 +535,8 @@ void tst_QWizard::setDefaultProperty() // make sure the data structure is reasonable for (int i = 0; i < 200000; ++i) { - wizard.setDefaultProperty("QLineEdit", QByteArray("x" + QByteArray::number(i)).constData(), 0); - wizard.setDefaultProperty("QLabel", QByteArray("y" + QByteArray::number(i)).constData(), 0); + wizard.setDefaultProperty("QLineEdit", QByteArray('x' + QByteArray::number(i)).constData(), 0); + wizard.setDefaultProperty("QLabel", QByteArray('y' + QByteArray::number(i)).constData(), 0); } } @@ -1625,7 +1613,7 @@ class SetPage : public Operation for (int j = 0; j < page; ++j) wizard->next(); } - QString describe() const { return QString("set page %1").arg(page); } + QString describe() const { return QLatin1String("set page ") + QString::number(page); } int page; public: static QSharedPointer<SetPage> create(int page) @@ -1639,7 +1627,7 @@ public: class SetStyle : public Operation { void apply(QWizard *wizard) const { wizard->setWizardStyle(style); } - QString describe() const { return QString("set style %1").arg(style); } + QString describe() const { return QLatin1String("set style ") + QString::number(style); } QWizard::WizardStyle style; public: static QSharedPointer<SetStyle> create(QWizard::WizardStyle style) @@ -1713,7 +1701,8 @@ public: QString SetOption::describe() const { - return QString("set opt %1 %2").arg(OptionInfo::instance().tag(option)).arg(on); + return QLatin1String("set opt ") + OptionInfo::instance().tag(option) + + QLatin1Char(on ? '1' : '0'); } Q_DECLARE_METATYPE(QVector<QSharedPointer<Operation> >) @@ -1742,7 +1731,7 @@ public: void createTestRows() { for (int i = 0; i < combinations.count(); ++i) { - QTest::newRow((name + QString(", row %1").arg(i)).toLatin1().data()) + QTest::newRow((name.toLatin1() + ", row " + QByteArray::number(i)).constData()) << (i == 0) << (type == Equality) << combinations.at(i); ++nRows_; } @@ -1843,7 +1832,7 @@ public: foreach (const QSharedPointer<Operation> &op, operations) { if (op) { op->apply(this); - opsDescr += QString("(%1) ").arg(op->describe()); + opsDescr += QLatin1Char('(') + op->describe() + QLatin1String(") "); } } } @@ -2129,7 +2118,7 @@ void tst_QWizard::combinations() } if (minSizeTest) - qDebug() << "minimum sizes" << reason.latin1() << ";" << wizard.minimumSizeHint() + qDebug() << "minimum sizes" << reason.latin1() << ';' << wizard.minimumSizeHint() << otor.latin1() << refMinSize; if (imageTest) @@ -2626,9 +2615,6 @@ void tst_QWizard::task161658_alignments() void tst_QWizard::task177022_setFixedSize() { -#ifdef Q_OS_BLACKBERRY - QSKIP("Window is forced fullscreen"); -#endif int width = 300; int height = 200; QWizard wiz; diff --git a/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp b/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp index ccae4f7a7e..0969cecc45 100644 --- a/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp +++ b/tests/auto/widgets/dialogs/qwizard/tst_qwizard_2.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. ** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** |