diff options
Diffstat (limited to 'tests/auto/widgets')
211 files changed, 3499 insertions, 4200 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$ ** diff --git a/tests/auto/widgets/effects/qgraphicseffect/qgraphicseffect.pro b/tests/auto/widgets/effects/qgraphicseffect/qgraphicseffect.pro index 9f6b0455e2..177d1a7c42 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/qgraphicseffect.pro +++ b/tests/auto/widgets/effects/qgraphicseffect/qgraphicseffect.pro @@ -5,4 +5,3 @@ QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicseffect.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp index c7d1dd0aa1..a1cb729849 100644 --- a/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/widgets/effects/qgraphicseffect/tst_qgraphicseffect.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$ ** @@ -549,7 +544,7 @@ void tst_QGraphicsEffect::drawPixmapItem() QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(effect->repaints >= 1); - item->rotate(180); + item->setTransform(QTransform().rotate(180), true); QTRY_VERIFY(effect->repaints >= 2); } @@ -593,7 +588,7 @@ void tst_QGraphicsEffect::deviceCoordinateTranslateCaching() QTRY_VERIFY(item->numRepaints >= 1); int numRepaints = item->numRepaints; - item->translate(10, 0); + item->setTransform(QTransform::fromTranslate(10, 0), true); QTRY_COMPARE(item->numRepaints, numRepaints); } diff --git a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro index b6693eeb5f..bf0f99598b 100644 --- a/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro +++ b/tests/auto/widgets/effects/qpixmapfilter/qpixmapfilter.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qpixmapfilter QT += widgets widgets-private testlib diff --git a/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp b/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp index e21cb13a33..08f4944d49 100644 --- a/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.cpp +++ b/tests/auto/widgets/effects/qpixmapfilter/tst_qpixmapfilter.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$ ** @@ -41,15 +36,6 @@ class tst_QPixmapFilter : public QObject { Q_OBJECT -public: - tst_QPixmapFilter(); - virtual ~tst_QPixmapFilter(); - - -public slots: - void init(); - void cleanup(); - private slots: void colorizeSetColor(); void colorizeSetStrength(); @@ -78,22 +64,6 @@ public: } }; -tst_QPixmapFilter::tst_QPixmapFilter() -{ -} - -tst_QPixmapFilter::~tst_QPixmapFilter() -{ -} - -void tst_QPixmapFilter::init() -{ -} - -void tst_QPixmapFilter::cleanup() -{ -} - void tst_QPixmapFilter::testDefaultImplementations() { CustomFilter filter; diff --git a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp b/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp index dc2adad5da..6b0c1ecf57 100644 --- a/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.cpp +++ b/tests/auto/widgets/gestures/qgesturerecognizer/tst_qgesturerecognizer.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/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index f71308cdaf..67e1f9ce30 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.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/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro index 6e8717c86d..a1064d1c73 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/qgraphicsanchorlayout1.pro @@ -3,4 +3,3 @@ TARGET = tst_qgraphicsanchorlayout1 QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicsanchorlayout1.cpp -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index a58f295575..9124ff0070 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.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$ ** @@ -159,7 +154,7 @@ public: { setContentsMargins( 0,0,0,0 ); if (name.isEmpty()) - setData(0, QString::fromLatin1("w%1").arg(quintptr(this))); + setData(0, QLatin1Char('w') + QString::number(quintptr(this))); else setData(0, name); } @@ -1702,10 +1697,8 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout() // Create dummy widgets QList<QGraphicsWidget *> widgets; - for (int i = 0; i < widgetCount; ++i) { - TestWidget *w = new TestWidget(0, QString::fromLatin1("W%1").arg(i)); - widgets << w; - } + for (int i = 0; i < widgetCount; ++i) + widgets << new TestWidget(0, QLatin1Char('W') + QString::number(i)); // Setup anchor layout TheAnchorLayout *layout = new TheAnchorLayout; diff --git a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp index 9b1e1e173b..e7d26622c9 100644 --- a/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicseffectsource/tst_qgraphicseffectsource.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/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 8c27bebf3a..90ea2cb58b 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.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$ ** @@ -42,13 +37,8 @@ class tst_QGraphicsGridLayout : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: + void initTestCase(); void qgraphicsgridlayout_data(); void qgraphicsgridlayout(); void addItem_data(); @@ -309,27 +299,11 @@ typedef QList<QSizeF> SizeList; // It is only called once. void tst_QGraphicsGridLayout::initTestCase() { -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsGridLayout::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsGridLayout::init() -{ #ifdef Q_OS_WINCE //disable magic for WindowsCE qApp->setAutoMaximizeThreshold(-1); #endif } -// This will be called after every test function. -void tst_QGraphicsGridLayout::cleanup() -{ -} - void tst_QGraphicsGridLayout::qgraphicsgridlayout_data() { } @@ -451,9 +425,10 @@ void tst_QGraphicsGridLayout::addItem_data() int column = b; int rowSpan = c; int columnSpan = d; - QString name = QString::fromLatin1("(%1,%2,%3,%4").arg(a).arg(b).arg(c).arg(d); + const QByteArray name = '(' + QByteArray::number(a) + ',' + QByteArray::number(b) + + ',' + QByteArray::number(c) + ',' + QByteArray::number(d); Qt::Alignment alignment = Qt::AlignLeft; - QTest::newRow(name.toLatin1()) << row << column << rowSpan << columnSpan << alignment; + QTest::newRow(name.constData()) << row << column << rowSpan << columnSpan << alignment; }}}} } @@ -1107,7 +1082,8 @@ void tst_QGraphicsGridLayout::itemAt() if (i >= 0 && i < layout->count()) { QVERIFY(layout->itemAt(i)); } else { - QTest::ignoreMessage(QtWarningMsg, QString::fromLatin1("QGraphicsGridLayout::itemAt: invalid index %1").arg(i).toLatin1().constData()); + const QByteArray message = "QGraphicsGridLayout::itemAt: invalid index " + QByteArray::number(i); + QTest::ignoreMessage(QtWarningMsg, message.constData()); QCOMPARE(layout->itemAt(i), static_cast<QGraphicsLayoutItem*>(0)); } } diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro index 66e39869bb..5bfa15db16 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/qgraphicsitem.pro @@ -6,4 +6,3 @@ SOURCES += tst_qgraphicsitem.cpp DEFINES += QT_NO_CAST_TO_ASCII win32:!wince:!winrt: LIBS += -luser32 -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 4a5a66dd05..60dc7a7288 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.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$ ** @@ -310,7 +305,7 @@ private slots: void selected_textItem(); void selected_multi(); void acceptedMouseButtons(); - void acceptsHoverEvents(); + void acceptHoverEvents(); void childAcceptsHoverEvents(); void hasFocus(); void pos(); @@ -385,7 +380,9 @@ private slots: void itemContainsChildrenInShape2(); void ancestorFlags(); void untransformable(); +#ifndef QT_NO_CONTEXTMENU void contextMenuEventPropagation(); +#endif // QT_NO_CONTEXTMENU void itemIsMovable(); void boundingRegion_data(); void boundingRegion(); @@ -564,9 +561,9 @@ void tst_QGraphicsItem::construction() QVERIFY(!item->isSelected()); QCOMPARE(item->acceptedMouseButtons(), Qt::MouseButtons(0x1f)); if (item->type() == QGraphicsTextItem::Type) - QVERIFY(item->acceptsHoverEvents()); + QVERIFY(item->acceptHoverEvents()); else - QVERIFY(!item->acceptsHoverEvents()); + QVERIFY(!item->acceptHoverEvents()); QVERIFY(!item->hasFocus()); QCOMPARE(item->pos(), QPointF()); QCOMPARE(item->matrix(), QMatrix()); @@ -1125,11 +1122,11 @@ void tst_QGraphicsItem::visible() scene.addItem(item); QVERIFY(item->isVisible()); - QCOMPARE(scene.itemAt(0, 0), item); + QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item); item->setVisible(false); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(0, 0)).isEmpty()); item->setVisible(true); - QCOMPARE(scene.itemAt(0, 0), item); + QCOMPARE(scene.items(QPointF(0, 0)).value(0, Q_NULLPTR), item); QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress); event.setButton(Qt::LeftButton); @@ -1930,7 +1927,7 @@ protected: { ++hoverOutCount; } }; -void tst_QGraphicsItem::acceptsHoverEvents() +void tst_QGraphicsItem::acceptHoverEvents() { QGraphicsScene scene; HoverItem *item1 = new HoverItem(QRectF(-10, -10, 20, 20)); @@ -1939,10 +1936,10 @@ void tst_QGraphicsItem::acceptsHoverEvents() scene.addItem(item2); item2->setZValue(1); - QVERIFY(!item1->acceptsHoverEvents()); - QVERIFY(!item2->acceptsHoverEvents()); - item1->setAcceptsHoverEvents(true); - item2->setAcceptsHoverEvents(true); + QVERIFY(!item1->acceptHoverEvents()); + QVERIFY(!item2->acceptHoverEvents()); + item1->setAcceptHoverEvents(true); + item2->setAcceptHoverEvents(true); QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove); event.setScenePos(QPointF(-100, -100)); @@ -1953,8 +1950,8 @@ void tst_QGraphicsItem::acceptsHoverEvents() QCOMPARE(item1->hoverInCount, 0); QCOMPARE(item2->hoverInCount, 1); - item1->setAcceptsHoverEvents(false); - item2->setAcceptsHoverEvents(false); + item1->setAcceptHoverEvents(false); + item2->setAcceptHoverEvents(false); event.setScenePos(QPointF(-100, -100)); QApplication::sendEvent(&scene, &event); @@ -1964,8 +1961,8 @@ void tst_QGraphicsItem::acceptsHoverEvents() QCOMPARE(item1->hoverInCount, 0); QCOMPARE(item2->hoverInCount, 1); - item1->setAcceptsHoverEvents(true); - item2->setAcceptsHoverEvents(false); + item1->setAcceptHoverEvents(true); + item2->setAcceptHoverEvents(false); event.setScenePos(QPointF(-100, -100)); QApplication::sendEvent(&scene, &event); @@ -2168,27 +2165,27 @@ void tst_QGraphicsItem::matrix() line.resetMatrix(); QCOMPARE(line.matrix(), QMatrix()); - line.rotate(90); + line.setTransform(QTransform().rotate(90), true); QCOMPARE(line.matrix(), QMatrix().rotate(90)); - line.rotate(90); + line.setTransform(QTransform().rotate(90), true); QCOMPARE(line.matrix(), QMatrix().rotate(90).rotate(90)); line.resetMatrix(); - line.scale(2, 4); + line.setTransform(QTransform::fromScale(2, 4), true); QCOMPARE(line.matrix(), QMatrix().scale(2, 4)); - line.scale(2, 4); + line.setTransform(QTransform::fromScale(2, 4), true); QCOMPARE(line.matrix(), QMatrix().scale(2, 4).scale(2, 4)); line.resetMatrix(); - line.shear(2, 4); + line.setTransform(QTransform().shear(2, 4), true); QCOMPARE(line.matrix(), QMatrix().shear(2, 4)); - line.shear(2, 4); + line.setTransform(QTransform().shear(2, 4), true); QCOMPARE(line.matrix(), QMatrix().shear(2, 4).shear(2, 4)); line.resetMatrix(); - line.translate(10, 10); + line.setTransform(QTransform::fromTranslate(10, 10), true); QCOMPARE(line.matrix(), QMatrix().translate(10, 10)); - line.translate(10, 10); + line.setTransform(QTransform::fromTranslate(10, 10), true); QCOMPARE(line.matrix(), QMatrix().translate(10, 10).translate(10, 10)); line.resetMatrix(); } @@ -2201,15 +2198,15 @@ void tst_QGraphicsItem::sceneMatrix() QCOMPARE(parent->sceneMatrix(), QMatrix()); QCOMPARE(child->sceneMatrix(), QMatrix()); - parent->translate(10, 10); + parent->setTransform(QTransform::fromTranslate(10, 10), true); QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10)); QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10)); - child->translate(10, 10); + child->setTransform(QTransform::fromTranslate(10, 10), true); QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10)); QCOMPARE(child->sceneMatrix(), QMatrix().translate(20, 20)); - parent->rotate(90); + parent->setTransform(QTransform().rotate(90), true); QCOMPARE(parent->sceneMatrix(), QMatrix().translate(10, 10).rotate(90)); QCOMPARE(child->sceneMatrix(), QMatrix().translate(10, 10).rotate(90).translate(10, 10)); @@ -2645,7 +2642,7 @@ void tst_QGraphicsItem::isObscuredBy() MyItem myitem1, myitem2; myitem1.setRect(QRectF(50, 50, 40, 200)); - myitem1.rotate(67); + myitem1.setTransform(QTransform().rotate(67), true); myitem2.setRect(QRectF(25, 25, 20, 20)); myitem2.setZValue(-1.0); @@ -3272,7 +3269,7 @@ void tst_QGraphicsItem::hoverEventsGenerateRepaints() EventTester *tester = new EventTester; scene.addItem(tester); - tester->setAcceptsHoverEvents(true); + tester->setAcceptHoverEvents(true); QTRY_COMPARE(tester->repaints, 1); @@ -3364,7 +3361,7 @@ void tst_QGraphicsItem::sceneBoundingRect() QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100)); QCOMPARE(item->sceneBoundingRect(), QRectF(100, 100, 100, 100)); - item->rotate(90); + item->setTransform(QTransform().rotate(90), true); QCOMPARE(item->boundingRect(), QRectF(0, 0, 100, 100)); QCOMPARE(item->sceneBoundingRect(), QRectF(0, 100, 100, 100)); @@ -3392,7 +3389,7 @@ void tst_QGraphicsItem::childrenBoundingRect() QGraphicsRectItem *childChild = scene.addRect(QRectF(0, 0, 100, 100), QPen(Qt::black, 0)); childChild->setParentItem(child); childChild->setPos(500, 500); - child->rotate(90); + child->setTransform(QTransform().rotate(90), true); scene.addPolygon(parent->mapToScene(parent->boundingRect() | parent->childrenBoundingRect()))->setPen(QPen(Qt::red));; @@ -3440,11 +3437,11 @@ void tst_QGraphicsItem::childrenBoundingRectTransformed() QCOMPARE(subTreeRect.width(), qreal(351.7766952966369)); QCOMPARE(subTreeRect.height(), qreal(251.7766952966369)); - rect->rotate(45); - rect2->rotate(-45); - rect3->rotate(45); - rect4->rotate(-45); - rect5->rotate(45); + rect->setTransform(QTransform().rotate(45), true); + rect2->setTransform(QTransform().rotate(-45), true); + rect3->setTransform(QTransform().rotate(45), true); + rect4->setTransform(QTransform().rotate(-45), true); + rect5->setTransform(QTransform().rotate(45), true); subTreeRect = rect->childrenBoundingRect(); QCOMPARE(rect->childrenBoundingRect(), QRectF(-100, 75, 275, 250)); @@ -3566,7 +3563,7 @@ void tst_QGraphicsItem::group() QGraphicsRectItem *child = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::blue)); QGraphicsRectItem *parent2 = scene.addRect(QRectF(0, 0, 50, 50), QPen(Qt::black, 0), QBrush(Qt::red)); parent2->setPos(-50, 50); - child->rotate(45); + child->setTransform(QTransform().rotate(45), true); child->setParentItem(parent); parent->setPos(25, 25); child->setPos(25, 25); @@ -3615,7 +3612,7 @@ void tst_QGraphicsItem::group() newItems << item; item->setPos(-1000 + rand() % 2000, -1000 + rand() % 2000); - item->rotate(rand() % 90); + item->setTransform(QTransform().rotate(rand() % 90), true); } view.fitInView(scene.itemsBoundingRect()); @@ -3658,8 +3655,8 @@ void tst_QGraphicsItem::setGroup2() rect->setTransformOriginPoint(50,50); rect->setRotation(45); rect->setScale(1.5); - rect->translate(20,20); - group.translate(-30,-40); + rect->setTransform(QTransform::fromTranslate(20,20), true); + group.setTransform(QTransform::fromTranslate(-30, -40), true); group.setRotation(180); group.setScale(0.5); @@ -3712,7 +3709,7 @@ void tst_QGraphicsItem::warpChildrenIntoGroup() QGraphicsScene scene; QGraphicsRectItem *parentRectItem = scene.addRect(QRectF(0, 0, 100, 100)); QGraphicsRectItem *childRectItem = scene.addRect(QRectF(0, 0, 100, 100)); - parentRectItem->rotate(90); + parentRectItem->setTransform(QTransform().rotate(90), true); childRectItem->setPos(-50, -25); childRectItem->setParentItem(parentRectItem); @@ -3721,7 +3718,7 @@ void tst_QGraphicsItem::warpChildrenIntoGroup() QGraphicsRectItem *parentOfGroup = scene.addRect(QRectF(0, 0, 100, 100)); parentOfGroup->setPos(-200, -200); - parentOfGroup->scale(2, 2); + parentOfGroup->setTransform(QTransform::fromScale(2, 2), true); QGraphicsItemGroup *group = new QGraphicsItemGroup; group->setPos(50, 50); @@ -4129,9 +4126,9 @@ public: font.setPointSize(4); painter->setFont(font); for (int x = -100; x < 100; x += 25) { - for (int y = -100; y < 100; y += 25) { - painter->drawText(QRectF(x, y, 25, 25), Qt::AlignCenter, QString("%1x%2").arg(x).arg(y)); - } + const QString prefix = QString::number(x) + QLatin1Char('x'); + for (int y = -100; y < 100; y += 25) + painter->drawText(QRectF(x, y, 25, 25), Qt::AlignCenter, prefix + QString::number(y)); } } }; @@ -4634,7 +4631,7 @@ void tst_QGraphicsItem::itemChange() // ItemTransformChange / ItemTransformHasChanged tester.itemChangeReturnValue.setValue<QTransform>(QTransform().rotate(90)); - tester.translate(50, 0); + tester.setTransform(QTransform::fromTranslate(50, 0), true); ++changeCount; // notification sent too ++changeCount; QCOMPARE(tester.changes.size(), changeCount); @@ -5197,6 +5194,7 @@ public: } protected: +#ifndef QT_NO_CONTEXTMENU void contextMenuEvent(QGraphicsSceneContextMenuEvent *) { if (harakiri == 3) { @@ -5204,6 +5202,7 @@ protected: delete this; } } +#endif // QT_NO_CONTEXTMENU void dragEnterEvent(QGraphicsSceneDragDropEvent *event) { @@ -5366,7 +5365,7 @@ void tst_QGraphicsItem::deleteItemInEventHandlers() for (int i = 0; i < 17; ++i) { QGraphicsScene scene; HarakiriItem *item = new HarakiriItem(i); - item->setAcceptsHoverEvents(true); + item->setAcceptHoverEvents(true); item->setFlag(QGraphicsItem::ItemIsFocusable); scene.addItem(item); @@ -5382,11 +5381,13 @@ void tst_QGraphicsItem::deleteItemInEventHandlers() if (!item->dead) scene.advance(); +#ifndef QT_NO_CONTEXTMENU if (!item->dead) { QContextMenuEvent event(QContextMenuEvent::Other, view.mapFromScene(item->scenePos())); QCoreApplication::sendEvent(view.viewport(), &event); } +#endif // QT_NO_CONTEXTMENU if (!item->dead) QTest::mouseMove(view.viewport(), view.mapFromScene(item->scenePos())); if (!item->dead) @@ -5518,16 +5519,16 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2() QGraphicsScene scene; scene.addItem(parent); - QCOMPARE(scene.itemAt(5, 5), (QGraphicsItem *)parent); - QCOMPARE(scene.itemAt(15, 5), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(5, 15), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(60, 60), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(140, 60), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(60, 140), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(140, 140), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(75, 75), (QGraphicsItem *)child2); - QCOMPARE(scene.itemAt(75, 100), (QGraphicsItem *)child1); - QCOMPARE(scene.itemAt(100, 75), (QGraphicsItem *)child1); + QCOMPARE(scene.items(QPointF(5, 5)).value(0, Q_NULLPTR), (QGraphicsItem *)parent); + QVERIFY(scene.items(QPointF(15, 5)).isEmpty()); + QVERIFY(scene.items(QPointF(5, 15)).isEmpty()); + QVERIFY(scene.items(QPointF(60, 60)).isEmpty()); + QVERIFY(scene.items(QPointF(140, 60)).isEmpty()); + QVERIFY(scene.items(QPointF(60, 140)).isEmpty()); + QVERIFY(scene.items(QPointF(140, 140)).isEmpty()); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child2); + QCOMPARE(scene.items(QPointF(75, 100)).value(0, Q_NULLPTR), (QGraphicsItem *)child1); + QCOMPARE(scene.items(QPointF(100, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child1); QImage image(100, 100, QImage::Format_ARGB32_Premultiplied); image.fill(0); @@ -5562,20 +5563,20 @@ void tst_QGraphicsItem::itemClipsChildrenToShape3() grandchild->setPos( 50, 50 ); parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)parent); - QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)child); - QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0); + QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)parent); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)child); + QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); + QVERIFY(scene.items(QPointF(175, 175)).isEmpty()); // Move child to fully overlap the parent. The grandchild should // now occupy two-thirds of the scene child->prepareGeometryChange(); child->setPos( 0, 0 ); - QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)child); - QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0); + QCOMPARE(scene.items(QPointF(25, 25)).value(0, Q_NULLPTR), (QGraphicsItem *)child); + QCOMPARE(scene.items(QPointF(75, 75)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); + QCOMPARE(scene.items(QPointF(125, 125)).value(0, Q_NULLPTR), (QGraphicsItem *)grandchild); + QVERIFY(scene.items(QPointF(175, 175)).isEmpty()); } class MyProxyWidget : public QGraphicsProxyWidget @@ -5847,17 +5848,17 @@ void tst_QGraphicsItem::itemClippingDiscovery() rightRectItem->setParentItem(clipItem); // The rects item are both visible at these points. - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)leftRectItem); - QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)rightRectItem); + QCOMPARE(scene.items(QPointF(10, 10)).value(0, Q_NULLPTR), (QGraphicsItem *)leftRectItem); + QCOMPARE(scene.items(QPointF(90, 90)).value(0, Q_NULLPTR), (QGraphicsItem *)rightRectItem); // The ellipse clips the rects now. clipItem->setFlag(QGraphicsItem::ItemClipsChildrenToShape); // The rect items are no longer visible at these points. - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); if (sizeof(qreal) != sizeof(double)) QSKIP("This fails due to internal rounding errors"); - QCOMPARE(scene.itemAt(90, 90), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(90, 90)).isEmpty()); } class ItemCountsBoundingRectCalls : public QGraphicsRectItem @@ -5888,7 +5889,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() int oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; // First test that both items are searched if no optimization flags are set - QGraphicsItem* item = scene.itemAt(25,5); + QGraphicsItem* item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); QCOMPARE(item, childOutsideShape); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); @@ -5899,7 +5900,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() oldChildBoundingRectCalls = childOutsideShape->boundingRectCalls; // Repeat the test to make sure that no caching/indexing is in effect - item = scene.itemAt(25,5); + item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); QCOMPARE(item, childOutsideShape); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); @@ -5912,7 +5913,7 @@ void tst_QGraphicsItem::itemContainsChildrenInShape() // Set the optimization flag and make sure that the child is not returned // and that the child's boundingRect() method is never called. parent->setFlag(QGraphicsItem::ItemContainsChildrenInShape); - item = scene.itemAt(25,5); + item = scene.items(QPointF(25, 5)).value(0, Q_NULLPTR); QVERIFY(!(item)); QVERIFY(parent->boundingRectCalls > oldParentBoundingRectCalls); @@ -6220,12 +6221,12 @@ void tst_QGraphicsItem::untransformable() QGraphicsItem *item1 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100)); item1->setZValue(1); item1->setFlag(QGraphicsItem::ItemIgnoresTransformations); - item1->rotate(45); + item1->setTransform(QTransform().rotate(45), true); ((QGraphicsEllipseItem *)item1)->setBrush(Qt::red); QGraphicsItem *item2 = new QGraphicsEllipseItem(QRectF(-50, -50, 100, 100)); item2->setParentItem(item1); - item2->rotate(45); + item2->setTransform(QTransform().rotate(45), true); item2->setPos(100, 0); ((QGraphicsEllipseItem *)item2)->setBrush(Qt::green); @@ -6280,6 +6281,7 @@ void tst_QGraphicsItem::untransformable() } } +#ifndef QT_NO_CONTEXTMENU class ContextMenuItem : public QGraphicsRectItem { public: @@ -6343,6 +6345,7 @@ void tst_QGraphicsItem::contextMenuEventPropagation() QCOMPARE(bottomItem->gotEvent, false); QCOMPARE(topItem->eventWasAccepted, true); } +#endif // QT_NO_CONTEXTMENU void tst_QGraphicsItem::itemIsMovable() { @@ -6464,10 +6467,11 @@ void tst_QGraphicsItem::task177918_lineItemUndetected() QGraphicsLineItem *line = scene.addLine(10, 10, 10, 10); QCOMPARE(line->boundingRect(), QRectF(10, 10, 0, 0)); - QVERIFY(!scene.items(9, 9, 2, 2, Qt::IntersectsItemShape).isEmpty()); - QVERIFY(!scene.items(9, 9, 2, 2, Qt::ContainsItemShape).isEmpty()); - QVERIFY(!scene.items(9, 9, 2, 2, Qt::IntersectsItemBoundingRect).isEmpty()); - QVERIFY(!scene.items(9, 9, 2, 2, Qt::ContainsItemBoundingRect).isEmpty()); + const QRectF rect(9, 9, 2, 2); + QVERIFY(!scene.items(rect, Qt::IntersectsItemShape).isEmpty()); + QVERIFY(!scene.items(rect, Qt::ContainsItemShape).isEmpty()); + QVERIFY(!scene.items(rect, Qt::IntersectsItemBoundingRect).isEmpty()); + QVERIFY(!scene.items(rect, Qt::ContainsItemBoundingRect).isEmpty()); } void tst_QGraphicsItem::task240400_clickOnTextItem_data() @@ -6703,8 +6707,8 @@ void tst_QGraphicsItem::itemTransform_parentChild() QGraphicsItem *child = scene.addRect(0, 0, 100, 100); child->setParentItem(parent); child->setPos(10, 10); - child->scale(2, 2); - child->rotate(90); + child->setTransform(QTransform::fromScale(2, 2), true); + child->setTransform(QTransform().rotate(90), true); QCOMPARE(child->itemTransform(parent).map(QPointF(10, 10)), QPointF(-10, 30)); QCOMPARE(parent->itemTransform(child).map(QPointF(-10, 30)), QPointF(10, 10)); @@ -6716,19 +6720,19 @@ void tst_QGraphicsItem::itemTransform_siblings() QGraphicsItem *parent = scene.addRect(0, 0, 100, 100); QGraphicsItem *brother = scene.addRect(0, 0, 100, 100); QGraphicsItem *sister = scene.addRect(0, 0, 100, 100); - parent->scale(10, 5); - parent->rotate(-180); - parent->shear(2, 3); + parent->setTransform(QTransform::fromScale(10, 5), true); + parent->setTransform(QTransform().rotate(-180), true); + parent->setTransform(QTransform().shear(2, 3), true); brother->setParentItem(parent); sister->setParentItem(parent); brother->setPos(10, 10); - brother->scale(2, 2); - brother->rotate(90); + brother->setTransform(QTransform::fromScale(2, 2), true); + brother->setTransform(QTransform().rotate(90), true); sister->setPos(10, 10); - sister->scale(2, 2); - sister->rotate(90); + sister->setTransform(QTransform::fromScale(2, 2), true); + sister->setTransform(QTransform().rotate(90), true); QCOMPARE(brother->itemTransform(sister).map(QPointF(10, 10)), QPointF(10, 10)); QCOMPARE(sister->itemTransform(brother).map(QPointF(10, 10)), QPointF(10, 10)); @@ -6740,11 +6744,11 @@ void tst_QGraphicsItem::itemTransform_unrelated() QGraphicsItem *stranger1 = scene.addRect(0, 0, 100, 100); QGraphicsItem *stranger2 = scene.addRect(0, 0, 100, 100); stranger1->setPos(10, 10); - stranger1->scale(2, 2); - stranger1->rotate(90); + stranger1->setTransform(QTransform::fromScale(2, 2), true); + stranger1->setTransform(QTransform().rotate(90), true); stranger2->setPos(10, 10); - stranger2->scale(2, 2); - stranger2->rotate(90); + stranger2->setTransform(QTransform::fromScale(2, 2), true); + stranger2->setTransform(QTransform().rotate(90), true); QCOMPARE(stranger1->itemTransform(stranger2).map(QPointF(10, 10)), QPointF(10, 10)); QCOMPARE(stranger2->itemTransform(stranger1).map(QPointF(10, 10)), QPointF(10, 10)); @@ -7026,7 +7030,8 @@ void tst_QGraphicsItem::itemStacksBehindParent() paintedItems.clear(); view.viewport()->update(); QApplication::processEvents(); - QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>() + QRectF rect(0, 0, 100, 100); + QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>() << grandChild111 << child11 << grandChild121 << child12 << parent1 << grandChild211 << child21 @@ -7042,7 +7047,7 @@ void tst_QGraphicsItem::itemStacksBehindParent() paintedItems.clear(); QApplication::processEvents(); - QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>() + QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>() << grandChild121 << child12 << parent1 << grandChild111 << child11 << grandChild211 << child21 @@ -7058,7 +7063,7 @@ void tst_QGraphicsItem::itemStacksBehindParent() scene.update(); QApplication::processEvents(); - QTRY_COMPARE(scene.items(0, 0, 100, 100), (QList<QGraphicsItem *>() + QTRY_COMPARE(scene.items(rect), (QList<QGraphicsItem *>() << parent1 << grandChild111 << child11 << grandChild121 << child12 << grandChild211 << child21 @@ -7226,12 +7231,12 @@ void tst_QGraphicsItem::sceneTransformCache() QGraphicsRectItem *rect2 = scene.addRect(0, 0, 100, 100); rect2->setPen(QPen(Qt::black, 0)); rect2->setParentItem(rect.data()); - rect2->rotate(90); - rect->translate(0, 50); + rect2->setTransform(QTransform().rotate(90), true); + rect->setTransform(QTransform::fromTranslate(0, 50), true); QGraphicsView view(&scene); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - rect->translate(0, 100); + rect->setTransform(QTransform::fromTranslate(0, 100), true); QTransform x; x.translate(0, 150); x.rotate(90); @@ -7395,14 +7400,14 @@ void tst_QGraphicsItem::cacheMode() QCOMPARE(testerChild2->repaints, 2); // Translating does not result in a repaint. - tester->translate(10, 10); + tester->setTransform(QTransform::fromTranslate(10, 10), true); QTest::qWait(25); QTRY_COMPARE(tester->repaints, 2); QCOMPARE(testerChild->repaints, 2); QCOMPARE(testerChild2->repaints, 2); // Rotating results in a repaint. - tester->rotate(45); + tester->setTransform(QTransform().rotate(45), true); QTest::qWait(25); QTRY_COMPARE(tester->repaints, 3); QCOMPARE(testerChild->repaints, 3); @@ -7418,9 +7423,9 @@ void tst_QGraphicsItem::cacheMode() QCOMPARE(testerChild2->repaints, 3); // Rotating items with ItemCoordinateCache doesn't cause a repaint. - tester->rotate(22); - testerChild->rotate(22); - testerChild2->rotate(22); + tester->setTransform(QTransform().rotate(22), true); + testerChild->setTransform(QTransform().rotate(22), true); + testerChild2->setTransform(QTransform().rotate(22), true); QTest::qWait(25); QTRY_COMPARE(tester->repaints, 4); QTRY_COMPARE(testerChild->repaints, 4); @@ -7653,7 +7658,9 @@ public: void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0) { QGraphicsRectItem::paint(painter, option, widget); - painter->drawText(boundingRect(), Qt::AlignCenter, QString("%1x%2\n%3x%4").arg(p.x()).arg(p.y()).arg(sp.x()).arg(sp.y())); + const QString text = QString::number(p.x()) + QLatin1Char('x') + QString::number(p.y()) + + QLatin1Char('\n') + QString::number(sp.x()) + QLatin1Char('x') + QString::number(sp.y()); + painter->drawText(boundingRect(), Qt::AlignCenter, text); } protected: @@ -7733,9 +7740,9 @@ void tst_QGraphicsItem::deviceTransform() rect1->setPos(100, 100); rect2->setPos(100, 100); rect3->setPos(100, 100); - rect1->rotate(rotation1); - rect2->rotate(rotation2); - rect3->rotate(rotation3); + rect1->setTransform(QTransform().rotate(rotation1), true); + rect2->setTransform(QTransform().rotate(rotation2), true); + rect3->setTransform(QTransform().rotate(rotation3), true); rect1->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable1); rect2->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable2); rect3->setFlag(QGraphicsItem::ItemIgnoresTransformations, untransformable3); @@ -7868,14 +7875,14 @@ void tst_QGraphicsItem::update() expectedRegion = itemDeviceBoundingRect.adjusted(-2, -2, 2, 2); view.reset(); item->repaints = 0; - parent->translate(-400, 0); + parent->setTransform(QTransform::fromTranslate(-400, 0), true); qApp->processEvents(); QCOMPARE(item->repaints, 0); QCOMPARE(view.repaints, 1); QCOMPARE(view.paintedRegion, expectedRegion); view.reset(); item->repaints = 0; - parent->translate(400, 0); + parent->setTransform(QTransform::fromTranslate(400, 0), true); qApp->processEvents(); QCOMPARE(item->repaints, 1); QCOMPARE(view.repaints, 1); @@ -8175,7 +8182,7 @@ void tst_QGraphicsItem::moveItem() RESET_COUNTERS - parent->translate(20, 20); + parent->setTransform(QTransform::fromTranslate(20, 20), true); qApp->processEvents(); QCOMPARE(parent->repaints, 1); QCOMPARE(child->repaints, 1); @@ -8241,10 +8248,11 @@ void tst_QGraphicsItem::sorting() QGraphicsScene scene; QGraphicsItem *grid[100][100]; for (int x = 0; x < 100; ++x) { + const QString prefix = QString::number(x) + QLatin1Char('x'); for (int y = 0; y < 100; ++y) { PainterItem *item = new PainterItem; item->setPos(x * 25, y * 25); - item->setData(0, QString("%1x%2").arg(x).arg(y)); + item->setData(0, prefix + QString::number(y)); grid[x][y] = item; scene.addItem(item); } @@ -11646,12 +11654,12 @@ void tst_QGraphicsItem::QTBUG_21618_untransformable_sceneTransform() QGraphicsItem *item1 = scene.addRect(0, 0, 100, 100, QPen(), Qt::red); item1->setPos(50, 50); - item1->translate(50, 50); - item1->rotate(90); + item1->setTransform(QTransform::fromTranslate(50, 50), true); + item1->setTransform(QTransform().rotate(90), true); QGraphicsItem *item2 = scene.addRect(0, 0, 100, 100, QPen(), Qt::green); item2->setPos(50, 50); - item2->translate(50, 50); - item2->rotate(90); + item2->setTransform(QTransform::fromTranslate(50, 50), true); + item2->setTransform(QTransform().rotate(90), true); item2->setFlags(QGraphicsItem::ItemIgnoresTransformations); QGraphicsRectItem *item1_topleft = new QGraphicsRectItem(QRectF(-2, -2, 4, 4)); diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro index 484f4ba5f8..3515d259d0 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/qgraphicsitemanimation.pro @@ -3,5 +3,4 @@ TARGET = tst_qgraphicsitemanimation QT += widgets testlib SOURCES += tst_qgraphicsitemanimation.cpp DEFINES += QT_NO_CAST_TO_ASCII -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp index df826da0c5..acdd3cff81 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitemanimation/tst_qgraphicsitemanimation.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/graphicsview/qgraphicslayout/qgraphicslayout.pro b/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro index 254a91ef6a..1be43692d5 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro +++ b/tests/auto/widgets/graphicsview/qgraphicslayout/qgraphicslayout.pro @@ -7,4 +7,3 @@ TARGET = tst_qgraphicslayout QT += widgets testlib SOURCES += tst_qgraphicslayout.cpp DEFINES += QT_USE_USING_NAMESPACE -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp index a2740edc54..87cd032ad0 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslayout/tst_qgraphicslayout.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/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro index ef5cc36d05..e4a970201a 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/qgraphicslayoutitem.pro @@ -2,5 +2,4 @@ CONFIG += testcase TARGET = tst_qgraphicslayoutitem QT += widgets testlib SOURCES += tst_qgraphicslayoutitem.cpp -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp index c291f09def..9b52366855 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslayoutitem/tst_qgraphicslayoutitem.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$ ** @@ -40,12 +35,6 @@ class tst_QGraphicsLayoutItem : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void qgraphicslayoutitem(); @@ -96,28 +85,6 @@ public: }; -// This will be called before the first test function is executed. -// It is only called once. -void tst_QGraphicsLayoutItem::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsLayoutItem::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsLayoutItem::init() -{ -} - -// This will be called after every test function. -void tst_QGraphicsLayoutItem::cleanup() -{ -} - void tst_QGraphicsLayoutItem::qgraphicslayoutitem() { SubQGraphicsLayoutItem layoutItem; @@ -146,7 +113,7 @@ void tst_QGraphicsLayoutItem::effectiveSizeHint_data() QTest::addColumn<Qt::SizeHint>("sizeHint"); QTest::addColumn<QSizeF>("constraint"); for (int i = 0; i < 15; ++i) { - QTestData &data = QTest::newRow(QString("%1").arg(i).toLatin1()); + QTestData &data = QTest::newRow(QByteArray::number(i).constData()); switch(i % 5) { case 0: data << Qt::MinimumSize; break; case 1: data << Qt::PreferredSize; break; diff --git a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp index 7b2b301b80..5794c32803 100644 --- a/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.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$ ** @@ -45,13 +40,8 @@ class tst_QGraphicsLinearLayout : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: + void initTestCase(); void qgraphicslinearlayout_data(); void qgraphicslinearlayout(); @@ -150,22 +140,6 @@ void tst_QGraphicsLinearLayout::initTestCase() QApplication::setStyle("windows"); } -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsLinearLayout::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsLinearLayout::init() -{ -} - -// This will be called after every test function. -void tst_QGraphicsLinearLayout::cleanup() -{ -} - class RectWidget : public QGraphicsWidget { public: @@ -424,10 +398,11 @@ void tst_QGraphicsLinearLayout::dump_data() QTest::addColumn<int>("itemCount"); QTest::addColumn<int>("layoutCount"); for (int i = -1; i < 3; ++i) { - QTest::newRow(QString("%1, 0, 0").arg(i).toLatin1()) << 0 << 0; - QTest::newRow(QString("%1, 0, 5").arg(i).toLatin1()) << 5 << 5; - QTest::newRow(QString("%1, 5, 0").arg(i).toLatin1()) << 5 << 5; - QTest::newRow(QString("%1, 5, 5").arg(i).toLatin1()) << 5 << 5; + const QByteArray iB = QByteArray::number(i); + QTest::newRow((iB + ", 0, 0").constData()) << 0 << 0; + QTest::newRow((iB + ", 0, 5").constData()) << 5 << 5; + QTest::newRow((iB + ", 5, 0").constData()) << 5 << 5; + QTest::newRow((iB + ", 5, 5").constData()) << 5 << 5; } } @@ -510,11 +485,13 @@ void tst_QGraphicsLinearLayout::insertItem_data() QTest::addColumn<int>("insertItemAt"); QTest::addColumn<bool>("isWidget"); for (int i = -1; i < 4; ++i) { + const QByteArray iB = QByteArray::number(i); for (int j = 0; j < 2; ++j) { - QTest::newRow(QString("0, 0, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 0 << i << (bool)j; - QTest::newRow(QString("1, 0, %1 %2").arg(i).arg(j).toLatin1()) << 1 << 0 << i << (bool)j; - QTest::newRow(QString("0, 1, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 1 << i << (bool)j; - QTest::newRow(QString("2, 2, %1 %2").arg(i).arg(j).toLatin1()) << 2 << 2 << i << (bool)j; + const QByteArray postFix = iB + ' ' + QByteArray::number(j); + QTest::newRow(("0, 0, " + postFix).constData()) << 0 << 0 << i << (bool)j; + QTest::newRow(("1, 0, " + postFix).constData()) << 1 << 0 << i << (bool)j; + QTest::newRow(("0, 1, " + postFix).constData()) << 0 << 1 << i << (bool)j; + QTest::newRow(("2, 2, " + postFix).constData()) << 2 << 2 << i << (bool)j; } } } @@ -564,11 +541,13 @@ void tst_QGraphicsLinearLayout::insertStretch_data() QTest::addColumn<int>("insertItemAt"); QTest::addColumn<int>("stretch"); for (int i = -1; i < 4; ++i) { + const QByteArray iB = QByteArray::number(i); for (int j = 0; j < 2; ++j) { - QTest::newRow(QString("0, 0, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 0 << i << j; - QTest::newRow(QString("1, 0, %1 %2").arg(i).arg(j).toLatin1()) << 1 << 0 << i << j; - QTest::newRow(QString("0, 1, %1 %2").arg(i).arg(j).toLatin1()) << 0 << 1 << i << j; - QTest::newRow(QString("2, 2, %1 %2").arg(i).arg(j).toLatin1()) << 2 << 2 << i << j; + const QByteArray postFix = iB + ' ' + QByteArray::number(j); + QTest::newRow(("0, 0, " + postFix).constData()) << 0 << 0 << i << j; + QTest::newRow(("1, 0, " + postFix).constData()) << 1 << 0 << i << j; + QTest::newRow(("0, 1, " + postFix).constData()) << 0 << 1 << i << j; + QTest::newRow(("2, 2, " + postFix).constData()) << 2 << 2 << i << j; } } } @@ -785,12 +764,13 @@ void tst_QGraphicsLinearLayout::removeAt_data() QTest::addColumn<int>("removeItemAt"); QTest::addColumn<Qt::Orientation>("orientation"); for (int i = -1; i < 4; ++i) { + const QByteArray iB = QByteArray::number(i); for (int k = 0; k < 2; ++k) { Qt::Orientation orientation = (k == 0) ? Qt::Vertical : Qt::Horizontal; - QTest::newRow(QString("0, 0, %1").arg(i).toLatin1()) << 0 << 0 << i << orientation; - QTest::newRow(QString("1, 0, %1").arg(i).toLatin1()) << 1 << 0 << i << orientation; - QTest::newRow(QString("0, 1, %1").arg(i).toLatin1()) << 0 << 1 << i << orientation; - QTest::newRow(QString("2, 2, %1").arg(i).toLatin1()) << 2 << 2 << i << orientation; + QTest::newRow(("0, 0, " + iB).constData()) << 0 << 0 << i << orientation; + QTest::newRow(("1, 0, " + iB).constData()) << 1 << 0 << i << orientation; + QTest::newRow(("0, 1, " + iB).constData()) << 0 << 1 << i << orientation; + QTest::newRow(("2, 2, " + iB).constData()) << 2 << 2 << i << orientation; } } } @@ -839,10 +819,11 @@ void tst_QGraphicsLinearLayout::removeItem_data() QTest::addColumn<int>("layoutCount"); QTest::addColumn<int>("removeItemAt"); for (int i = -1; i < 4; ++i) { - QTest::newRow(QString("0, 0, %1").arg(i).toLatin1()) << 0 << 0 << i; - QTest::newRow(QString("1, 0, %1").arg(i).toLatin1()) << 1 << 0 << i; - QTest::newRow(QString("0, 1, %1").arg(i).toLatin1()) << 0 << 1 << i; - QTest::newRow(QString("2, 2, %1").arg(i).toLatin1()) << 2 << 2 << i; + const QByteArray iB = QByteArray::number(i); + QTest::newRow(("0, 0, " + iB).constData()) << 0 << 0 << i; + QTest::newRow(("1, 0, " + iB).constData()) << 1 << 0 << i; + QTest::newRow(("0, 1, " + iB).constData()) << 0 << 1 << i; + QTest::newRow(("2, 2, " + iB).constData()) << 2 << 2 << i; } } diff --git a/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro b/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro index 60f09c2228..483f123fa7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsobject/qgraphicsobject.pro @@ -5,4 +5,3 @@ QT += widgets testlib QT += core-private SOURCES += tst_qgraphicsobject.cpp -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp index 0f9e8c101e..6ef17a14af 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsobject/tst_qgraphicsobject.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$ ** @@ -43,12 +38,6 @@ class tst_QGraphicsObject : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void pos(); void x(); @@ -60,30 +49,6 @@ private slots: void deleted(); }; - -// This will be called before the first test function is executed. -// It is only called once. -void tst_QGraphicsObject::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsObject::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsObject::init() -{ -} - -// This will be called after every test function. -void tst_QGraphicsObject::cleanup() -{ -} - - class MyGraphicsObject : public QGraphicsObject { public: diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro index 6452e39c56..123f1050ec 100644 --- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/qgraphicspixmapitem.pro @@ -2,5 +2,4 @@ CONFIG += testcase TARGET = tst_qgraphicspixmapitem QT += widgets testlib SOURCES += tst_qgraphicspixmapitem.cpp -CONFIG += parallel_test diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp index 774a41b212..78fe448bdb 100644 --- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.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$ ** @@ -40,12 +35,6 @@ class tst_QGraphicsPixmapItem : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void qgraphicspixmapitem_data(); void qgraphicspixmapitem(); @@ -102,28 +91,6 @@ public: { return SubQGraphicsPixmapItem::supportsExtension((QGraphicsItem::Extension)extension); } }; -// This will be called before the first test function is executed. -// It is only called once. -void tst_QGraphicsPixmapItem::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsPixmapItem::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsPixmapItem::init() -{ -} - -// This will be called after every test function. -void tst_QGraphicsPixmapItem::cleanup() -{ -} - void tst_QGraphicsPixmapItem::qgraphicspixmapitem_data() { } diff --git a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro index bca0ecc20c..89847e9ed2 100644 --- a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro +++ b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/qgraphicspolygonitem.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_qgraphicspolygonitem QT += widgets testlib SOURCES += tst_qgraphicspolygonitem.cpp -CONFIG += parallel_test - diff --git a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp index 376846471b..fbdd38804d 100644 --- a/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicspolygonitem/tst_qgraphicspolygonitem.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$ ** @@ -41,12 +36,6 @@ class tst_QGraphicsPolygonItem : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void qgraphicspolygonitem_data(); void qgraphicspolygonitem(); @@ -98,28 +87,6 @@ public: { return SubQGraphicsPolygonItem::supportsExtension((QGraphicsItem::Extension)extension); } }; -// This will be called before the first test function is executed. -// It is only called once. -void tst_QGraphicsPolygonItem::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsPolygonItem::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsPolygonItem::init() -{ -} - -// This will be called after every test function. -void tst_QGraphicsPolygonItem::cleanup() -{ -} - void tst_QGraphicsPolygonItem::qgraphicspolygonitem_data() { } diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST index 373343fa22..16f3534921 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/BLACKLIST @@ -1,5 +1,6 @@ [hoverEnterLeaveEvent] ubuntu-14.04 rhel-7.1 +rhel-7.2 [QTBUG_6986_sendMouseEventToAlienWidget] rhel-7.1 diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro index 38fef51394..e7bcccb495 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/qgraphicsproxywidget.pro @@ -6,4 +6,3 @@ QT += core-private gui-private SOURCES += tst_qgraphicsproxywidget.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 7375513303..491dda9f9e 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.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$ ** @@ -84,13 +79,9 @@ class tst_QGraphicsProxyWidget : public QObject { Q_OBJECT -public slots: +private slots: void initTestCase(); - void cleanupTestCase(); - void init(); void cleanup(); - -private slots: void qgraphicsproxywidget_data(); void qgraphicsproxywidget(); void paint(); @@ -162,7 +153,9 @@ private slots: void fontPropagation(); void dontCrashWhenDie(); void createProxyForChildWidget(); +#ifndef QT_NO_CONTEXTMENU void actionsContextMenu(); +#endif // QT_NO_CONTEXTMENU void actionsContextMenu_data(); void deleteProxyForChildWidget(); void bypassGraphicsProxyWidget_data(); @@ -287,17 +280,7 @@ void tst_QGraphicsProxyWidget::initTestCase() QApplication::setEffectEnabled(Qt::UI_AnimateMenu, false); // Disable combo for QTBUG_43780_visibility()/Windows Vista. QApplication::setEffectEnabled(Qt::UI_AnimateCombo, false); -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsProxyWidget::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsProxyWidget::init() -{ + QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs); } // This will be called after every test function. @@ -493,7 +476,7 @@ void tst_QGraphicsProxyWidget::setWidget() QCOMPARE(proxy->rect().toRect(), widget->rect()); QCOMPARE(proxy->focusPolicy(), Qt::WheelFocus); QVERIFY(proxy->acceptDrops()); - QCOMPARE(proxy->acceptsHoverEvents(), true); // to get widget enter events + QCOMPARE(proxy->acceptHoverEvents(), true); // to get widget enter events int left, top, right, bottom; widget->getContentsMargins(&left, &top, &right, &bottom); qreal rleft, rtop, rright, rbottom; @@ -542,14 +525,15 @@ void tst_QGraphicsProxyWidget::testEventFilter_data() QTest::newRow("none") << QEvent::None << false; for (int i = 0; i < 2; ++i) { bool fromObject = (i == 0); - QTest::newRow(QString("resize %1").arg(fromObject).toLatin1()) << QEvent::Resize << fromObject; - QTest::newRow(QString("move %1").arg(fromObject).toLatin1()) << QEvent::Move << fromObject; - QTest::newRow(QString("hide %1").arg(fromObject).toLatin1()) << QEvent::Hide << fromObject; - QTest::newRow(QString("show %1").arg(fromObject).toLatin1()) << QEvent::Show << fromObject; - QTest::newRow(QString("enabled %1").arg(fromObject).toLatin1()) << QEvent::EnabledChange << fromObject; - QTest::newRow(QString("focusIn %1").arg(fromObject).toLatin1()) << QEvent::FocusIn << fromObject; - QTest::newRow(QString("focusOut %1").arg(fromObject).toLatin1()) << QEvent::FocusOut << fromObject; - QTest::newRow(QString("keyPress %1").arg(fromObject).toLatin1()) << QEvent::KeyPress << fromObject; + const char fromObjectC = fromObject ? '1' : '0'; + QTest::newRow((QByteArrayLiteral("resize ") + fromObjectC).constData()) << QEvent::Resize << fromObject; + QTest::newRow((QByteArrayLiteral("move ") + fromObjectC).constData()) << QEvent::Move << fromObject; + QTest::newRow((QByteArrayLiteral("hide ") + fromObjectC).constData()) << QEvent::Hide << fromObject; + QTest::newRow((QByteArrayLiteral("show ") + fromObjectC).constData()) << QEvent::Show << fromObject; + QTest::newRow((QByteArrayLiteral("enabled ") + fromObjectC).constData()) << QEvent::EnabledChange << fromObject; + QTest::newRow((QByteArrayLiteral("focusIn ") + fromObjectC).constData()) << QEvent::FocusIn << fromObject; + QTest::newRow((QByteArrayLiteral("focusOut ") + fromObjectC).constData()) << QEvent::FocusOut << fromObject; + QTest::newRow((QByteArrayLiteral("keyPress ") + fromObjectC).constData()) << QEvent::KeyPress << fromObject; } } @@ -761,8 +745,10 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild_data() bool hasWidget = (j == 0); bool hasScene = (k == 0); bool result = hasScene && hasWidget; - QString name = QString("Forward: %1, hasWidget: %2, hasScene: %3, result: %4").arg(next).arg(hasWidget).arg(hasScene).arg(result); - QTest::newRow(name.toLatin1()) << hasWidget << hasScene << next << result; + QByteArray name = QByteArrayLiteral("Forward: ") + (next ? '1' : '0') + + ", hasWidget: " + (hasWidget ? '1' : '0') + ", hasScene: " + + (hasScene ? '1' : '0') + ", result: " + (result ? '1' : '0'); + QTest::newRow(name.constData()) << hasWidget << hasScene << next << result; } } } @@ -1027,8 +1013,10 @@ void tst_QGraphicsProxyWidget::hoverMoveEvent_data() bool hoverEnabled = (j == 0); bool mouseTracking = (k == 0); bool mouseDown = (l == 0); - QString name = QString("hasWidget:%1, hover:%2, mouseTracking:%3, mouseDown: %4").arg(hasWidget).arg(hoverEnabled).arg(mouseTracking).arg(mouseDown); - QTest::newRow(name.toLatin1()) << hasWidget << hoverEnabled << mouseTracking << mouseDown; + QByteArray name = QByteArrayLiteral("hasWidget:") + (hasWidget ? '1' : '0') + ", hover:" + + (hoverEnabled ? '1' : '0') + ", mouseTracking:" + + (mouseTracking ? '1' : '0') + ", mouseDown: " + (mouseDown ? '1' : '0'); + QTest::newRow(name.constData()) << hasWidget << hoverEnabled << mouseTracking << mouseDown; } } } @@ -1310,7 +1298,7 @@ void tst_QGraphicsProxyWidget::paintEvent() proxy.paintCount = 0; w->update(); - QTRY_COMPARE(proxy.paintCount, 1); //the widget should have been painted now + QTRY_VERIFY(proxy.paintCount >= 1); //the widget should have been painted now } @@ -3073,6 +3061,7 @@ void tst_QGraphicsProxyWidget::createProxyForChildWidget() delete boxProxy; } +#ifndef QT_NO_CONTEXTMENU class ContextMenuWidget : public QLabel { Q_OBJECT @@ -3121,6 +3110,7 @@ private: bool m_embeddedPopupSet; QTimer *m_timer; }; +#endif // QT_NO_CONTEXTMENU void tst_QGraphicsProxyWidget::actionsContextMenu_data() { @@ -3133,6 +3123,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu_data() QTest::newRow("with actionsContextMenu without focus") << true << false; } +#ifndef QT_NO_CONTEXTMENU void tst_QGraphicsProxyWidget::actionsContextMenu() { QFETCH(bool, hasFocus); @@ -3187,7 +3178,7 @@ void tst_QGraphicsProxyWidget::actionsContextMenu() } } - +#endif // QT_NO_CONTEXTMENU void tst_QGraphicsProxyWidget::deleteProxyForChildWidget() { diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro index 25a43d6821..986ba019b4 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/qgraphicsscene.pro @@ -17,4 +17,5 @@ wince* { DEPLOYMENT += rootFiles renderFiles DEFINES += SRCDIR=\\\".\\\" } -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +RESOURCES += testdata.qrc diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc b/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc new file mode 100644 index 0000000000..07a0579cdc --- /dev/null +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/testdata.qrc @@ -0,0 +1,32 @@ +<RCC> + <qresource prefix="/"> + <file>testData/render/all-all-45-deg-left.png</file> + <file>testData/render/all-all-45-deg-right.png</file> + <file>testData/render/all-all-scale-2x.png</file> + <file>testData/render/all-all-translate-0-50.png</file> + <file>testData/render/all-all-translate-50-0.png</file> + <file>testData/render/all-all-untransformed-clip-ellipse.png</file> + <file>testData/render/all-all-untransformed-clip-rect.png</file> + <file>testData/render/all-all-untransformed.png</file> + <file>testData/render/all-bottomleft-untransformed.png</file> + <file>testData/render/all-bottomright-untransformed.png</file> + <file>testData/render/all-topleft-untransformed.png</file> + <file>testData/render/all-topright-untransformed.png</file> + <file>testData/render/bottom-bottomright-untransformed.png</file> + <file>testData/render/bottom-topleft-untransformed.png</file> + <file>testData/render/bottomleft-all-untransformed.png</file> + <file>testData/render/bottomleft-topleft-untransformed.png</file> + <file>testData/render/bottomright-all-untransformed.png</file> + <file>testData/render/bottomright-topleft-untransformed.png</file> + <file>testData/render/left-bottomright-untransformed.png</file> + <file>testData/render/left-topleft-untransformed.png</file> + <file>testData/render/right-bottomright-untransformed.png</file> + <file>testData/render/right-topleft-untransformed.png</file> + <file>testData/render/top-bottomright-untransformed.png</file> + <file>testData/render/top-topleft-untransformed.png</file> + <file>testData/render/topleft-all-untransformed.png</file> + <file>testData/render/topleft-topleft-untransformed.png</file> + <file>testData/render/topright-all-untransformed.png</file> + <file>testData/render/topright-topleft-untransformed.png</file> + </qresource> +</RCC> diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp index ae71b0412f..a346bb9d1f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.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$ ** @@ -108,7 +103,7 @@ class HoverItem : public QGraphicsRectItem public: HoverItem() : QGraphicsRectItem(QRectF(-10, -10, 20, 20)), isHovered(false) - { setAcceptsHoverEvents(true); } + { setAcceptHoverEvents(true); } bool isHovered; @@ -227,8 +222,10 @@ private slots: void render_data(); void render(); void renderItemsWithNegativeWidthOrHeight(); +#ifndef QT_NO_CONTEXTMENU void contextMenuEvent(); void contextMenuEvent_ItemIgnoresTransformations(); +#endif void update(); void update2(); void views(); @@ -301,11 +298,16 @@ void tst_QGraphicsScene::construction() QVERIFY(scene.items(QPainterPath()).isEmpty()); QTest::ignoreMessage(QtWarningMsg, "QGraphicsScene::collidingItems: cannot find collisions for null item"); QVERIFY(scene.collidingItems(0).isEmpty()); - QVERIFY(!scene.itemAt(QPointF())); + QVERIFY(scene.items(QPointF()).isEmpty()); QVERIFY(scene.selectedItems().isEmpty()); QVERIFY(!scene.focusItem()); } +static inline const QGraphicsItem *itemAt(const QGraphicsScene &scene, qreal x, qreal y) +{ + return scene.items(QPointF(x, y)).value(0, Q_NULLPTR); +} + void tst_QGraphicsScene::sceneRect() { QGraphicsScene scene; @@ -318,8 +320,8 @@ void tst_QGraphicsScene::sceneRect() item->setPos(-5, -5); QCOMPARE(sceneRectChanged.count(), 0); - QCOMPARE(scene.itemAt(0, 0), item); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), item); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); QCOMPARE(sceneRectChanged.count(), 0); QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 10, 10)); QCOMPARE(sceneRectChanged.count(), 1); @@ -334,8 +336,8 @@ void tst_QGraphicsScene::sceneRect() QCOMPARE(sceneRectChanged.count(), 3); QCOMPARE(sceneRectChanged.last().at(0).toRectF(), scene.sceneRect()); - QCOMPARE(scene.itemAt(0, 0), item); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), item); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10)); item->setPos(10, 10); QCOMPARE(scene.sceneRect(), QRectF(-100, -100, 10, 10)); @@ -344,8 +346,8 @@ void tst_QGraphicsScene::sceneRect() scene.setSceneRect(QRectF()); - QCOMPARE(scene.itemAt(10, 10), item); - QCOMPARE(scene.itemAt(20, 20), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 10, 10), item); + QVERIFY(scene.items(QPointF(20, 20)).isEmpty()); QCOMPARE(sceneRectChanged.count(), 4); QCOMPARE(scene.sceneRect(), QRectF(-5, -5, 25, 25)); QCOMPARE(sceneRectChanged.count(), 5); @@ -374,7 +376,7 @@ void tst_QGraphicsScene::itemIndexMethod() for (int x = minX; x < maxX; x += 100) { QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); item->setPos(x, y); - QCOMPARE(scene.itemAt(x, y), item); + QCOMPARE(itemAt(scene, x, y), item); items << item; } } @@ -382,7 +384,7 @@ void tst_QGraphicsScene::itemIndexMethod() int n = 0; for (int y = minY; y < maxY; y += 100) { for (int x = minX; x < maxX; x += 100) - QCOMPARE(scene.itemAt(x, y), items.at(n++)); + QCOMPARE(itemAt(scene, x, y), items.at(n++)); } scene.setItemIndexMethod(QGraphicsScene::NoIndex); @@ -391,7 +393,7 @@ void tst_QGraphicsScene::itemIndexMethod() n = 0; for (int y = minY; y < maxY; y += 100) { for (int x = minX; x < maxX; x += 100) - QCOMPARE(scene.itemAt(x, y), items.at(n++)); + QCOMPARE(itemAt(scene, x, y), items.at(n++)); } scene.setItemIndexMethod(QGraphicsScene::BspTreeIndex); @@ -400,7 +402,7 @@ void tst_QGraphicsScene::itemIndexMethod() n = 0; for (int y = minY; y < maxY; y += 100) { for (int x = minX; x < maxX; x += 100) - QCOMPARE(scene.itemAt(x, y), items.at(n++)); + QCOMPARE(itemAt(scene, x, y), items.at(n++)); } } @@ -439,7 +441,7 @@ void tst_QGraphicsScene::items() items << scene.addRect(QRectF(0, 0, 10, 10)); } QCOMPARE(scene.items().size(), items.size()); - scene.itemAt(0, 0); // trigger indexing + itemAt(scene, 0, 0); // trigger indexing scene.removeItem(items.at(5)); delete items.at(5); @@ -458,8 +460,8 @@ void tst_QGraphicsScene::items() QList<QGraphicsItem *> items; items<<l1<<l2; QCOMPARE(scene.items().size(), items.size()); - QVERIFY(scene.items(-1, -1, 2, 2).contains(l1)); - QVERIFY(scene.items(-1, -1, 2, 2).contains(l2)); + QVERIFY(scene.items(QRectF(-1, -1, 2, 2)).contains(l1)); + QVERIFY(scene.items(QRectF(-1, -1, 2, 2)).contains(l2)); } } @@ -722,7 +724,7 @@ void tst_QGraphicsScene::items_QRectF_2() QGraphicsItem *item = scene.addEllipse(ellipseRect); QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), contained); - item->rotate(45); + item->setTransform(QTransform().rotate(45), true); QCOMPARE(!scene.items(sceneRect, selectionMode).isEmpty(), containedRotated); } @@ -1085,19 +1087,19 @@ void tst_QGraphicsScene::addItem() QTRY_VERIFY(view.repaints > 0); view.repaints = 0; - QCOMPARE(scene.itemAt(0, 0), path); + QCOMPARE(itemAt(scene, 0, 0), path); QGraphicsItem *path2 = new QGraphicsEllipseItem(QRectF(-10, -10, 20, 20)); path2->setPos(100, 100); - QCOMPARE(scene.itemAt(0, 0), path); - QCOMPARE(scene.itemAt(100, 100), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), path); + QVERIFY(scene.items(QPointF(100, 100)).isEmpty()); scene.addItem(path2); // Adding an item should always issue a repaint. QTRY_VERIFY(view.repaints > 0); - QCOMPARE(scene.itemAt(100, 100), path2); + QCOMPARE(itemAt(scene, 100, 100), path2); } { // 2) Create scene, then item, then add item @@ -1109,8 +1111,8 @@ void tst_QGraphicsScene::addItem() path2->setPos(100, 100); scene.addItem(path2); - QCOMPARE(scene.itemAt(0, 0), path); - QCOMPARE(scene.itemAt(100, 100), path2); + QCOMPARE(itemAt(scene, 0, 0), path); + QCOMPARE(itemAt(scene, 100, 100), path2); } } @@ -1123,15 +1125,15 @@ void tst_QGraphicsScene::addEllipse() QCOMPARE(ellipse->pen(), QPen(Qt::red)); QCOMPARE(ellipse->brush(), QBrush(Qt::blue)); QCOMPARE(ellipse->rect(), QRectF(-10, -10, 20, 20)); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)ellipse); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)ellipse); + QVERIFY(scene.items(QPointF(-10, -10)).isEmpty()); + QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)ellipse); + QVERIFY(scene.items(QPointF(-10, 10)).isEmpty()); + QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)ellipse); + QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)ellipse); + QVERIFY(scene.items(QPointF(10, -10)).isEmpty()); + QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)ellipse); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); } void tst_QGraphicsScene::addLine() @@ -1144,15 +1146,15 @@ void tst_QGraphicsScene::addLine() QCOMPARE(line->pos(), QPointF()); QCOMPARE(line->pen(), pen); QCOMPARE(line->line(), QLineF(-10, -10, 20, 20)); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)line); - QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)line); - QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)line); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)line); + QCOMPARE(itemAt(scene, -10, -10), (QGraphicsItem *)line); + QVERIFY(scene.items(QPointF(-9.9, 0)).isEmpty()); + QVERIFY(scene.items(QPointF(-10, 10)).isEmpty()); + QVERIFY(scene.items(QPointF(0, -9.9)).isEmpty()); + QVERIFY(scene.items(QPointF(0, 9.9)).isEmpty()); + QVERIFY(scene.items(QPointF(10, -10)).isEmpty()); + QVERIFY(scene.items(QPointF(9.9, 0)).isEmpty()); + QCOMPARE(itemAt(scene, 10, 10), (QGraphicsItem *)line); } void tst_QGraphicsScene::addPath() @@ -1170,27 +1172,27 @@ void tst_QGraphicsScene::addPath() path->setPen(QPen(Qt::red, 0)); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, 30), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(-9.9, 30), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(9.9, 30), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, 20.1), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(0, 39.9), (QGraphicsItem *)path); - QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-10, 20), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10, 20), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, 30), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, -9.9, 30), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 9.9, 30), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, 20.1), (QGraphicsItem *)path); + QCOMPARE(itemAt(scene, 0, 39.9), (QGraphicsItem *)path); + QVERIFY(scene.items(QPointF(-10, -10)).isEmpty()); + QVERIFY(scene.items(QPointF(10, -10)).isEmpty()); + QVERIFY(scene.items(QPointF(-10, 10)).isEmpty()); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); + QVERIFY(scene.items(QPointF(-10, 20)).isEmpty()); + QVERIFY(scene.items(QPointF(10, 20)).isEmpty()); if (sizeof(qreal) != sizeof(double)) QWARN("Skipping test because of rounding errors when qreal != double"); else - QCOMPARE(scene.itemAt(-10, 30), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(10.1, 30), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(-10, 30)).isEmpty()); + QVERIFY(scene.items(QPointF(10.1, 30)).isEmpty()); } void tst_QGraphicsScene::addPixmap() @@ -1201,16 +1203,17 @@ void tst_QGraphicsScene::addPixmap() QCOMPARE(pixmap->pos(), QPointF()); QCOMPARE(pixmap->pixmap(), pix); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)pixmap); - QCOMPARE(scene.itemAt(pix.width() - 1, 0), (QGraphicsItem *)pixmap); - QCOMPARE(scene.itemAt(0, pix.height() - 1), (QGraphicsItem *)pixmap); - QCOMPARE(scene.itemAt(pix.width() - 1, pix.height() - 1), (QGraphicsItem *)pixmap); - QCOMPARE(scene.itemAt(-1, -1), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(pix.width() - 1, -1), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(-1, pix.height() - 1), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(pix.width(), pix.height()), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, pix.height()), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(pix.width(), 0), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)pixmap); + QCOMPARE(itemAt(scene, pix.width() - 1, 0), (QGraphicsItem *)pixmap); + QCOMPARE(itemAt(scene, 0, pix.height() - 1), (QGraphicsItem *)pixmap); + QCOMPARE(itemAt(scene, pix.width() - 1, pix.height() - 1), (QGraphicsItem *)pixmap); + + QVERIFY(scene.items(QPointF(-1, -1)).isEmpty()); + QVERIFY(scene.items(QPointF(pix.width() - 1, -1)).isEmpty()); + QVERIFY(scene.items(QPointF(-1, pix.height() - 1)).isEmpty()); + QVERIFY(scene.items(QPointF(pix.width(), pix.height())).isEmpty()); + QVERIFY(scene.items(QPointF(0, pix.height())).isEmpty()); + QVERIFY(scene.items(QPointF(pix.width(), 0)).isEmpty()); } void tst_QGraphicsScene::addRect() @@ -1225,15 +1228,15 @@ void tst_QGraphicsScene::addRect() rect->setPen(QPen(Qt::red, 0)); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(-10, -10), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(-9.9, 0), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(-10, 10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(0, -9.9), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(0, 9.9), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(10, -10), (QGraphicsItem *)0); - QCOMPARE(scene.itemAt(9.9, 0), (QGraphicsItem *)rect); - QCOMPARE(scene.itemAt(10, 10), (QGraphicsItem *)0); + QCOMPARE(itemAt(scene, 0, 0), (QGraphicsItem *)rect); + QCOMPARE(itemAt(scene, -10, -10), (QGraphicsItem *)rect); + QCOMPARE(itemAt(scene, -9.9, 0), (QGraphicsItem *)rect); + QVERIFY(scene.items(QPointF(-10, 10)).isEmpty()); + QCOMPARE(itemAt(scene, 0, -9.9), (QGraphicsItem *)rect); + QCOMPARE(itemAt(scene, 0, 9.9), (QGraphicsItem *)rect); + QVERIFY(scene.items(QPointF(10, -10)).isEmpty()); + QCOMPARE(itemAt(scene, 9.9, 0), (QGraphicsItem *)rect); + QVERIFY(scene.items(QPointF(10, 10)).isEmpty()); } void tst_QGraphicsScene::addText() @@ -1247,19 +1250,19 @@ void tst_QGraphicsScene::addText() void tst_QGraphicsScene::removeItem() { -#if defined(Q_OS_WINCE) && !defined(GWES_ICONCURS) +#if (defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)) || defined(Q_OS_ANDROID) QSKIP("No mouse cursor support"); #endif QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10)); - QCOMPARE(scene.itemAt(0, 0), item); // forces indexing + QCOMPARE(itemAt(scene, 0, 0), item); // forces indexing scene.removeItem(item); - QCOMPARE(scene.itemAt(0, 0), (QGraphicsItem *)0); + QVERIFY(scene.items(QPointF(0, 0)).isEmpty()); delete item; QGraphicsItem *item2 = scene.addRect(QRectF(0, 0, 10, 10)); item2->setFlag(QGraphicsItem::ItemIsSelectable); - QCOMPARE(scene.itemAt(0, 0), item2); + QCOMPARE(itemAt(scene, 0, 0), item2); // Removing a selected item QVERIFY(scene.selectedItems().isEmpty()); @@ -1289,7 +1292,7 @@ void tst_QGraphicsScene::removeItem() QTRY_VERIFY(hoverItem->isHovered); scene.removeItem(hoverItem); - hoverItem->setAcceptsHoverEvents(false); + hoverItem->setAcceptHoverEvents(false); scene.addItem(hoverItem); QTRY_VERIFY(!hoverItem->isHovered); } @@ -1801,7 +1804,7 @@ void tst_QGraphicsScene::createItemGroup() scene.destroyItemGroup(group); QGraphicsItemGroup *emptyGroup = scene.createItemGroup(QList<QGraphicsItem *>()); - QCOMPARE(emptyGroup->children(), QList<QGraphicsItem *>()); + QVERIFY(emptyGroup->childItems().isEmpty()); QVERIFY(!emptyGroup->parentItem()); QCOMPARE(emptyGroup->scene(), &scene); } @@ -2140,7 +2143,7 @@ void tst_QGraphicsScene::mouseEventPropagation_mouseMove() { Scene scene; scene.addRect(QRectF(5, 0, 12, 12)); - scene.addRect(QRectF(15, 0, 12, 12))->setAcceptsHoverEvents(true); + scene.addRect(QRectF(15, 0, 12, 12))->setAcceptHoverEvents(true); for (int i = 0; i < 30; ++i) { QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMouseMove); event.setScenePos(QPointF(i, 5)); @@ -2621,8 +2624,7 @@ void tst_QGraphicsScene::render() scene.render(&painter, targetRect, sourceRect, aspectRatioMode); painter.end(); - const QString renderPath = QLatin1String(SRCDIR) + "/testData/render"; - QString fileName = renderPath + QString("/%1.png").arg(QTest::currentDataTag()); + QString fileName = QFINDTESTDATA(QString("/testData/render/%1.png").arg(QTest::currentDataTag())); QImage original(fileName); QVERIFY(!original.isNull()); @@ -2673,6 +2675,10 @@ void tst_QGraphicsScene::render() void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() { +#if defined(Q_OS_ANDROID) + QSKIP("Test only works on platforms with resizable windows"); +#endif + QGraphicsScene scene(0, 0, 150, 150); // Add item with negative width. @@ -2706,6 +2712,7 @@ void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() QCOMPARE(actual, expected); } +#ifndef QT_NO_CONTEXTMENU void tst_QGraphicsScene::contextMenuEvent() { QGraphicsScene scene; @@ -2747,6 +2754,10 @@ protected: void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() { +#if defined(Q_OS_ANDROID) + QSKIP("Test fails on some Android devices (QTBUG-44430)"); +#endif + QGraphicsScene scene(0, 0, 200, 200); ContextMenuItem *item = new ContextMenuItem; item->setFlag(QGraphicsItem::ItemIgnoresTransformations); @@ -2788,6 +2799,7 @@ void tst_QGraphicsScene::contextMenuEvent_ItemIgnoresTransformations() QVERIFY(!event.isAccepted()); } } +#endif // QT_NO_CONTEXTMENU void tst_QGraphicsScene::update() { @@ -2800,7 +2812,7 @@ void tst_QGraphicsScene::update() rect->setPos(-100, -100); // This function forces indexing - scene.itemAt(0, 0); + itemAt(scene, 0, 0); qRegisterMetaType<QList<QRectF> >("QList<QRectF>"); QSignalSpy spy(&scene, SIGNAL(changed(QList<QRectF>))); @@ -2809,7 +2821,7 @@ void tst_QGraphicsScene::update() scene.update(); // This function forces a purge, which will post an update signal - scene.itemAt(0, 0); + itemAt(scene, 0, 0); // This will process the pending update QApplication::instance()->processEvents(); @@ -3257,10 +3269,11 @@ void tst_QGraphicsScene::tabFocus_sceneWithNestedFocusWidgets() FocusWidget *widget1_1 = new FocusWidget; FocusWidget *widget1_2 = new FocusWidget; widget1_1->setParentItem(widget1); - widget1_1->scale(0.5, 0.5); + const QTransform scale(QTransform::fromScale(0.5, 0.5)); + widget1_1->setTransform(scale, true); widget1_1->setPos(0, widget1->boundingRect().height() / 2); widget1_2->setParentItem(widget1); - widget1_2->scale(0.5, 0.5); + widget1_2->setTransform(scale, true); widget1_2->setPos(widget1->boundingRect().width() / 2, widget1->boundingRect().height() / 2); FocusWidget *widget2 = new FocusWidget; @@ -3520,7 +3533,7 @@ void tst_QGraphicsScene::task250680_childClip() QVERIFY(QPathCompare::comparePaths(rect->clipPath().simplified(), path)); QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); - rect->rotate(45); + rect->setTransform(QTransform().rotate(45), true); QCOMPARE(scene.items(QRectF(320, 240, 5, 5)).size(), 2); } @@ -3599,20 +3612,20 @@ void tst_QGraphicsScene::sorting() // view.show(); qDebug() << "items: {"; - foreach (QGraphicsItem *item, scene.items(32, 31, 4, 55)) + foreach (QGraphicsItem *item, scene.items(QRectF(32, 31, 4, 55))) qDebug() << "\t" << item->data(0).toString(); qDebug() << "}"; - QCOMPARE(scene.items(32, 31, 4, 55), + QCOMPARE(scene.items(QRectF(32, 31, 4, 55)), QList<QGraphicsItem *>() << c_1_2 << c_1_1_1 << c_1 << t_1); - QCOMPARE(scene.items(-53, 47, 136, 3), + QCOMPARE(scene.items(QRectF(-53, 47, 136, 3)), QList<QGraphicsItem *>() << c_2_2 << c_2_1 << c_2 << c_1_2 << c_1_1 << c_1 << t_1); - QCOMPARE(scene.items(-23, 79, 104, 3), + QCOMPARE(scene.items(QRectF(-23, 79, 104, 3)), QList<QGraphicsItem *>() << c_2_1_1 << c_1_1_1); - QCOMPARE(scene.items(-26, -3, 92, 79), + QCOMPARE(scene.items(QRectF(-26, -3, 92, 79)), QList<QGraphicsItem *>() << c_2_2 << c_2_1_1 << c_2_1 << c_2 << c_1_2 << c_1_1_1 << c_1_1 << c_1 @@ -4014,6 +4027,10 @@ void tst_QGraphicsScene::polishItems2() void tst_QGraphicsScene::isActive() { +#if defined(Q_OS_ANDROID) + QSKIP("Fails on Android (QTBUG-44430)"); +#endif + QGraphicsScene scene1; QVERIFY(!scene1.isActive()); QGraphicsScene scene2; @@ -4376,7 +4393,7 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() QGraphicsProxyWidget *proxy = scene->addWidget(w); proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); - proxy->rotate(15); + proxy->setTransform(QTransform().rotate(15), true); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -4422,7 +4439,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() scene->addItem(backItem); rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); - backItem->rotate(15); + backItem->setTransform(QTransform().rotate(15), true); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -4464,7 +4481,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() scene->addItem(rectItem); rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); - rectItem->rotate(15); + rectItem->setTransform(QTransform().rotate(15), true); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -4505,7 +4522,7 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() scene->addItem(rectItem); rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); - rectItem->rotate(15); + rectItem->setTransform(QTransform().rotate(15), true); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -4609,41 +4626,41 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(spy.count(), 1); QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason); QVERIFY(topLevelItem2->hasFocus()); scene.clearFocus(); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::OtherFocusReason); scene.setFocus(Qt::MenuBarFocusReason); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)0); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::MenuBarFocusReason); for (int i = 0; i < 3; ++i) { topLevelItem1->setFocus(Qt::TabFocusReason); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem1); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason); topLevelItem2->setFocus(Qt::TabFocusReason); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem1); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::TabFocusReason); } // The following two are unexpected, but fixing this (i.e., losing and gaining focus @@ -4664,9 +4681,9 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)topLevelItem2); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); QGraphicsRectItem *panel2 = new QGraphicsRectItem; panel2->setFlags(QGraphicsItem::ItemIsPanel | QGraphicsItem::ItemIsFocusable); @@ -4678,17 +4695,17 @@ void tst_QGraphicsScene::focusItemChangedSignal() QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel2); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel1); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); scene.setActivePanel(panel1); QCOMPARE(spy.count(), 1); arguments = spy.takeFirst(); QCOMPARE(arguments.size(), 3); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1); - QCOMPARE(qVariantValue<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2); - QCOMPARE(qVariantValue<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(0)), (QGraphicsItem *)panel1); + QCOMPARE(qvariant_cast<QGraphicsItem *>(arguments.at(1)), (QGraphicsItem *)panel2); + QCOMPARE(qvariant_cast<Qt::FocusReason>(arguments.at(2)), Qt::ActiveWindowFocusReason); } } diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro b/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro index 3d0d73566e..3b74ab0c75 100644 --- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro +++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/qgraphicssceneindex.pro @@ -4,4 +4,3 @@ requires(contains(QT_CONFIG,private_tests)) QT += widgets widgets-private testlib QT += core-private gui-private SOURCES += tst_qgraphicssceneindex.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp index b2d6eef9b1..f3ac70ddb5 100644 --- a/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicssceneindex/tst_qgraphicssceneindex.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$ ** @@ -327,7 +322,7 @@ void tst_QGraphicsSceneIndex::removeItems() delete widgetChild1; //We move the parent - scene.items(295, 295, 50, 50); + scene.items(QRectF(295, 295, 50, 50)); //This should not crash } diff --git a/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro b/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro index a46c803e41..68ee58d0d7 100644 --- a/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro +++ b/tests/auto/widgets/graphicsview/qgraphicstransform/qgraphicstransform.pro @@ -2,5 +2,3 @@ CONFIG += testcase TARGET = tst_qgraphicstransform QT += widgets testlib SOURCES += tst_qgraphicstransform.cpp -CONFIG += parallel_test - diff --git a/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp index cf1edae9ff..da3270d527 100644 --- a/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicstransform/tst_qgraphicstransform.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,12 +34,6 @@ class tst_QGraphicsTransform : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void scale(); void rotation(); @@ -57,29 +46,6 @@ private: QString toString(QTransform const&); }; - -// This will be called before the first test function is executed. -// It is only called once. -void tst_QGraphicsTransform::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsTransform::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsTransform::init() -{ -} - -// This will be called after every test function. -void tst_QGraphicsTransform::cleanup() -{ -} - static QTransform transform2D(const QGraphicsTransform& t) { QMatrix4x4 m; diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro index d1f9bede0b..258b5e0e14 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro +++ b/tests/auto/widgets/graphicsview/qgraphicsview/qgraphicsview.pro @@ -9,4 +9,3 @@ SOURCES += tst_qgraphicsview.cpp tst_qgraphicsview_2.cpp HEADERS += tst_qgraphicsview.h DEFINES += QT_NO_CAST_TO_ASCII -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index da2606c160..5b6f219d11 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.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$ ** @@ -281,9 +276,6 @@ public slots: void dummySlot() {} private: -#if defined Q_OS_BLACKBERRY - QScopedPointer<QWidget> rootWindow; -#endif QString platformName; }; @@ -292,13 +284,6 @@ void tst_QGraphicsView::initTestCase() #ifdef Q_OS_WINCE_WM qApp->setAutoMaximizeThreshold(-1); #endif - -#if defined Q_OS_BLACKBERRY - // On BlackBerry first window is always shown full screen. However, many tests rely on specific - // window sizes. Create a dummy full screen window, so subsequent windows have correct size. - rootWindow.reset(new QWidget); - rootWindow->show(); -#endif } void tst_QGraphicsView::cleanup() @@ -474,10 +459,12 @@ void tst_QGraphicsView::interactive() QCOMPARE(item->events.size(), i * 5 + 5); QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease); QCOMPARE(item->events.at(item->events.size() - 1), QEvent::UngrabMouse); +#ifndef QT_NO_CONTEXTMENU QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint)); QApplication::sendEvent(view.viewport(), &contextEvent); QCOMPARE(item->events.size(), i * 5 + 6); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); +#endif // QT_NO_CONTEXTMENU } view.setInteractive(false); @@ -489,10 +476,12 @@ void tst_QGraphicsView::interactive() sendMouseRelease(view.viewport(), itemPoint); QCOMPARE(item->events.size(), 501); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); +#ifndef QT_NO_CONTEXTMENU QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, itemPoint, view.mapToGlobal(itemPoint)); QApplication::sendEvent(view.viewport(), &contextEvent); QCOMPARE(item->events.size(), 501); QCOMPARE(item->events.last(), QEvent::GraphicsSceneContextMenu); +#endif // QT_NO_CONTEXTMENU } } @@ -589,7 +578,7 @@ void tst_QGraphicsView::sceneRect_growing() QGraphicsScene scene; for (int i = 0; i < 100; ++i) - scene.addText(QString("(0, %1)").arg((i - 50) * 20))->setPos(0, (i - 50) * 20); + scene.addText(QLatin1String("(0, ") + QString::number((i - 50) * 20))->setPos(0, (i - 50) * 20); QGraphicsView view(&scene, &toplevel); view.setFixedSize(200, 200); @@ -1436,8 +1425,8 @@ void tst_QGraphicsView::fitInView() items[2]->setPos(-100, 100); items[3]->setPos(100, 100); - items[0]->rotate(30); - items[1]->rotate(-30); + items[0]->setTransform(QTransform().rotate(30), true); + items[1]->setTransform(QTransform().rotate(-30), true); #if defined(Q_OS_WINCE) //Is the standard scrollbar size @@ -2933,9 +2922,6 @@ void tst_QGraphicsView::scrollBarRanges() QFETCH(ExpectedValueDescription, vmax); QFETCH(bool, useStyledPanel); - if (style == QLatin1String("GTK+") && useStyledPanel) - QSKIP("GTK + style test skipped, see QTBUG-29002"); - if (useStyledPanel && style == QStringLiteral("Macintosh") && platformName == QStringLiteral("cocoa")) QSKIP("Insignificant on OSX"); @@ -3555,7 +3541,7 @@ void tst_QGraphicsView::embeddedViews() SpyItem *item = new SpyItem; v2->scene()->addItem(item); - proxy->translate(5, 5); + proxy->setTransform(QTransform::fromTranslate(5, 5), true); QImage actual(64, 64, QImage::Format_ARGB32_Premultiplied); actual.fill(0); diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h index e3be0a4e46..8a83ee3272 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.h @@ -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/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp index eeee3a75c7..ff621b94c5 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_2.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview_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$ ** diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST index c8d93585b2..13ec840eff 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/BLACKLIST @@ -1,3 +1,4 @@ [initialShow2] ubuntu-14.04 rhel-7.1 +rhel-7.2 diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro b/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro index 481bc96d96..042c42f63f 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/qgraphicswidget.pro @@ -6,4 +6,3 @@ QT += core-private gui-private SOURCES += tst_qgraphicswidget.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index ec2203e615..ca9f866e81 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.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$ ** @@ -49,6 +44,8 @@ #include "../../../qtest-config.h" +typedef QList<QGraphicsItem *> QGraphicsItemList; + class EventSpy : public QObject { Q_OBJECT @@ -77,12 +74,6 @@ protected: class tst_QGraphicsWidget : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void qgraphicswidget(); @@ -262,28 +253,6 @@ protected: } }; -// This will be called before the first test function is executed. -// It is only called once. -void tst_QGraphicsWidget::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QGraphicsWidget::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QGraphicsWidget::init() -{ -} - -// This will be called after every test function. -void tst_QGraphicsWidget::cleanup() -{ -} - class SizeHinter : public QGraphicsWidget { public: @@ -588,7 +557,7 @@ void tst_QGraphicsWidget::focusPolicy_data() QTest::addColumn<Qt::FocusPolicy>("focusPolicy2"); for (int i = 0; i < 25; ++i) { - QTestData &data = QTest::newRow(QString("%1").arg(i).toLatin1()); + QTestData &data = QTest::newRow(QByteArray::number(i).constData()); switch(i % 5) { case 0: data << Qt::TabFocus; break; case 1: data << Qt::ClickFocus; break; @@ -1108,7 +1077,7 @@ void tst_QGraphicsWidget::initStyleOption() view.setAlignment(Qt::AlignTop | Qt::AlignLeft); SubQGraphicsWidget *widget = new SubQGraphicsWidget; - widget->setAcceptsHoverEvents(true); + widget->setAcceptHoverEvents(true); QStyleOption option; scene.addItem(widget); @@ -1464,27 +1433,37 @@ void tst_QGraphicsWidget::setTabOrder() } } -static bool compareFocusChain(QGraphicsView *view, const QList<QGraphicsItem*> &order) +template <class Iterator> +bool compareFocusChain(QGraphicsView *view, + Iterator i1, Iterator i2, + QByteArray *errorMessage) { QGraphicsScene *scene = view->scene(); - QStringList actual; QGraphicsItem *oldFocusItem = scene->focusItem(); - for (int i = 0; i < order.count(); ++i) { - QGraphicsItem *focusItem = scene->focusItem(); - actual << focusItem->data(0).toString(); - //qDebug() << "i:" << i << "expected:" << QString::number(uint(order.at(i)), 16) << QString::number(uint(focusItem), 16); - if (focusItem != order.at(i)) { - qDebug() << "actual:" << actual; + Iterator last = i2 - 1; + for (Iterator i = i1; i != i2; ++i) { + QGraphicsItem *actualFocusItem = scene->focusItem(); + QGraphicsItem *expectedFocusItem = *i; + if (actualFocusItem != expectedFocusItem) { + *errorMessage = "Actual:" + actualFocusItem->data(0).toByteArray() + + " expected:" + expectedFocusItem->data(0).toByteArray(); scene->setFocusItem(oldFocusItem); return false; } - if (i < order.count() - 1) + if (i != last) QTest::keyPress(view, Qt::Key_Tab); } scene->setFocusItem(oldFocusItem); return true; } +template <class Container> +bool compareFocusChain(QGraphicsView *view, const Container &c, + QByteArray *errorMessage) +{ + return compareFocusChain(view, c.constBegin(), c.constEnd(), errorMessage); +} + void tst_QGraphicsWidget::setTabOrderAndReparent() { QGraphicsScene scene; @@ -1494,78 +1473,68 @@ void tst_QGraphicsWidget::setTabOrderAndReparent() QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(QApplication::activeWindow(), (QWidget*)&view); - int i; - QGraphicsWidget *w1, *w2, *w3, *w4; - for (i = 1; i < 4; ++i) { - QGraphicsWidget *wid = new QGraphicsWidget; - wid->setFocusPolicy(Qt::StrongFocus); - wid->setData(0, QString::fromLatin1("w%1").arg(i)); - scene.addItem(wid); - if (i == 1) - w1 = wid; - else if (i == 2) - w2 = wid; - else if (i == 3) - w3 = wid; - } - - w1->setFocus(); - QTRY_VERIFY(w1->hasFocus()); - QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w2 << w3)); + QGraphicsWidget *w[4]; + for (int i = 0; i < 3; ++i) { + w[i] = new QGraphicsWidget; + w[i]->setFocusPolicy(Qt::StrongFocus); + w[i]->setData(0, 'w' + QByteArray::number(i + 1)); + scene.addItem(w[i]); + } + + w[0]->setFocus(); + QTRY_VERIFY(w[0]->hasFocus()); + QByteArray errorMessage; + QVERIFY2(compareFocusChain(&view, w, w + 3, &errorMessage), errorMessage.constData()); QGraphicsWidget *p = new QGraphicsWidget; p->setData(0, QLatin1String("parent")); p->setFocusPolicy(Qt::StrongFocus); - w1->setFocus(); - QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w2 << w3)); + w[0]->setFocus(); + QVERIFY2(compareFocusChain(&view, w, w + 3, &errorMessage), errorMessage.constData()); - w1->setParentItem(p); - w2->setFocus(); - QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3)); + w[0]->setParentItem(p); + w[1]->setFocus(); + QVERIFY2(compareFocusChain(&view, w + 1, w + 3, &errorMessage), errorMessage.constData()); - w2->setParentItem(p); - w3->setFocus(); - QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w3)); - w3->setParentItem(p); + w[1]->setParentItem(p); + w[2]->setFocus(); + QVERIFY2(compareFocusChain(&view, w + 2, w + 3, &errorMessage), errorMessage.constData()); + w[2]->setParentItem(p); QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem*>(0)); scene.addItem(p); p->setFocus(); - QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << p << w1 << w2 << w3)); + QVERIFY2(compareFocusChain(&view, QGraphicsItemList() << p << w[0] << w[1] << w[2], + &errorMessage), errorMessage.constData()); delete p; - for (i = 1; i < 5; ++i) { - QGraphicsWidget *wid = new QGraphicsWidget; - wid->setFocusPolicy(Qt::StrongFocus); - wid->setData(0, QString::fromLatin1("w%1").arg(i)); - scene.addItem(wid); - if (i == 1) - w1 = wid; - else if (i == 2) - w2 = wid; - else if (i == 3) - w3 = wid; - else if (i == 4) - w4 = wid; - } - w4->setParentItem(w1); - QGraphicsWidget::setTabOrder(w1, w4); - w1->setFocus(); - QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w1 << w4 << w2 << w3)); + for (int i = 0; i < 4; ++i) { + w[i] = new QGraphicsWidget; + w[i]->setFocusPolicy(Qt::StrongFocus); + w[i]->setData(0, 'w' + QByteArray::number(i + 1)); + scene.addItem(w[i]); + } + + w[3]->setParentItem(w[0]); + QGraphicsWidget::setTabOrder(w[0], w[3]); + w[0]->setFocus(); + QVERIFY2(compareFocusChain(&view, QGraphicsItemList() << w[0] << w[3] << w[1] << w[2], + &errorMessage), errorMessage.constData()); p = new QGraphicsWidget; p->setData(0, QLatin1String("parent")); p->setFocusPolicy(Qt::StrongFocus); - w1->setParentItem(p); - w2->setFocus(); - QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3)); + w[0]->setParentItem(p); + w[1]->setFocus(); + QVERIFY2(compareFocusChain(&view, w + 1, w + 3, &errorMessage), errorMessage.constData()); scene.addItem(p); - w2->setFocus(); - QVERIFY(compareFocusChain(&view, QList<QGraphicsItem*>() << w2 << w3 << p << w1 << w4)); + w[1]->setFocus(); + QVERIFY2(compareFocusChain(&view, QGraphicsItemList() << w[1] << w[2] << p << w[0] << w[3], + &errorMessage), errorMessage.constData()); } void tst_QGraphicsWidget::topLevelWidget_data() @@ -1756,13 +1725,15 @@ void tst_QGraphicsWidget::verifyFocusChain() w1_4->setGeometry(75,0,25, 25); scene.addItem(w1_4); QTRY_VERIFY(w1_3->hasFocus()); - QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4)); + QByteArray errorMessage; + const QGraphicsItemList expected = QGraphicsItemList() << w1_3 << w1_4; + QTRY_VERIFY2(compareFocusChain(view, expected, &errorMessage), errorMessage.constData()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); QTRY_VERIFY(lineEdit->hasFocus()); // tabFocusFirst should now point to w1_3 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); QTRY_VERIFY(w1_3->hasFocus()); - QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4)); + QTRY_VERIFY2(compareFocusChain(view, expected, &errorMessage), errorMessage.constData()); } } @@ -2090,12 +2061,12 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails() view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTRY_VERIFY(!scene.itemAt(25, 25)); + QTRY_VERIFY(scene.items(QPointF(25, 25)).isEmpty()); widget->setGeometry(0, 112, 360, 528); - QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget); widget2->setGeometry(0, 573, 360, 67); - QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); - QTRY_COMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2); + QTRY_COMPARE(scene.items(QPointF(15, 120)).value(0, Q_NULLPTR), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.items(QPointF(50, 585)).value(0, Q_NULLPTR), (QGraphicsItem *)widget2); } void tst_QGraphicsWidget::defaultSize() diff --git a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp index 90ea6f3ef7..6fd95c8266 100644 --- a/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/widgets/itemviews/qabstractitemview/tst_qabstractitemview.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$ ** @@ -56,6 +51,7 @@ #include <qstyleditemdelegate.h> #include <qstringlistmodel.h> #include <qsortfilterproxymodel.h> +#include <qproxystyle.h> static inline void setFrameless(QWidget *w) { @@ -150,6 +146,7 @@ private slots: void sizeHintChangeTriggersLayout(); void shiftSelectionAfterChangingModelContents(); void QTBUG48968_reentrant_updateEditorGeometries(); + void QTBUG50102_SH_ItemView_ScrollMode(); void QTBUG50535_update_on_new_selection_model(); void testSelectionModelInSyncWithView(); void testClickToSelect(); @@ -774,7 +771,7 @@ class DnDTestModel : public QStandardItemModel public: DnDTestModel() : QStandardItemModel(20, 20), dropAction_result(Qt::IgnoreAction) { for (int i = 0; i < rowCount(); ++i) - setData(index(i, 0), QString("%1").arg(i)); + setData(index(i, 0), QString::number(i)); } Qt::DropAction dropAction() const { return dropAction_result; } }; @@ -1179,9 +1176,9 @@ void tst_QAbstractItemView::task250754_fontChange() QStandardItemModel *m = new QStandardItemModel(this); for (int i=0; i<20; ++i) { - QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i)); + QStandardItem *item = new QStandardItem(QStringLiteral("Item number ") + QString::number(i)); for (int j=0; j<5; ++j) { - QStandardItem *child = new QStandardItem(QString("Child Item number %1").arg(j)); + QStandardItem *child = new QStandardItem(QStringLiteral("Child Item number ") + QString::number(j)); item->setChild(j, 0, child); } m->setItem(i, 0, item); @@ -1271,7 +1268,7 @@ void tst_QAbstractItemView::shiftArrowSelectionAfterScrolling() { QStandardItemModel model; for (int i=0; i<10; ++i) { - QStandardItem *item = new QStandardItem(QString("%1").arg(i)); + QStandardItem *item = new QStandardItem(QString::number(i)); model.setItem(i, 0, item); } @@ -1308,7 +1305,7 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection() { QStandardItemModel model; for (int i=0; i<3; ++i) { - QStandardItem *item = new QStandardItem(QString("%1").arg(i)); + QStandardItem *item = new QStandardItem(QString::number(i)); model.setItem(i, 0, item); } @@ -1385,7 +1382,7 @@ void tst_QAbstractItemView::ctrlRubberbandSelection() { QStandardItemModel model; for (int i=0; i<3; ++i) { - QStandardItem *item = new QStandardItem(QString("%1").arg(i)); + QStandardItem *item = new QStandardItem(QString::number(i)); model.setItem(i, 0, item); } @@ -1511,11 +1508,6 @@ void tst_QAbstractItemView::testDelegateDestroyEditor() void tst_QAbstractItemView::testClickedSignal() { -#if defined Q_OS_BLACKBERRY - QWidget rootWindow; - rootWindow.show(); - QTest::qWaitForWindowExposed(&rootWindow); -#endif QTableWidget view(5, 5); centerOnScreen(&view); @@ -1930,6 +1922,53 @@ void tst_QAbstractItemView::QTBUG48968_reentrant_updateEditorGeometries() // No crash, all fine. } +class ScrollModeProxyStyle: public QProxyStyle +{ +public: + ScrollModeProxyStyle(QAbstractItemView::ScrollMode sm, QStyle *style = 0) + : QProxyStyle(style) + , scrollMode(sm == QAbstractItemView::ScrollPerItem ? + QAbstractItemView::ScrollPerPixel : QAbstractItemView::ScrollPerItem) + { } + + int styleHint(QStyle::StyleHint hint, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *returnData) const override + { + if (hint == SH_ItemView_ScrollMode) + return scrollMode; + + return baseStyle()->styleHint(hint, opt, w, returnData); + } + + QAbstractItemView::ScrollMode scrollMode; +}; + +void tst_QAbstractItemView::QTBUG50102_SH_ItemView_ScrollMode() +{ + QListView view; + + // Default comes from the style + auto styleScrollMode = static_cast<QAbstractItemView::ScrollMode>(view.style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, &view, 0)); + QCOMPARE(view.verticalScrollMode(), styleScrollMode); + QCOMPARE(view.horizontalScrollMode(), styleScrollMode); + + // Change style, get new value + view.setStyle(new ScrollModeProxyStyle(styleScrollMode)); + auto proxyScrollMode = static_cast<QAbstractItemView::ScrollMode>(view.style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, &view, 0)); + QVERIFY(styleScrollMode != proxyScrollMode); + QCOMPARE(view.verticalScrollMode(), proxyScrollMode); + QCOMPARE(view.horizontalScrollMode(), proxyScrollMode); + + // Explicitly set vertical, same value + view.setVerticalScrollMode(proxyScrollMode); + QCOMPARE(view.verticalScrollMode(), proxyScrollMode); + QCOMPARE(view.horizontalScrollMode(), proxyScrollMode); + + // Change style, won't change value for vertical, will change for horizontal + view.setStyle(new ScrollModeProxyStyle(proxyScrollMode)); + QCOMPARE(view.verticalScrollMode(), proxyScrollMode); + QCOMPARE(view.horizontalScrollMode(), styleScrollMode); +} + void tst_QAbstractItemView::QTBUG50535_update_on_new_selection_model() { QStandardItemModel model; diff --git a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp index 6645da727c..d717278be9 100644 --- a/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.cpp +++ b/tests/auto/widgets/itemviews/qcolumnview/tst_qcolumnview.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$ ** @@ -51,14 +46,10 @@ class tst_QColumnView : public QObject { public: tst_QColumnView(); - virtual ~tst_QColumnView(); -public Q_SLOTS: +private slots: void initTestCase(); void init(); - void cleanup(); - -private slots: void rootIndex(); void grips(); void isIndexHidden(); @@ -112,12 +103,14 @@ public: for (int j = 0; j < 10; ++j) { QStandardItem *parentItem = invisibleRootItem(); for (int i = 0; i < 10; ++i) { - QStandardItem *item = new QStandardItem(QString("item %0").arg(i)); + const QString iS = QString::number(i); + const QString itemText = QLatin1String("item ") + iS; + QStandardItem *item = new QStandardItem(itemText); parentItem->appendRow(item); - QStandardItem *item2 = new QStandardItem(QString("item %0").arg(i)); + QStandardItem *item2 = new QStandardItem(itemText); parentItem->appendRow(item2); - item2->appendRow(new QStandardItem(QString("item %0").arg(i))); - parentItem->appendRow(new QStandardItem(QString("file %0").arg(i))); + item2->appendRow(new QStandardItem(itemText)); + parentItem->appendRow(new QStandardItem(QLatin1String("file ") + iS)); parentItem = item; } } @@ -181,10 +174,6 @@ tst_QColumnView::tst_QColumnView() m_fakeDirHomeIndex = m_fakeDirModel.indexFromItem(homeItem); } -tst_QColumnView::~tst_QColumnView() -{ -} - void tst_QColumnView::initTestCase() { QVERIFY(m_fakeDirHomeIndex.isValid()); @@ -199,10 +188,6 @@ void tst_QColumnView::init() #endif } -void tst_QColumnView::cleanup() -{ -} - void tst_QColumnView::rootIndex() { ColumnView view; diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro b/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro index 3f4cb491f4..53b23b5ef2 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/qdatawidgetmapper.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdatawidgetmapper QT += widgets testlib SOURCES += tst_qdatawidgetmapper.cpp diff --git a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp index 8b80d52a5f..ea88020a56 100644 --- a/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.cpp +++ b/tests/auto/widgets/itemviews/qdatawidgetmapper/tst_qdatawidgetmapper.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$ ** @@ -66,8 +61,10 @@ static QStandardItemModel *testModel(QObject *parent = 0) QStandardItemModel *model = new QStandardItemModel(10, 10, parent); for (int row = 0; row < 10; ++row) { + const QString prefix = QLatin1String("item ") + QString::number(row) + + QLatin1Char(' '); for (int col = 0; col < 10; ++col) - model->setData(model->index(row, col), QString("item %1 %2").arg(row).arg(col)); + model->setData(model->index(row, col), prefix + QString::number(col)); } return model; diff --git a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro index f1bc968b88..5190598701 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro +++ b/tests/auto/widgets/itemviews/qdirmodel/qdirmodel.pro @@ -19,7 +19,7 @@ android|wince { DEFINES += SRCDIR=\\\"$$PWD/\\\" } -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp index f12876f745..06019d4555 100644 --- a/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/widgets/itemviews/qdirmodel/tst_qdirmodel.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$ ** @@ -116,7 +111,7 @@ void tst_QDirModel::getSetCheck() void tst_QDirModel::initTestCase() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QString dataPath = SRCDIR; QString resourceSourcePath = QStringLiteral(":/android_testdata"); QDirIterator it(resourceSourcePath, QDirIterator::Subdirectories); @@ -416,14 +411,14 @@ void tst_QDirModel::rowsAboutToBeRemoved_data() bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QStringList &initial_files) { - QString path = QDir::currentPath() + "/" + test_path; + QString path = QDir::currentPath() + QLatin1Char('/') + test_path; if (!QDir::current().mkdir(test_path) && false) { // FIXME qDebug() << "failed to create dir" << path; return false; } for (int i = 0; i < initial_files.count(); ++i) { - QFile file(path + "/" + initial_files.at(i)); + QFile file(path + QLatin1Char('/') + initial_files.at(i)); if (!file.open(QIODevice::WriteOnly)) { qDebug() << "failed to open file" << initial_files.at(i); return false; @@ -443,7 +438,7 @@ bool tst_QDirModel::rowsAboutToBeRemoved_init(const QString &test_path, const QS bool tst_QDirModel::rowsAboutToBeRemoved_cleanup(const QString &test_path) { - QString path = QDir::currentPath() + "/" + test_path; + QString path = QDir::currentPath() + QLatin1Char('/') + test_path; QDir dir(path, "*", QDir::SortFlags(QDir::Name|QDir::IgnoreCase), QDir::Files); QStringList files = dir.entryList(); @@ -584,8 +579,8 @@ void tst_QDirModel::filePath() QString path = SRCDIR; #else QString path = QFileInfo(SRCDIR).absoluteFilePath(); - if (!path.endsWith("/")) - path += "/"; + if (!path.endsWith(QLatin1Char('/'))) + path += QLatin1Char('/'); #endif QCOMPARE(model.filePath(index), path + QString( "test.lnk")); model.setResolveSymlinks(true); @@ -618,7 +613,7 @@ void tst_QDirModel::task196768_sorting() view.setSortingEnabled(true); index2 = model.index(path); -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QEXPECT_FAIL("", "QTBUG-43818", Continue); #endif diff --git a/tests/auto/widgets/itemviews/qfileiconprovider/qfileiconprovider.pro b/tests/auto/widgets/itemviews/qfileiconprovider/qfileiconprovider.pro index 0c3a780405..37173a175e 100644 --- a/tests/auto/widgets/itemviews/qfileiconprovider/qfileiconprovider.pro +++ b/tests/auto/widgets/itemviews/qfileiconprovider/qfileiconprovider.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfileiconprovider QT += widgets testlib SOURCES += tst_qfileiconprovider.cpp diff --git a/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp b/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp index fba83a24c7..6db1f78312 100644 --- a/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.cpp +++ b/tests/auto/widgets/itemviews/qfileiconprovider/tst_qfileiconprovider.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$ ** @@ -40,12 +35,6 @@ class tst_QFileIconProvider : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void qfileiconprovider_data(); void qfileiconprovider(); @@ -69,29 +58,6 @@ public: }; -// This will be called before the first test function is executed. -// It is only called once. -void tst_QFileIconProvider::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QFileIconProvider::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QFileIconProvider::init() -{ -} - -// This will be called after every test function. -void tst_QFileIconProvider::cleanup() -{ -} - - void tst_QFileIconProvider::qfileiconprovider_data() { } diff --git a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp index 4736aa5c12..ea065a4db4 100644 --- a/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2012 Thorbjørn Lund Martsum - tmartsum[at]gmail.com -** Contact: http://www.qt.io/licensing/ +** 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$ ** @@ -47,6 +42,7 @@ #include <qitemdelegate.h> #include <qtreewidget.h> #include <qdebug.h> +#include <qscreen.h> typedef QList<int> IntList; @@ -107,15 +103,12 @@ class tst_QHeaderView : public QObject public: tst_QHeaderView(); - virtual ~tst_QHeaderView(); -public slots: +private slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); - -private slots: void getSetCheck(); void visualIndex(); @@ -240,6 +233,7 @@ private slots: void resizeToContentTest(); void testStreamWithHide(); void testStylePosition(); + void stretchAndRestoreLastSection(); void sizeHintCrash(); @@ -274,7 +268,8 @@ public: wrongIndex = true; qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), idx.internalPointer()); } - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()).arg(0);//idx.data()); + return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1String(",0]"); } void insertOneColumn(int col) @@ -384,10 +379,6 @@ tst_QHeaderView::tst_QHeaderView() qRegisterMetaType<int>("Qt::SortOrder"); } -tst_QHeaderView::~tst_QHeaderView() -{ -} - void tst_QHeaderView::initTestCase() { #ifdef Q_OS_WINCE //disable magic for WindowsCE @@ -562,7 +553,7 @@ void tst_QHeaderView::hidden() void tst_QHeaderView::stretch() { - // Show before resize and setStrechLastSection + // Show before resize and setStretchLastSection #if defined(Q_OS_WINCE) QSize viewSize(200,300); #else @@ -1571,7 +1562,7 @@ public: return QVariant(); } if (role == Qt::DisplayRole) { - return QString::fromLatin1("%1,%2").arg(index.row()).arg(index.column()); + return QString::number(index.row()) + QLatin1Char(',') + QString::number(index.column()); } return QVariant(); } @@ -2244,13 +2235,21 @@ void tst_QHeaderView::QTBUG8650_crashOnInsertSections() model.insertColumn(0, items); } +static void setModelTexts(QStandardItemModel *model) +{ + const int columnCount = model->columnCount(); + for (int i = 0, rowCount = model->rowCount(); i < rowCount; ++i) { + const QString prefix = QLatin1String("item [") + QString::number(i) + QLatin1Char(','); + for (int j = 0; j < columnCount; ++j) + model->setData(model->index(i, j), prefix + QString::number(j) + QLatin1Char(']')); + } +} + void tst_QHeaderView::QTBUG12268_hiddenMovedSectionSorting() { QTableView view; // ### this test fails on QTableView &view = *m_tableview; !? + shadowing view member QStandardItemModel *model = new QStandardItemModel(4,3, &view); - for (int i = 0; i< model->rowCount(); ++i) - for (int j = 0; j< model->columnCount(); ++j) - model->setData(model->index(i,j), QString("item [%1,%2]").arg(i).arg(j)); + setModelTexts(model); view.setModel(model); view.horizontalHeader()->setSectionsMovable(true); view.setSortingEnabled(true); @@ -2344,9 +2343,7 @@ void tst_QHeaderView::initialSortOrderRole() { QTableView view; // ### Shadowing member view (of type QHeaderView) QStandardItemModel *model = new QStandardItemModel(4, 3, &view); - for (int i = 0; i< model->rowCount(); ++i) - for (int j = 0; j< model->columnCount(); ++j) - model->setData(model->index(i,j), QString("item [%1,%2]").arg(i).arg(j)); + setModelTexts(model); QStandardItem *ascendingItem = new QStandardItem(); QStandardItem *descendingItem = new QStandardItem(); ascendingItem->setData(Qt::AscendingOrder, Qt::InitialSortOrderRole); @@ -2514,7 +2511,7 @@ void tst_QHeaderView::calculateAndCheck(int cppline, const int precalced_compare QString msg = "semantic problem at " + QString(__FILE__) + " (" + sline + ")"; msg += "\nThe *expected* result was : {" + istr(x[0]) + istr(x[1]) + istr(x[2]) + istr(x[3]) - + istr(x[4]) + istr(x[5]) + istr(x[6], false) + "}"; + + istr(x[4]) + istr(x[5]) + istr(x[6], false) + QLatin1Char('}'); msg += "\nThe calculated result was : {"; msg += istr(chk_visual) + istr(chk_logical) + istr(chk_sizes) + istr(chk_hidden_size) + istr(chk_lookup_visual) + istr(chk_lookup_logical) + istr(header_lenght, false) + "};"; @@ -2592,7 +2589,7 @@ void tst_QHeaderView::additionalInit() for (int i = 0; i < model->rowCount(); ++i) { model->setData(model->index(i, 0), QVariant(i)); s.setNum(i); - s += "."; + s += QLatin1Char('.'); s += 'a' + (i % 25); model->setData(model->index(i, 1), QVariant(s)); } @@ -2911,5 +2908,129 @@ void tst_QHeaderView::sizeHintCrash() treeView.header()->sizeHintForRow(0); } +void tst_QHeaderView::stretchAndRestoreLastSection() +{ + QStandardItemModel m(10, 10); + QTableView tv; + tv.setModel(&m); + tv.showMaximized(); + + const int defaultSectionSize = 30; + const int someOtherSectionSize = 40; + const int biggerSizeThanAnySection = 50; + + QVERIFY(QTest::qWaitForWindowExposed(&tv)); + + QHeaderView &header = *tv.horizontalHeader(); + header.setDefaultSectionSize(defaultSectionSize); + header.resizeSection(9, someOtherSectionSize); + header.setStretchLastSection(true); + + // Default last section is larger + QCOMPARE(header.sectionSize(8), defaultSectionSize); + QVERIFY(header.sectionSize(9) >= biggerSizeThanAnySection); + + // Moving last section away (restore old last section 9 - and make 8 larger) + header.swapSections(9, 8); + QCOMPARE(header.sectionSize(9), someOtherSectionSize); + QVERIFY(header.sectionSize(8) >= biggerSizeThanAnySection); + + // Make section 9 the large one again + header.hideSection(8); + QVERIFY(header.sectionSize(9) >= biggerSizeThanAnySection); + + // Show section 8 again - and make that one the last one. + header.showSection(8); + QVERIFY(header.sectionSize(8) > biggerSizeThanAnySection); + QCOMPARE(header.sectionSize(9), someOtherSectionSize); + + // Swap the sections so the logical indexes are equal to visible indexes again. + header.moveSection(9, 8); + QCOMPARE(header.sectionSize(8), defaultSectionSize); + QVERIFY(header.sectionSize(9) >= biggerSizeThanAnySection); + + // Append sections + m.setColumnCount(15); + QCOMPARE(header.sectionSize(9), someOtherSectionSize); + QVERIFY(header.sectionSize(14) >= biggerSizeThanAnySection); + + // Truncate sections (remove sections with the last section) + m.setColumnCount(10); + QVERIFY(header.sectionSize(9) >= biggerSizeThanAnySection); + for (int u = 0; u < 9; ++u) + QCOMPARE(header.sectionSize(u), defaultSectionSize); + + // Insert sections + m.insertColumns(2, 2); + QCOMPARE(header.sectionSize(9), defaultSectionSize); + QCOMPARE(header.sectionSize(10), defaultSectionSize); + QVERIFY(header.sectionSize(11) >= biggerSizeThanAnySection); + + // Append an extra section and check restore + m.setColumnCount(m.columnCount() + 1); + QCOMPARE(header.sectionSize(11), someOtherSectionSize); + QVERIFY(header.sectionSize(12) >= biggerSizeThanAnySection); + + // Remove some sections but not the last one. + m.removeColumns(2, 2); + QCOMPARE(header.sectionSize(9), someOtherSectionSize); + QVERIFY(header.sectionSize(10) >= biggerSizeThanAnySection); + for (int u = 0; u < 9; ++u) + QCOMPARE(header.sectionSize(u), defaultSectionSize); + + // Empty the header and start over with some more tests + m.setColumnCount(0); + m.setColumnCount(10); + QVERIFY(header.sectionSize(9) >= biggerSizeThanAnySection); + + // Check resize of the last section + header.resizeSection(9, someOtherSectionSize); + QVERIFY(header.sectionSize(9) >= biggerSizeThanAnySection); // It should still be stretched + header.swapSections(9, 8); + QCOMPARE(header.sectionSize(9), someOtherSectionSize); + + // Restore the order + header.swapSections(9, 8); + QVERIFY(header.sectionSize(9) >= biggerSizeThanAnySection); + + // Hide the last 3 sections and test stretch last section on swap/move + // when hidden sections with a larger visual index exists. + header.hideSection(7); + header.hideSection(8); + header.hideSection(9); + QVERIFY(header.sectionSize(6) >= biggerSizeThanAnySection); + header.moveSection(2, 7); + QVERIFY(header.sectionSize(2) >= biggerSizeThanAnySection); + header.swapSections(1, 8); + QCOMPARE(header.sectionSize(2), defaultSectionSize); + QVERIFY(header.sectionSize(1) >= biggerSizeThanAnySection); + + // Inserting sections 2 + m.setColumnCount(0); + m.setColumnCount(10); + header.resizeSection(1, someOtherSectionSize); + header.swapSections(1, 9); + m.insertColumns(9, 2); + header.swapSections(1, 11); + QCOMPARE(header.sectionSize(1), someOtherSectionSize); + + // Clear and re-add. This triggers a different code path than seColumnCount(0) + m.clear(); + m.setColumnCount(3); + QVERIFY(header.sectionSize(2) >= biggerSizeThanAnySection); + + // Test import/export of the original (not stretched) sectionSize. + m.setColumnCount(0); + m.setColumnCount(10); + header.resizeSection(9, someOtherSectionSize); + QVERIFY(header.sectionSize(9) >= biggerSizeThanAnySection); + QByteArray b = header.saveState(); + m.setColumnCount(0); + m.setColumnCount(10); + header.restoreState(b); + header.setStretchLastSection(false); + QCOMPARE(header.sectionSize(9), someOtherSectionSize); +} + QTEST_MAIN(tst_QHeaderView) #include "tst_qheaderview.moc" diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp index 45bac13c92..972dabdcb8 100644 --- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp +++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.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$ ** @@ -191,15 +186,7 @@ class tst_QItemDelegate : public QObject { Q_OBJECT -public: - tst_QItemDelegate(); - virtual ~tst_QItemDelegate(); - private slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); void getSetCheck(); void textRectangle_data(); void textRectangle(); @@ -259,30 +246,6 @@ void tst_QItemDelegate::getSetCheck() QCOMPARE(obj1.hasClipping(), true); } -tst_QItemDelegate::tst_QItemDelegate() -{ -} - -tst_QItemDelegate::~tst_QItemDelegate() -{ -} - -void tst_QItemDelegate::initTestCase() -{ -} - -void tst_QItemDelegate::cleanupTestCase() -{ -} - -void tst_QItemDelegate::init() -{ -} - -void tst_QItemDelegate::cleanup() -{ -} - void tst_QItemDelegate::textRectangle_data() { QFont font; diff --git a/tests/auto/widgets/itemviews/qitemeditorfactory/qitemeditorfactory.pro b/tests/auto/widgets/itemviews/qitemeditorfactory/qitemeditorfactory.pro index 55df1d83f1..5ff7771585 100644 --- a/tests/auto/widgets/itemviews/qitemeditorfactory/qitemeditorfactory.pro +++ b/tests/auto/widgets/itemviews/qitemeditorfactory/qitemeditorfactory.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qitemeditorfactory QT += widgets testlib SOURCES += tst_qitemeditorfactory.cpp diff --git a/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp b/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp index 15fd19ede9..ae587279b2 100644 --- a/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.cpp +++ b/tests/auto/widgets/itemviews/qitemeditorfactory/tst_qitemeditorfactory.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/itemviews/qitemview/qitemview.pro b/tests/auto/widgets/itemviews/qitemview/qitemview.pro index 6e1697f790..079953d60d 100644 --- a/tests/auto/widgets/itemviews/qitemview/qitemview.pro +++ b/tests/auto/widgets/itemviews/qitemview/qitemview.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qitemview QT += widgets testlib SOURCES += tst_qitemview.cpp diff --git a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp index 8fd86ea467..d3211eada8 100644 --- a/tests/auto/widgets/itemviews/qitemview/tst_qitemview.cpp +++ b/tests/auto/widgets/itemviews/qitemview/tst_qitemview.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$ ** @@ -90,15 +85,10 @@ class tst_QItemView : public QObject { Q_OBJECT -public: - tst_QItemView() {}; - virtual ~tst_QItemView() {}; - -public slots: +private slots: void init(); void cleanup(); -private slots: void nonDestructiveBasicTest_data(); void nonDestructiveBasicTest(); @@ -288,14 +278,16 @@ void tst_QItemView::populate() const int baseInsert = 26; #endif for (int i = 0; i < 40; ++i) { + const QString iS = QString::number(i); parent = treeModel->index(0, 0, parent); treeModel->insertRows(0, baseInsert + i, parent); treeModel->insertColumns(0, baseInsert + i, parent); // Fill in some values to make it easier to debug for (int x = 0; x < treeModel->rowCount(); ++x) { + const QString xS = QString::number(x); for (int y = 0; y < treeModel->columnCount(); ++y) { QModelIndex index = treeModel->index(x, y, parent); - treeModel->setData(index, QString("%1_%2_%3").arg(x).arg(y).arg(i)); + treeModel->setData(index, xS + QLatin1Char('_') + QString::number(y) + QLatin1Char('_') + iS); treeModel->setData(index, QVariant(QColor(Qt::blue)), Qt::TextColorRole); } } diff --git a/tests/auto/widgets/itemviews/qitemview/viewstotest.cpp b/tests/auto/widgets/itemviews/qitemview/viewstotest.cpp index c108e9a122..f1da2f4fe7 100644 --- a/tests/auto/widgets/itemviews/qitemview/viewstotest.cpp +++ b/tests/auto/widgets/itemviews/qitemview/viewstotest.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/itemviews/qlistview/tst_qlistview.cpp b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp index 3cf9f7fe0b..98cc9b29ed 100644 --- a/tests/auto/widgets/itemviews/qlistview/tst_qlistview.cpp +++ b/tests/auto/widgets/itemviews/qlistview/tst_qlistview.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$ ** @@ -49,6 +44,7 @@ #include <QtWidgets/QDialog> #include <QtWidgets/QStyledItemDelegate> #include <QtWidgets/QStyleFactory> +#include <QtWidgets/QVBoxLayout> #if defined(Q_OS_WIN) || defined(Q_OS_WINCE) # include <windows.h> @@ -74,21 +70,22 @@ static inline void setFrameless(QWidget *w) w->setWindowFlags(flags); } +static QStringList generateList(const QString &prefix, int size) +{ + QStringList result; + result.reserve(size); + for (int i = 0; i < size; ++i) + result.append(prefix + QString::number(i)); + return result; +} + class tst_QListView : public QObject { Q_OBJECT -public: - tst_QListView(); - virtual ~tst_QListView(); - - -public slots: +private slots: void initTestCase(); - void cleanupTestCase(); - void init(); void cleanup(); -private slots: void getSetCheck(); void noDelegate(); void noModel(); @@ -115,7 +112,7 @@ private slots: void scrollBarAsNeeded(); void moveItems(); void wordWrap(); -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && WINVER >= 0x0500 +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) void setCurrentIndexAfterAppendRowCrash(); #endif void emptyItemSize(); @@ -152,6 +149,7 @@ private slots: void taskQTBUG_39902_mutualScrollBars_data(); void taskQTBUG_39902_mutualScrollBars(); void horizontalScrollingByVerticalWheelEvents(); + void taskQTBUG_7232_AllowUserToControlSingleStep(); void taskQTBUG_51086_skippingIndexesInSelectedIndexes(); }; @@ -256,7 +254,7 @@ public: wrongIndex = true; qWarning("got invalid modelIndex %d/%d", idx.row(), idx.column()); } - return QString("%1/%2").arg(idx.row()).arg(idx.column()); + return QString::number(idx.row()) + QLatin1Char('/') + QString::number(idx.column()); } void removeLastRow() @@ -283,24 +281,20 @@ public: mutable bool wrongIndex; }; -tst_QListView::tst_QListView() +class ScrollPerItemListView : public QListView { -} - -tst_QListView::~tst_QListView() -{ -} +public: + explicit ScrollPerItemListView(QWidget *parent = Q_NULLPTR) + : QListView(parent) + { + // Force per item scroll mode since it comes from the style by default + setVerticalScrollMode(QAbstractItemView::ScrollPerItem); + setHorizontalScrollMode(QAbstractItemView::ScrollPerItem); + } +}; void tst_QListView::initTestCase() { -} - -void tst_QListView::cleanupTestCase() -{ -} - -void tst_QListView::init() -{ #ifdef Q_OS_WINCE //disable magic for WindowsCE qApp->setAutoMaximizeThreshold(-1); #endif @@ -311,7 +305,6 @@ void tst_QListView::cleanup() QVERIFY(QApplication::topLevelWidgets().isEmpty()); } - void tst_QListView::noDelegate() { QtTestModel model(0); @@ -365,10 +358,11 @@ void tst_QListView::cursorMove() view.setModel(&model); for (int j = 0; j < columns; ++j) { + const QString postfix = QLatin1Char(',') + QString::number(j) + QLatin1Char(']'); view.setModelColumn(j); for (int i = 0; i < rows; ++i) { QModelIndex index = model.index(i, j); - model.setData(index, QString("[%1,%2]").arg(i).arg(j)); + model.setData(index, QLatin1Char('[') + QString::number(i) + postfix); view.setCurrentIndex(index); QApplication::processEvents(); QCOMPARE(view.currentIndex(), index); @@ -469,7 +463,7 @@ void tst_QListView::hideRows() QStandardItemModel sim(0); QStandardItem *root = new QStandardItem("Root row"); for (int i=0;i<5;i++) - root->appendRow(new QStandardItem(QString("Row %1").arg(i))); + root->appendRow(new QStandardItem(QLatin1String("Row ") + QString::number(i))); sim.appendRow(root); view.setModel(&sim); view.setRootIndex(root->index()); @@ -703,9 +697,11 @@ void tst_QListView::singleSelectionRemoveColumn() int numCols = 3; int numRows = 3; QStandardItemModel model(numCols, numRows); - for (int r = 0; r < numRows; ++r) + for (int r = 0; r < numRows; ++r) { + const QString prefix = QString::number(r) + QLatin1Char(','); for (int c = 0; c < numCols; ++c) - model.setData(model.index(r, c), QString("%1,%2").arg(r).arg(c)); + model.setData(model.index(r, c), prefix + QString::number(c)); + } QListView view; view.setModel(&model); @@ -730,10 +726,11 @@ void tst_QListView::modelColumn() int numCols = 3; int numRows = 3; QStandardItemModel model(numCols, numRows); - for (int r = 0; r < numRows; ++r) + for (int r = 0; r < numRows; ++r) { + const QString prefix = QString::number(r) + QLatin1Char(','); for (int c = 0; c < numCols; ++c) - model.setData(model.index(r, c), QString("%1,%2").arg(r).arg(c)); - + model.setData(model.index(r, c), prefix + QString::number(c)); + } QListView view; view.setModel(&model); @@ -812,10 +809,7 @@ void tst_QListView::batchedMode() { const int rowCount = 3; - QStringList items; - for (int i = 0; i < rowCount; ++i) - items << QLatin1String("item ") + QString::number(i); - QStringListModel model(items); + QStringListModel model(generateList(QLatin1String("item "), rowCount)); QListView view; view.setWindowTitle(QTest::currentTestFunction()); @@ -841,13 +835,9 @@ void tst_QListView::batchedMode() void tst_QListView::setCurrentIndex() { - QStringList items; - int i; - for (i=0; i <20; ++i) - items << QString("item %1").arg(i); - QStringListModel model(items); + QStringListModel model(generateList(QLatin1String("item "), 20)); - QListView view; + ScrollPerItemListView view; view.setModel(&model); view.resize(220,182); @@ -867,7 +857,7 @@ void tst_QListView::setCurrentIndex() int offset = sb->value(); // first "scroll" down, verify that we scroll one step at a time - i = 0; + int i = 0; for (i = 0; i < 20; ++i) { QModelIndex idx = model.index(i,0); view.setCurrentIndex(idx); @@ -1177,7 +1167,7 @@ void tst_QListView::scrollTo() { QWidget topLevel; setFrameless(&topLevel); - QListView lv(&topLevel); + ScrollPerItemListView lv(&topLevel); QStringListModel model(&lv); QStringList list; list << "Short item 1"; @@ -1213,6 +1203,7 @@ void tst_QListView::scrollTo() model.setStringList(list); lv.setModel(&model); lv.setFixedSize(110, 200); + topLevel.show(); QVERIFY(QTest::qWaitForWindowExposed(&topLevel)); @@ -1286,15 +1277,16 @@ void tst_QListView::scrollBarRanges() const int rowHeight = 20; QWidget topLevel; - QListView lv(&topLevel); + ScrollPerItemListView lv(&topLevel); QStringListModel model(&lv); QStringList list; for (int i = 0; i < rowCount; ++i) - list << QString::fromLatin1("Item %1").arg(i); + list << QLatin1String("Item ") + QString::number(i); model.setStringList(list); lv.setModel(&model); lv.resize(250, 130); + TestDelegate *delegate = new TestDelegate(&lv); delegate->m_sizeHint = QSize(100, rowHeight); lv.setItemDelegate(delegate); @@ -1388,17 +1380,13 @@ void tst_QListView::scrollBarAsNeeded() QStringList list; int i; for (i = 0; i < rowCounts[r]; ++i) - list << QString::fromLatin1("Item %1").arg(i); + list << QLatin1String("Item ") + QString::number(i); model.setStringList(list); QApplication::processEvents(); QTest::qWait(50); - QStringList replacement; - for (i = 0; i < itemCount; ++i) { - replacement << QString::fromLatin1("Item %1").arg(i); - } - model.setStringList(replacement); + model.setStringList(generateList(QLatin1String("Item "), itemCount)); QApplication::processEvents(); @@ -1411,10 +1399,9 @@ void tst_QListView::moveItems() { QStandardItemModel model; for (int r = 0; r < 4; ++r) { - for (int c = 0; c < 4; ++c) { - QStandardItem* item = new QStandardItem(QString("standard item (%1,%2)").arg(r).arg(c)); - model.setItem(r, c, item); - } + const QString prefix = QLatin1String("standard item (") + QString::number(r) + QLatin1Char(','); + for (int c = 0; c < 4; ++c) + model.setItem(r, c, new QStandardItem(prefix + QString::number(c) + QLatin1Char(')'))); } PublicListView view; @@ -1456,15 +1443,6 @@ void tst_QListView::wordWrap() lv.setModel(&model); lv.setWordWrap(true); lv.setFixedSize(400, 150); - -#if defined Q_OS_BLACKBERRY - QFont font = lv.font(); - // On BB10 the root window is stretched over the whole screen - // This makes sure that the text will be long enough to produce - // a vertical scrollbar - font.setPixelSize(50); - lv.setFont(font); -#endif lv.showNormal(); QApplication::processEvents(); @@ -1479,8 +1457,10 @@ class SetCurrentIndexAfterAppendRowCrashDialog : public QDialog public: SetCurrentIndexAfterAppendRowCrashDialog() { -#if WINVER >= 0x0500 - listView = new QListView(); + setWindowTitle(QTest::currentTestFunction()); + listView = new QListView(this); + QVBoxLayout *layout = new QVBoxLayout(this); + layout->addWidget(listView); listView->setViewMode(QListView::IconMode); model = new QStandardItemModel(this); @@ -1489,12 +1469,16 @@ public: timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(buttonClicked())); timer->start(1000); + } +protected: + void showEvent(QShowEvent *event) override + { + QDialog::showEvent(event); DWORD lParam = 0xFFFFFFFC/*OBJID_CLIENT*/; DWORD wParam = 0; if (const HWND hwnd =getHWNDForWidget(this)) SendMessage(hwnd, WM_GETOBJECT, wParam, lParam); -#endif } private slots: @@ -1511,24 +1495,22 @@ private: QStandardItemModel *model; QTimer *timer; }; -#endif -#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT) && WINVER >= 0x0500 -// This test only makes sense on windows 2000 and higher. void tst_QListView::setCurrentIndexAfterAppendRowCrash() { SetCurrentIndexAfterAppendRowCrashDialog w; w.exec(); } -#endif +#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT void tst_QListView::emptyItemSize() { QStandardItemModel model; for (int r = 0; r < 4; ++r) { - QStandardItem* item = new QStandardItem(QString("standard item (%1)").arg(r)); - model.setItem(r, 0, item); + const QString text = QLatin1String("standard item (") + QString::number(r) + QLatin1Char(')'); + model.setItem(r, new QStandardItem(text)); } + model.setItem(4, 0, new QStandardItem()); PublicListView view; @@ -1851,7 +1833,7 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems() QWidget topLevel; setFrameless(&topLevel); - QListView view(&topLevel); + ScrollPerItemListView view(&topLevel); QStringListModel model(&view); QStringList list; for (int i = 0; i < rowCount; ++i) @@ -1995,12 +1977,7 @@ public: void tst_QListView::taskQTBUG_9455_wrongScrollbarRanges() { - QStringList list; - const int nrItems = 8; - for (int i = 0; i < nrItems; i++) - list << QString::asprintf("item %d", i); - - QStringListModel model(list); + QStringListModel model(generateList("item ", 8)); ListView_9455 w; setFrameless(&w); w.setModel(&model); @@ -2084,7 +2061,7 @@ void tst_QListView::taskQTBUG_12308_wrongFlowLayout() QListWidgetItem *item = new QListWidgetItem(); item->setText(QString("Item %L1").arg(i)); lw.addItem(item); - if (!item->text().contains(QString::fromLatin1("1"))) + if (!item->text().contains(QLatin1Char('1'))) item->setHidden(true); } lw.show(); @@ -2100,15 +2077,9 @@ void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems_data() void tst_QListView::taskQTBUG_21115_scrollToAndHiddenItems() { -#if defined Q_OS_BLACKBERRY - // On BB10 we need to create a root window which is automatically stretched - // over the whole screen - QWindow rootWindow; - rootWindow.show(); -#endif QFETCH(int, flow); - QListView lv; + ScrollPerItemListView lv; lv.setUniformItemSizes(true); lv.setFlow(static_cast<QListView::Flow>(flow)); @@ -2174,9 +2145,9 @@ void tst_QListView::draggablePaintPairs() view.scrollTo(expectedIndex); QItemViewPaintPairs pairs = privateClass->draggablePaintPairs(indexList, &rect); QCOMPARE(indexList.size(), pairs.size()); - foreach (const QItemViewPaintPair pair, pairs) { - QCOMPARE(rect, pair.first); - QCOMPARE(expectedIndex, pair.second); + foreach (const QItemViewPaintPair &pair, pairs) { + QCOMPARE(rect, pair.rect); + QCOMPARE(expectedIndex, pair.index); } } @@ -2203,7 +2174,7 @@ void tst_QListView::taskQTBUG_21804_hiddenItemsAndScrollingWithKeys() model.setStringList(list); // create listview - QListView lv; + ScrollPerItemListView lv; lv.setFlow(static_cast<QListView::Flow>(flow)); lv.setSpacing(spacing); lv.setModel(&model); @@ -2275,7 +2246,7 @@ void tst_QListView::spacing() model.setStringList(list); // create listview - QListView lv; + ScrollPerItemListView lv; lv.setFlow(static_cast<QListView::Flow>(flow)); lv.setModel(&model); lv.setSpacing(spacing); @@ -2298,12 +2269,6 @@ void tst_QListView::spacing() void tst_QListView::testScrollToWithHidden() { -#if defined Q_OS_BLACKBERRY - // On BB10 we need to create a root window which is automatically stretched - // over the whole screen - QWindow rootWindow; - rootWindow.show(); -#endif QListView lv; QStringListModel model; @@ -2494,6 +2459,44 @@ void tst_QListView::horizontalScrollingByVerticalWheelEvents() QVERIFY(lv.verticalScrollBar()->value() > vValue); } +void tst_QListView::taskQTBUG_7232_AllowUserToControlSingleStep() +{ + // When we set the scrollMode to ScrollPerPixel it will adjust the scrollbars singleStep automatically + // Setting a singlestep on a scrollbar should however imply that the user takes control. + // Setting a singlestep to -1 return to an automatic control of the singleStep. + QListView lv; + lv.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + lv.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + + QStandardItemModel model(1000, 100); + QString str = QString::fromLatin1("This is a long string made to ensure that we get some horizontal scroll (and we want scroll)"); + model.setData(model.index(0, 0), str); + lv.setModel(&model); + lv.setGeometry(150, 150, 150, 150); + lv.show(); + lv.setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + lv.setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); + QVERIFY(QTest::qWaitForWindowExposed(&lv)); + + int vStep1 = lv.verticalScrollBar()->singleStep(); + int hStep1 = lv.horizontalScrollBar()->singleStep(); + QVERIFY(lv.verticalScrollBar()->singleStep() > 1); + QVERIFY(lv.horizontalScrollBar()->singleStep() > 1); + + lv.verticalScrollBar()->setSingleStep(1); + lv.setGeometry(200, 200, 200, 200); + QCOMPARE(lv.verticalScrollBar()->singleStep(), 1); + + lv.horizontalScrollBar()->setSingleStep(1); + lv.setGeometry(150, 150, 150, 150); + QCOMPARE(lv.horizontalScrollBar()->singleStep(), 1); + + lv.verticalScrollBar()->setSingleStep(-1); + lv.horizontalScrollBar()->setSingleStep(-1); + QCOMPARE(vStep1, lv.verticalScrollBar()->singleStep()); + QCOMPARE(hStep1, lv.horizontalScrollBar()->singleStep()); +} + void tst_QListView::taskQTBUG_51086_skippingIndexesInSelectedIndexes() { // simple way to get access to selectedIndexes() diff --git a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp index ecf72613da..e8bd86bee5 100644 --- a/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.cpp +++ b/tests/auto/widgets/itemviews/qlistwidget/tst_qlistwidget.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$ ** @@ -46,7 +41,6 @@ class tst_QListWidget : public QObject public: tst_QListWidget(); - ~tst_QListWidget(); enum ModelChanged { RowsAboutToBeInserted, @@ -59,13 +53,10 @@ public: ColumnsRemoved }; -public slots: +private slots: void initTestCase(); void cleanupTestCase(); void init(); - void cleanup(); - -private slots: void addItem(); void addItem2(); void addItems(); @@ -124,6 +115,7 @@ private slots: void QTBUG8086_currentItemChangedOnClick(); void QTBUG14363_completerWithAnyKeyPressedEditTriggers(); void mimeData(); + void QTBUG50891_ensureSelectionModelSignalConnectionsAreSet(); protected slots: void rowsAboutToBeInserted(const QModelIndex &parent, int first, int last) @@ -162,10 +154,6 @@ tst_QListWidget::tst_QListWidget(): testWidget(0), rcParent(8), rcFirst(8,0), rc { } -tst_QListWidget::~tst_QListWidget() -{ -} - void tst_QListWidget::initTestCase() { testWidget = new QListWidget(); @@ -210,10 +198,6 @@ void tst_QListWidget::checkDefaultValues() QCOMPARE(testWidget->count(), 0); } -void tst_QListWidget::cleanup() -{ -} - void tst_QListWidget::populate() { addItem(); @@ -230,7 +214,7 @@ void tst_QListWidget::populate() void tst_QListWidget::addItem() { int count = testWidget->count(); - QString label = QString("%1").arg(count); + const QString label = QString::number(count); testWidget->addItem(label); QCOMPARE(testWidget->count(), ++count); QCOMPARE(testWidget->item(testWidget->count()-1)->text(), label); @@ -244,7 +228,7 @@ void tst_QListWidget::addItem2() testWidget->addItem(0); QCOMPARE(testWidget->count(), count); - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(count)); + QListWidgetItem *item = new QListWidgetItem(QString::number(count)); item->setFlags(item->flags() | Qt::ItemIsEditable); testWidget->addItem(item); QCOMPARE(testWidget->count(), ++count); @@ -261,10 +245,10 @@ void tst_QListWidget::addItems() QCOMPARE(testWidget->count(), count); QStringList stringList; - QString label = QString("%1").arg(count); - stringList << QString("%1").arg(testWidget->count() + 1) - << QString("%1").arg(testWidget->count() + 2) - << QString("%1").arg(testWidget->count() + 3) + QString label = QString::number(count); + stringList << QString::number(testWidget->count() + 1) + << QString::number(testWidget->count() + 2) + << QString::number(testWidget->count() + 3) << label; testWidget->addItems(stringList); QCOMPARE(testWidget->count(), count + stringList.count()); @@ -276,7 +260,7 @@ void tst_QListWidget::openPersistentEditor() { // Boundary checking testWidget->openPersistentEditor(0); - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); + QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->openPersistentEditor(item); int childCount = testWidget->viewport()->children().count(); @@ -290,7 +274,7 @@ void tst_QListWidget::closePersistentEditor() // Boundary checking int childCount = testWidget->viewport()->children().count(); testWidget->closePersistentEditor(0); - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); + QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->closePersistentEditor(item); QCOMPARE(childCount, testWidget->viewport()->children().count()); @@ -316,7 +300,7 @@ void tst_QListWidget::setItemHidden() if (testWidget->isItemHidden(testWidget->item(i))) totalHidden++; - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); + QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->addItem(item); // Check that nothing else changed @@ -362,7 +346,7 @@ void tst_QListWidget::setCurrentItem() { QFETCH(int, fill); for (int i = 0; i < fill; ++i) - testWidget->addItem(QString("%1").arg(i)); + testWidget->addItem(QString::number(i)); // Boundary checking testWidget->setCurrentItem((QListWidgetItem *)0); @@ -394,7 +378,7 @@ void tst_QListWidget::setCurrentRow() { QFETCH(int, fill); for (int i = 0; i < fill; ++i) - testWidget->addItem(QString("%1").arg(i)); + testWidget->addItem(QString::number(i)); // Boundary checking testWidget->setCurrentRow(-1); @@ -455,7 +439,7 @@ void tst_QListWidget::editItem() { // Boundary checking testWidget->editItem(0); - QListWidgetItem *item = new QListWidgetItem(QString("%1").arg(testWidget->count())); + QListWidgetItem *item = new QListWidgetItem(QString::number(testWidget->count())); testWidget->editItem(item); QFETCH(bool, editable); @@ -650,7 +634,7 @@ void tst_QListWidget::item() QCOMPARE(item, static_cast<QListWidgetItem*>(0)); QCOMPARE(testWidget->count(), 3); } else { - QCOMPARE(item->text(), QString("item%1").arg(row)); + QCOMPARE(item->text(), QStringLiteral("item") + QString::number(row)); QCOMPARE(testWidget->count(), 3); } } @@ -683,7 +667,7 @@ void tst_QListWidget::takeItem() QCOMPARE(item, static_cast<QListWidgetItem*>(0)); QCOMPARE(testWidget->count(), 3); } else { - QCOMPARE(item->text(), QString("item%1").arg(row)); + QCOMPARE(item->text(), QStringLiteral("item") + QString::number(row)); QCOMPARE(testWidget->count(), 2); } @@ -746,7 +730,7 @@ void tst_QListWidget::selectedItems() //insert items for (int i=0; i<itemCount; ++i) - new QListWidgetItem(QString("Item%1").arg(i), testWidget); + new QListWidgetItem(QStringLiteral("Item") + QString::number(i), testWidget); //test the selection testWidget->setSelectionMode(QListWidget::SingleSelection); @@ -1245,8 +1229,8 @@ void tst_QListWidget::insertItemsWithSorting_data() QStringList ascendingItems; QStringList reverseItems; for (int i = 'a'; i <= 'z'; ++i) { - ascendingItems << QString("%0").arg(QLatin1Char(i)); - reverseItems << QString("%0").arg(QLatin1Char('z' - i + 'a')); + ascendingItems << QString(1, QLatin1Char(i)); + reverseItems << QString(1, QLatin1Char('z' - i + 'a')); ascendingRows << i - 'a'; reverseRows << 'z' - i + 'a'; } @@ -1490,7 +1474,7 @@ void tst_QListWidget::fastScroll() QWidget topLevel; MyListWidget widget(&topLevel); for (int i = 0; i < 50; ++i) - widget.addItem(QString("Item %1").arg(i)); + widget.addItem(QStringLiteral("Item ") + QString::number(i)); topLevel.resize(300, 300); // toplevel needs to be wide enough for the item topLevel.show(); @@ -1717,5 +1701,30 @@ void tst_QListWidget::mimeData() delete data2; } +void tst_QListWidget::QTBUG50891_ensureSelectionModelSignalConnectionsAreSet() +{ + qRegisterMetaType<QListWidgetItem*>("QListWidgetItem*"); + QListWidget list; + for (int i = 0 ; i < 4; ++i) + new QListWidgetItem(QString::number(i), &list); + + list.setSelectionModel(new QItemSelectionModel(list.model())); + list.show(); + + QSignalSpy currentItemChangedSpy(&list, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*))); + QSignalSpy itemSelectionChangedSpy(&list, SIGNAL(itemSelectionChanged())); + + QVERIFY(QTest::qWaitForWindowExposed(&list)); + + QCOMPARE(currentItemChangedSpy.count(), 0); + QCOMPARE(itemSelectionChangedSpy.count(), 0); + + QTest::mouseClick(list.viewport(), Qt::LeftButton, 0, list.visualItemRect(list.item(2)).center()); + + QCOMPARE(currentItemChangedSpy.count(), 1); + QCOMPARE(itemSelectionChangedSpy.count(), 1); + +} + QTEST_MAIN(tst_QListWidget) #include "tst_qlistwidget.moc" diff --git a/tests/auto/widgets/itemviews/qtableview/qtableview.pro b/tests/auto/widgets/itemviews/qtableview/qtableview.pro index 0814af77fb..e02da95ab9 100644 --- a/tests/auto/widgets/itemviews/qtableview/qtableview.pro +++ b/tests/auto/widgets/itemviews/qtableview/qtableview.pro @@ -3,6 +3,4 @@ TARGET = tst_qtableview QT += widgets widgets-private testlib QT += core-private gui-private -TARGET.EPOCHEAPSIZE = 0x200000 0x800000 SOURCES += tst_qtableview.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 2bb3f6a136..7258044804 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.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$ ** @@ -65,17 +60,9 @@ class tst_QTableView : public QObject { Q_OBJECT -public: - tst_QTableView(); - virtual ~tst_QTableView(); - -public slots: +private slots: void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); -private slots: void getSetCheck(); void noDelegate(); @@ -215,6 +202,8 @@ private slots: void changeHeaderData(); void viewOptions(); + + void taskQTBUG_7232_AllowUserToControlSingleStep(); }; // Testing get/set functions @@ -326,8 +315,10 @@ public: return QVariant(); } - if (role == Qt::DisplayRole || role == Qt::EditRole) - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()).arg(0); + if (role == Qt::DisplayRole || role == Qt::EditRole) { + return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1String(",0]"); + } return QVariant(); } @@ -416,7 +407,8 @@ public: void reset() { - QAbstractTableModel::reset(); + beginResetModel(); + endResetModel(); } int row_count; @@ -528,14 +520,6 @@ public: QSize hint; }; -tst_QTableView::tst_QTableView() -{ -} - -tst_QTableView::~tst_QTableView() -{ -} - void tst_QTableView::initTestCase() { #ifdef Q_OS_WINCE //disable magic for WindowsCE @@ -543,18 +527,6 @@ void tst_QTableView::initTestCase() #endif } -void tst_QTableView::cleanupTestCase() -{ -} - -void tst_QTableView::init() -{ -} - -void tst_QTableView::cleanup() -{ -} - void tst_QTableView::noDelegate() { QtTestTableModel model(3, 3); @@ -3607,7 +3579,11 @@ public: { return QVariant(); } - void res() { reset(); } + void res() + { + beginResetModel(); + endResetModel(); + } int rows; int columns; @@ -3798,7 +3774,7 @@ public: int role = Qt::DisplayRole) const { if (role == Qt::DisplayRole) - return QString("%1 - %2").arg(index.column()).arg(index.row()); + return QString::number(index.column()) + QLatin1String(" - ") + QString::number(index.row()); return QVariant(); } @@ -3920,12 +3896,12 @@ void tst_QTableView::task227953_setRootIndex() //setup the first table as a child of the first item for ( int row = 0; row < 40; ++row ) { - item1.appendRow(QList<QStandardItem*>() << new QStandardItem(QString("row %0").arg(row))); + item1.appendRow(QList<QStandardItem*>() << new QStandardItem(QLatin1String("row ") + QString::number(row))); } //setup the second table as a child of the second item for ( int row = 0; row < 10; ++row ) { - item2.appendRow(QList<QStandardItem*>() << new QStandardItem(QString("row %0").arg(row))); + item2.appendRow(QList<QStandardItem*>() << new QStandardItem(QLatin1String("row ") + QString::number(row))); } tableView.setModel(&model); @@ -4477,6 +4453,42 @@ void tst_QTableView::taskQTBUG_30653_doItemsLayout() QCOMPARE(scrollToBottomOffset, doItemsLayoutOffset); } +void tst_QTableView::taskQTBUG_7232_AllowUserToControlSingleStep() +{ + // When we set the scrollMode to ScrollPerPixel it will adjust the scrollbars singleStep automatically + // Setting a singlestep on a scrollbar should however imply that the user takes control (and it is not changed by geometry updates). + // Setting a singlestep to -1 return to an automatic control of the singleStep. + QTableView t; + t.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + t.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + QStandardItemModel model(200, 200); + t.setModel(&model); + t.show(); + QVERIFY(QTest::qWaitForWindowExposed(&t)); + t.setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + t.setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); + + t.setGeometry(200, 200, 200, 200); + int vStep1 = t.verticalScrollBar()->singleStep(); + int hStep1 = t.horizontalScrollBar()->singleStep(); + QVERIFY(vStep1 > 1); + QVERIFY(hStep1 > 1); + + t.verticalScrollBar()->setSingleStep(1); + t.setGeometry(300, 300, 300, 300); + QCOMPARE(t.verticalScrollBar()->singleStep(), 1); + + t.horizontalScrollBar()->setSingleStep(1); + t.setGeometry(400, 400, 400, 400); + QCOMPARE(t.horizontalScrollBar()->singleStep(), 1); + + t.setGeometry(200, 200, 200, 200); + t.verticalScrollBar()->setSingleStep(-1); + t.horizontalScrollBar()->setSingleStep(-1); + QCOMPARE(vStep1, t.verticalScrollBar()->singleStep()); + QCOMPARE(hStep1, t.horizontalScrollBar()->singleStep()); +} + void tst_QTableView::taskQTBUG_50171_selectRowAfterSwapColumns() { { diff --git a/tests/auto/widgets/itemviews/qtablewidget/qtablewidget.pro b/tests/auto/widgets/itemviews/qtablewidget/qtablewidget.pro index d2c962b4de..114ce115eb 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/qtablewidget.pro +++ b/tests/auto/widgets/itemviews/qtablewidget/qtablewidget.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtablewidget QT += widgets testlib SOURCES += tst_qtablewidget.cpp diff --git a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp index ea31fd19dd..8f871b03f6 100644 --- a/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.cpp +++ b/tests/auto/widgets/itemviews/qtablewidget/tst_qtablewidget.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$ ** @@ -51,14 +46,11 @@ class tst_QTableWidget : public QObject public: tst_QTableWidget(); - ~tst_QTableWidget(); -public slots: +private slots: void initTestCase(); void cleanupTestCase(); void init(); - void cleanup(); -private slots: void getSetCheck(); void clear(); void clearContents(); @@ -161,10 +153,6 @@ tst_QTableWidget::tst_QTableWidget(): testWidget(0) { } -tst_QTableWidget::~tst_QTableWidget() -{ -} - void tst_QTableWidget::initTestCase() { testWidget = new QTableWidget(); @@ -188,11 +176,6 @@ void tst_QTableWidget::init() testWidget->showColumn(column); } -void tst_QTableWidget::cleanup() -{ - -} - void tst_QTableWidget::clearContents() { QTableWidgetItem *item = new QTableWidgetItem("test"); @@ -1473,7 +1456,7 @@ void tst_QTableWidget::task262056_sortDuplicate() for (int i = 0; i<8; i++ ) { QTableWidgetItem *twi = new QTableWidgetItem(items.at(i)); testWidget->setItem(i,0,twi); - testWidget->setItem(i,1,new QTableWidgetItem(QString("item %1").arg(i))); + testWidget->setItem(i,1,new QTableWidgetItem(QLatin1String("item ") + QString::number(i))); } testWidget->sortItems(0, Qt::AscendingOrder); QSignalSpy layoutChangedSpy(testWidget->model(), SIGNAL(layoutChanged())); diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp index 0f497500cd..611aaa92e6 100644 --- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.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$ ** @@ -76,20 +71,12 @@ class tst_QTreeView : public QObject { Q_OBJECT -public: - tst_QTreeView(); - virtual ~tst_QTreeView(); - - public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - void selectionOrderTest(); private slots: + void initTestCase(); + void getSetCheck(); // one test per QTreeView property @@ -213,6 +200,7 @@ private slots: void taskQTBUG_8176_emitOnExpandAll(); void taskQTBUG_37813_crash(); void taskQTBUG_45697_crash(); + void taskQTBUG_7232_AllowUserToControlSingleStep(); void testInitialFocus(); }; @@ -296,9 +284,12 @@ public: qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), idx.internalPointer()); } + QString result = QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1Char(',') + QString::number(level(idx)) + + QLatin1Char(']'); if (idx.row() & 1) - return QString("[%1,%2,%3] - this item is extra wide").arg(idx.row()).arg(idx.column()).arg(level(idx)); - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()).arg(level(idx)); + result += QLatin1String(" - this item is extra wide"); + return result; } if (decorationsEnabled && role == Qt::DecorationRole) { QPixmap pm(16,16); @@ -356,14 +347,6 @@ public: mutable QMap<QModelIndex,QModelIndex> parentHash; }; -tst_QTreeView::tst_QTreeView() -{ -} - -tst_QTreeView::~tst_QTreeView() -{ -} - void tst_QTreeView::initTestCase() { #ifdef Q_OS_WINCE //disable magic for WindowsCE @@ -371,18 +354,6 @@ void tst_QTreeView::initTestCase() #endif } -void tst_QTreeView::cleanupTestCase() -{ -} - -void tst_QTreeView::init() -{ -} - -void tst_QTreeView::cleanup() -{ -} - // Testing get/set functions void tst_QTreeView::getSetCheck() { @@ -490,7 +461,7 @@ void tst_QTreeView::construction() QCOMPARE(view.sizeHintForRow(1), -1); QVERIFY(!view.tabKeyNavigation()); QCOMPARE(view.textElideMode(), Qt::ElideRight); - QCOMPARE(view.verticalScrollMode(), QAbstractItemView::ScrollPerItem); + QCOMPARE(static_cast<int>(view.verticalScrollMode()), view.style()->styleHint(QStyle::SH_ItemView_ScrollMode, 0, &view)); QCOMPARE(view.visualRect(QModelIndex()), QRect()); // QTreeView properties @@ -2044,13 +2015,14 @@ void tst_QTreeView::rowsAboutToBeRemoved() { QStandardItemModel model(3, 1); for (int i = 0; i < model.rowCount(); i++) { + const QString iS = QString::number(i); QModelIndex index = model.index(i, 0, QModelIndex()); - model.setData(index, QString("%1").arg(i)); + model.setData(index, iS); model.insertRows(0, 4, index); model.insertColumns(0,1,index); for (int i1 = 0; i1 < model.rowCount(index); i1++) { QModelIndex index2 = model.index(i1, 0, index); - model.setData(index2, QString("%1%2").arg(i).arg(i1)); + model.setData(index2, iS + QString::number(i1)); } } @@ -2188,14 +2160,16 @@ void tst_QTreeView::resizeColumnToContents() { QStandardItemModel model(50,2); for (int r = 0; r < model.rowCount(); ++r) { + const QString rS = QString::number(r); for (int c = 0; c < model.columnCount(); ++c) { QModelIndex idx = model.index(r, c); - model.setData(idx, QString::fromLatin1("%1,%2").arg(r).arg(c) ); + model.setData(idx, rS + QLatin1Char(',') + QString::number(c)); model.insertColumns(0, 2, idx); model.insertRows(0, 6, idx); for (int i = 0; i < 6; ++i) { + const QString iS = QString::number(i); for (int j = 0; j < 2 ; ++j) { - model.setData(model.index(i, j, idx), QString::fromLatin1("child%1%2").arg(i).arg(j)); + model.setData(model.index(i, j, idx), QLatin1String("child") + iS + QString::number(j)); } } } @@ -2350,7 +2324,7 @@ void tst_QTreeView::selectionWithHiddenItems() { QStandardItemModel model; for (int i = 0; i < model.rowCount(); ++i) - model.setData(model.index(i,0), QString("row %1").arg(i)); + model.setData(model.index(i,0), QLatin1String("row ") + QString::number(i)); QStandardItem item0("row 0"); QStandardItem item1("row 1"); @@ -2424,7 +2398,7 @@ void tst_QTreeView::selectAll() QCOMPARE(view2.selectedIndexes().count(), model.rowCount() * model.columnCount()); for (int i = 0; i < model.rowCount(); ++i) - model.setData(model.index(i,0), QString("row %1").arg(i)); + model.setData(model.index(i,0), QLatin1String("row ") + QString::number(i)); QTreeView view; view.setModel(&model); int selectedCount = view.selectedIndexes().count(); @@ -2776,8 +2750,9 @@ public: if (parentNode->isDead) qFatal("%s: grandparentNode is dead!", Q_FUNC_INFO); } - return QString("[%1,%2,%3]").arg(idx.row()).arg(idx.column()) - .arg(parentNode->isDead ? "dead" : "alive"); + return QLatin1Char('[') + QString::number(idx.row()) + QLatin1Char(',') + + QString::number(idx.column()) + QLatin1Char(',') + + QLatin1String(parentNode->isDead ? "dead" : "alive") + QLatin1Char(']'); } return QVariant(); } @@ -2980,7 +2955,7 @@ void tst_QTreeView::filterProxyModelCrash() QStandardItemModel model; QList<QStandardItem *> items; for (int i = 0; i < 100; i++) - items << new QStandardItem(QString::fromLatin1("item %1").arg(i)); + items << new QStandardItem(QLatin1String("item ") + QString::number(i)); model.appendColumn(items); QSortFilterProxyModel proxy; @@ -3346,11 +3321,11 @@ void tst_QTreeView::task203696_hidingColumnsAndRowsn() { QTreeView view; QStandardItemModel *model = new QStandardItemModel(0, 3, &view); - for (int i = 0; i < 3; ++i) - { + for (int i = 0; i < 3; ++i) { + const QString prefix = QLatin1String("row ") + QString::number(i) + QLatin1String(" col "); model->insertRow(model->rowCount()); for (int j = 0; j < model->columnCount(); ++j) - model->setData(model->index(i, j), QString("row %1 col %2").arg(i).arg(j)); + model->setData(model->index(i, j), prefix + QString::number(j)); } view.setModel(model); view.show(); @@ -3372,8 +3347,9 @@ void tst_QTreeView::addRowsWhileSectionsAreHidden() for (i = 0; i < 3; ++i) { model->insertRow(model->rowCount()); + const QString prefix = QLatin1String("row ") + QString::number(i) + QLatin1String(" col "); for (int j = 0; j < model->columnCount(); ++j) { - model->setData(model->index(i, j), QString("row %1 col %2").arg(i).arg(j)); + model->setData(model->index(i, j), prefix + QString::number(j)); } } int col; @@ -3382,8 +3358,9 @@ void tst_QTreeView::addRowsWhileSectionsAreHidden() for (i = 3; i < 6; ++i) { model->insertRow(model->rowCount()); + const QString prefix = QLatin1String("row ") + QString::number(i) + QLatin1String(" col "); for (int j = 0; j < model->columnCount(); ++j) { - model->setData(model->index(i, j), QString("row %1 col %2").arg(i).arg(j)); + model->setData(model->index(i, j), prefix + QString::number(j)); } } for (col = 0; col < pass; ++col) @@ -3437,8 +3414,10 @@ void tst_QTreeView::task220298_selectColumns() virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const { - if(role == Qt::DisplayRole) - return QVariant(QString("%1-%2").arg(index.column()).arg(index.row())); + if (role == Qt::DisplayRole) { + return QVariant(QString::number(index.column()) + QLatin1Char('-') + + QString::number(index.row())); + } return QVariant(); } @@ -3476,7 +3455,7 @@ void tst_QTreeView::task224091_appendColumns() QList<QStandardItem *> projlist; for (int k = 0; k < 10; ++k) - projlist.append(new QStandardItem(QString("Top Level %0").arg(k))); + projlist.append(new QStandardItem(QLatin1String("Top Level ") + QString::number(k))); model->appendColumn(projlist); model->invisibleRootItem()->appendRow(new QStandardItem("end")); @@ -3703,7 +3682,7 @@ void tst_QTreeView::task246536_scrollbarsNotWorking() QVERIFY(QTest::qWaitForWindowExposed(&tree)); QList<QStandardItem *> items; for(int i=0; i<100; ++i){ - items << new QStandardItem(QString::fromLatin1("item %1").arg(i)); + items << new QStandardItem(QLatin1String("item ") + QString::number(i)); } model.invisibleRootItem()->appendColumn(items); QTest::qWait(100); @@ -3891,7 +3870,8 @@ void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden() QList<QTreeWidgetItem *> items; const int nrRows = 10; for (int i = 0; i < nrRows; ++i) { - items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); + const QString text = QLatin1String("item: ") + QString::number(i); + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(text))); items.last()->setText(1, QString("is an item")); } tree.insertTopLevelItems(0, items); @@ -3922,9 +3902,11 @@ public: void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint() { QStandardItemModel model(10, 10, this); - for (int row = 0; row < 10; row++) + for (int row = 0; row < 10; row++) { + const QString prefix = QLatin1String("row ") + QString::number(row) + QLatin1String(", col "); for (int col = 0; col < 10; col++) - model.setItem(row, col, new QStandardItem(QString("row %0, col %1").arg(row).arg(col))); + model.setItem(row, col, new QStandardItem(prefix + QString::number(col))); + } TreeViewQTBUG_9216 view; view.setUniformRowHeights(true); view.setModel(&model); @@ -4243,7 +4225,7 @@ void tst_QTreeView::testInitialFocus() { QTreeWidget treeWidget; treeWidget.setColumnCount(5); - new QTreeWidgetItem(&treeWidget, QStringList(QString("1;2;3;4;5").split(";"))); + new QTreeWidgetItem(&treeWidget, QStringList(QString("1;2;3;4;5").split(QLatin1Char(';')))); treeWidget.setTreePosition(2); treeWidget.header()->hideSection(0); // make sure we skip hidden section(s) treeWidget.header()->swapSections(1, 2); // make sure that we look for first visual index (and not first logical) @@ -4297,9 +4279,10 @@ void tst_QTreeView::taskQTBUG_37813_crash() treeWidget.setColumnCount(2); QList<QTreeWidgetItem *> items; for (int r = 0; r < 2; ++r) { + const QString prefix = QLatin1String("Row ") + QString::number(r) + QLatin1String(" Column "); QTreeWidgetItem *item = new QTreeWidgetItem(); for (int c = 0; c < treeWidget.columnCount(); ++c) - item->setText(c, QString::fromLatin1("Row %1 Column %2").arg(r).arg(c)); + item->setText(c, prefix + QString::number(c)); items.append(item); } treeWidget.addTopLevelItems(items); @@ -4390,5 +4373,47 @@ void tst_QTreeView::taskQTBUG_45697_crash() QTRY_VERIFY(testWidget.timerTick() >= 2); } +void tst_QTreeView::taskQTBUG_7232_AllowUserToControlSingleStep() +{ + // When we set the scrollMode to ScrollPerPixel it will adjust the scrollbars singleStep automatically + // Setting a singlestep on a scrollbar should however imply that the user takes control. + // Setting a singlestep to -1 return to an automatic control of the singleStep. + QTreeWidget t; + t.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + t.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn); + t.setColumnCount(2); + QTreeWidgetItem *mainItem = new QTreeWidgetItem(&t, QStringList() << "Root"); + for (int i = 0; i < 200; ++i) { + QTreeWidgetItem *item = new QTreeWidgetItem(mainItem, QStringList(QString("Item"))); + new QTreeWidgetItem(item, QStringList() << "Child" << "1"); + new QTreeWidgetItem(item, QStringList() << "Child" << "2"); + new QTreeWidgetItem(item, QStringList() << "Child" << "3"); + } + t.expandAll(); + + t.setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + t.setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); + + t.setGeometry(200, 200, 200, 200); + int vStep1 = t.verticalScrollBar()->singleStep(); + int hStep1 = t.horizontalScrollBar()->singleStep(); + QVERIFY(vStep1 > 1); + QVERIFY(hStep1 > 1); + + t.verticalScrollBar()->setSingleStep(1); + t.setGeometry(300, 300, 300, 300); + QCOMPARE(t.verticalScrollBar()->singleStep(), 1); + + t.horizontalScrollBar()->setSingleStep(1); + t.setGeometry(400, 400, 400, 400); + QCOMPARE(t.horizontalScrollBar()->singleStep(), 1); + + t.setGeometry(200, 200, 200, 200); + t.verticalScrollBar()->setSingleStep(-1); + t.horizontalScrollBar()->setSingleStep(-1); + QCOMPARE(vStep1, t.verticalScrollBar()->singleStep()); + QCOMPARE(hStep1, t.horizontalScrollBar()->singleStep()); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 117c53a2bb..f1e8c7c814 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.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$ ** @@ -320,7 +315,7 @@ void tst_QTreeWidget::addTopLevelItem() for (int i = 0; i < 100; i += count) { tops.clear(); for (int j = 0; j < count; ++j) - tops << new TreeItem(QStringList() << QString("%0").arg(j)); + tops << new TreeItem(QStringList(QString::number(j))); tree.addTopLevelItems(tops); QCOMPARE(tree.topLevelItemCount(), count + i); for (int j = 0; j < count; ++j) @@ -511,10 +506,10 @@ void tst_QTreeWidget::takeItem() for (int i=0; i<3; ++i) { QTreeWidgetItem *top = new QTreeWidgetItem(testWidget); - top->setText(0, QString("top%1").arg(i)); + top->setText(0, QStringLiteral("top") + QString::number(i)); for (int j=0; j<3; ++j) { QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("child%1").arg(j)); + child->setText(0, QStringLiteral("child") + QString::number(j)); } } @@ -528,7 +523,7 @@ void tst_QTreeWidget::takeItem() QCOMPARE(item, (QTreeWidgetItem *)0); QCOMPARE(count, testWidget->topLevelItemCount()); } else { - QCOMPARE(item->text(0), QString("top%1").arg(index)); + QCOMPARE(item->text(0), QStringLiteral("top") + QString::number(index)); QCOMPARE(count-1, testWidget->topLevelItemCount()); delete item; } @@ -539,7 +534,7 @@ void tst_QTreeWidget::takeItem() QCOMPARE(item, (QTreeWidgetItem *)0); QCOMPARE(count, testWidget->topLevelItem(0)->childCount()); } else { - QCOMPARE(item->text(0), QString("child%1").arg(index)); + QCOMPARE(item->text(0), QStringLiteral("child") + QString::number(index)); QCOMPARE(count-1, testWidget->topLevelItem(0)->childCount()); delete item; } @@ -794,10 +789,11 @@ void tst_QTreeWidget::selectedItems() // create items for (int t=0; t<topLevel; ++t) { QTreeWidgetItem *top = new QTreeWidgetItem(testWidget); - top->setText(0, QString("top%1").arg(t)); + const QString topS = QLatin1String("top") + QString::number(t); + top->setText(0, topS); for (int c=0; c<children; ++c) { QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("top%1child%2").arg(t).arg(c)); + child->setText(0, topS + QLatin1String("child") + QString::number(c)); } } @@ -1442,11 +1438,10 @@ static void fillTreeWidget(QTreeWidgetItem *parent, int rows) { const int columns = parent->treeWidget()->columnCount(); for (int r = 0; r < rows; ++r) { + const QString prefix = QLatin1String("[r:") + QString::number(r) + QLatin1String(",c:"); QTreeWidgetItem *w = new QTreeWidgetItem(parent); - for ( int c = 0; c < columns; ++c ) { - QString s = QString("[r:%1,c:%2]").arg(r).arg(c); - w->setText(c, s); - } + for (int c = 0; c < columns; ++c) + w->setText(c, prefix + QString::number(c) + QLatin1Char(']')); fillTreeWidget(w, rows - r - 1); } } @@ -1455,10 +1450,9 @@ static void fillTreeWidget(QTreeWidget *tree, int rows) { for (int r = 0; r < rows; ++r) { QTreeWidgetItem *w = new QTreeWidgetItem(); - for ( int c = 0; c < tree->columnCount(); ++c ) { - QString s = QString("[r:%1,c:%2]").arg(r).arg(c); - w->setText(c, s); - } + const QString prefix = QLatin1String("[r:") + QString::number(r) + QLatin1String(",c:"); + for (int c = 0; c < tree->columnCount(); ++c) + w->setText(c, prefix + QString::number(c) + QLatin1Char(']')); tree->insertTopLevelItem(r, w); fillTreeWidget(w, rows - r - 1); } @@ -1555,7 +1549,7 @@ void tst_QTreeWidget::keyboardNavigation() } QTreeWidgetItem *current = testWidget->currentItem(); - QCOMPARE(current->text(0), QString("[r:%1,c:0]").arg(row)); + QCOMPARE(current->text(0), QLatin1String("[r:") + QString::number(row) + QLatin1String(",c:0]")); if (current->parent()) QCOMPARE(current->parent()->indexOfChild(current), row); else @@ -1696,7 +1690,7 @@ void tst_QTreeWidget::addChild() for (int i = 0; i < 100; i += count) { QList<QTreeWidgetItem*> list; for (int j = 0; j < count; ++j) - list << new QTreeWidgetItem(QStringList() << QString("%0").arg(j)); + list << new QTreeWidgetItem(QStringList(QString::number(j))); item->addChildren(list); QCOMPARE(item->childCount(), count + i); for (int j = 0; j < count; ++j) { @@ -1743,7 +1737,8 @@ void tst_QTreeWidget::setData() for (int i = 1; i <= 2; ++i) { for (int j = 0; j < 5; ++j) { QVariantList args; - QString text = QString("text %0").arg(i); + const QString iS = QString::number(i); + const QString text = QLatin1String("text ") + iS; item->setText(j, text); QCOMPARE(item->text(j), text); QCOMPARE(itemChangedSpy.count(), 1); @@ -1765,7 +1760,7 @@ void tst_QTreeWidget::setData() item->setIcon(j, icon); QCOMPARE(itemChangedSpy.count(), 0); - QString toolTip = QString("toolTip %0").arg(i); + const QString toolTip = QLatin1String("toolTip ") + iS; item->setToolTip(j, toolTip); QCOMPARE(item->toolTip(j), toolTip); QCOMPARE(itemChangedSpy.count(), 1); @@ -1775,7 +1770,7 @@ void tst_QTreeWidget::setData() item->setToolTip(j, toolTip); QCOMPARE(itemChangedSpy.count(), 0); - QString statusTip = QString("statusTip %0").arg(i); + const QString statusTip = QLatin1String("statusTip ") + iS; item->setStatusTip(j, statusTip); QCOMPARE(item->statusTip(j), statusTip); QCOMPARE(itemChangedSpy.count(), 1); @@ -1785,7 +1780,7 @@ void tst_QTreeWidget::setData() item->setStatusTip(j, statusTip); QCOMPARE(itemChangedSpy.count(), 0); - QString whatsThis = QString("whatsThis %0").arg(i); + const QString whatsThis = QLatin1String("whatsThis ") + iS; item->setWhatsThis(j, whatsThis); QCOMPARE(item->whatsThis(j), whatsThis); QCOMPARE(itemChangedSpy.count(), 1); @@ -2007,7 +2002,7 @@ void tst_QTreeWidget::columnCount() void tst_QTreeWidget::setHeaderLabels() { - QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(","); + QStringList list = QString("a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z").split(QLatin1Char(',')); testWidget->setHeaderLabels(list); QCOMPARE(testWidget->header()->count(), list.count()); } @@ -2147,8 +2142,8 @@ void tst_QTreeWidget::insertItemsWithSorting_data() QStringList ascendingItems; QStringList reverseItems; for (int i = 'a'; i <= 'z'; ++i) { - ascendingItems << QString("%0").arg(QLatin1Char(i)); - reverseItems << QString("%0").arg(QLatin1Char('z' - i + 'a')); + ascendingItems << QString(1, QLatin1Char(i)); + reverseItems << QString(1, QLatin1Char('z' - i + 'a')); ascendingRows << i - 'a'; reverseRows << 'z' - i + 'a'; } @@ -2671,9 +2666,9 @@ void tst_QTreeWidget::expandAndCallapse() QTreeWidgetItem *top = new QTreeWidgetItem(&tw, QStringList() << "top"); QTreeWidgetItem *p; for (int i = 0; i < 10; ++i) { - p = new QTreeWidgetItem(top, QStringList() << QString("%1").arg(i)); + p = new QTreeWidgetItem(top, QStringList(QString::number(i))); for (int j = 0; j < 10; ++j) - new QTreeWidgetItem(p, QStringList() << QString("%1").arg(j)); + new QTreeWidgetItem(p, QStringList(QString::number(j))); } QSignalSpy spy0(&tw, SIGNAL(itemExpanded(QTreeWidgetItem*))); QSignalSpy spy1(&tw, SIGNAL(itemCollapsed(QTreeWidgetItem*))); @@ -3133,7 +3128,7 @@ void tst_QTreeWidget::selectionOrder() testWidget->setColumnCount(1); QList<QTreeWidgetItem *> items; for (int i = 0; i < 10; ++i) - items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QLatin1String("item: ") + QString::number(i)))); testWidget->insertTopLevelItems(0, items); QModelIndex idx = testWidget->indexFromItem(items[0]); diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/qtreewidgetitemiterator.pro b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/qtreewidgetitemiterator.pro index 5fa6762617..42a00618a2 100644 --- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/qtreewidgetitemiterator.pro +++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/qtreewidgetitemiterator.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtreewidgetitemiterator QT += widgets testlib SOURCES += tst_qtreewidgetitemiterator.cpp diff --git a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp index c52198fa2c..f08e57c84b 100644 --- a/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.cpp +++ b/tests/auto/widgets/itemviews/qtreewidgetitemiterator/tst_qtreewidgetitemiterator.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$ ** @@ -46,15 +41,11 @@ class tst_QTreeWidgetItemIterator : public QObject public: tst_QTreeWidgetItemIterator(); - ~tst_QTreeWidgetItemIterator(); -public slots: +private slots: void initTestCase(); void cleanupTestCase(); - void init(); - void cleanup(); -private slots: void postincrement(); void preincrement(); void postdecrement(); @@ -81,10 +72,6 @@ tst_QTreeWidgetItemIterator::tst_QTreeWidgetItemIterator(): testWidget(0) { } -tst_QTreeWidgetItemIterator::~tst_QTreeWidgetItemIterator() -{ -} - void tst_QTreeWidgetItemIterator::initTestCase() { testWidget = new QTreeWidget(); @@ -105,7 +92,8 @@ void tst_QTreeWidgetItemIterator::initTestCase() */ for (int i=0; i <= 16; ++i) { QTreeWidgetItem *top = new QTreeWidgetItem(testWidget); - top->setText(0, QString("top%1").arg(i)); + const QString topS = QLatin1String("top") + QString::number(i); + top->setText(0, topS); switch (i) { case 0: testWidget->setItemHidden(top, true);break; case 1: testWidget->setItemHidden(top, false);break; @@ -136,7 +124,7 @@ void tst_QTreeWidgetItemIterator::initTestCase() } for (int j=0; j <= 16; ++j) { QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("top%1,child%2").arg(i).arg(j)); + child->setText(0, topS + QLatin1String(",child") + QString::number(j)); switch (j) { case 0: testWidget->setItemHidden(child, true);break; case 1: testWidget->setItemHidden(child, false);break; @@ -174,14 +162,6 @@ void tst_QTreeWidgetItemIterator::cleanupTestCase() delete testWidget; } -void tst_QTreeWidgetItemIterator::init() -{ -} - -void tst_QTreeWidgetItemIterator::cleanup() -{ -} - void tst_QTreeWidgetItemIterator::iteratorflags_data() { /* @@ -1074,6 +1054,24 @@ void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget_data() << 3 << 3 << 3 << (int)QTreeWidgetItemIterator::All << 1 << 3 << QString("top0,child1") << QString("top0,child1") << 0; } +static void populate3Levels(QTreeWidget &tw, int topLevelItems, int childItems, int grandChildItems) +{ + for (int i1 = 0; i1 < topLevelItems; ++i1) { + QTreeWidgetItem *top = new QTreeWidgetItem(&tw); + const QString top1S = QLatin1String("top") + QString::number(i1); + top->setText(0, top1S); + for (int i2 = 0; i2 < childItems; ++i2) { + QTreeWidgetItem *child = new QTreeWidgetItem(top); + const QString childS = top1S + QLatin1String(",child") + QString::number(i2); + child->setText(0, childS); + for (int i3 = 0; i3 < grandChildItems; ++i3) { + QTreeWidgetItem *grandChild = new QTreeWidgetItem(child); + grandChild->setText(0, childS + QLatin1String(",grandchild") + QString::number(i3)); + } + } + } +} + void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget() { QFETCH(int, topLevelItems); @@ -1089,18 +1087,7 @@ void tst_QTreeWidgetItemIterator::updateIfModifiedFromWidget() QTreeWidget tw; tw.clear(); tw.setColumnCount(2); - for (int i1=0; i1 < topLevelItems; ++i1) { - QTreeWidgetItem *top = new QTreeWidgetItem(&tw); - top->setText(0, QString("top%1").arg(i1)); - for (int i2=0; i2 < childItems; ++i2) { - QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("top%1,child%2").arg(i1).arg(i2)); - for (int i3=0; i3 < grandChildItems; ++i3) { - QTreeWidgetItem *grandChild = new QTreeWidgetItem(child); - grandChild->setText(0, QString("top%1,child%2,grandchild%3").arg(i1).arg(i2).arg(i3)); - } - } - } + populate3Levels(tw, topLevelItems, childItems, grandChildItems); QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::IteratorFlags(iteratorflags)); it+=expecteditemindex; @@ -1161,18 +1148,7 @@ void tst_QTreeWidgetItemIterator::updateIteratorAfterDeletedItem_and_ContinueIte QTreeWidget tw; tw.clear(); tw.setColumnCount(2); - for (int i1=0; i1 < topLevelItems; ++i1) { - QTreeWidgetItem *top = new QTreeWidgetItem(&tw); - top->setText(0, QString("top%1").arg(i1)); - for (int i2=0; i2 < childItems; ++i2) { - QTreeWidgetItem *child = new QTreeWidgetItem(top); - child->setText(0, QString("top%1,child%2").arg(i1).arg(i2)); - for (int i3=0; i3 < grandChildItems; ++i3) { - QTreeWidgetItem *grandChild = new QTreeWidgetItem(child); - grandChild->setText(0, QString("top%1,child%2,grandchild%3").arg(i1).arg(i2).arg(i3)); - } - } - } + populate3Levels(tw, topLevelItems, childItems, grandChildItems); QTreeWidgetItemIterator it(&tw, QTreeWidgetItemIterator::All); it += iterator_initial_index; diff --git a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp b/tests/auto/widgets/kernel/qaction/tst_qaction.cpp index b496550f85..e6a615d4f5 100644 --- a/tests/auto/widgets/kernel/qaction/tst_qaction.cpp +++ b/tests/auto/widgets/kernel/qaction/tst_qaction.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$ ** @@ -334,9 +329,9 @@ void tst_QAction::task200823_tooltip() action->setShortcut(shortcut); // we want a non-standard tooltip that shows the shortcut - action->setToolTip(QString("%1 (%2)").arg(action->text()).arg(action->shortcut().toString())); + action->setToolTip(action->text() + QLatin1String(" (") + action->shortcut().toString() + QLatin1Char(')')); - QString ref = QString("foo (%1)").arg(QKeySequence(shortcut).toString()); + QString ref = QLatin1String("foo (") + QKeySequence(shortcut).toString() + QLatin1Char(')'); QCOMPARE(action->toolTip(), ref); } diff --git a/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro b/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro index 82c0204aa8..87521edfe9 100644 --- a/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro +++ b/tests/auto/widgets/kernel/qactiongroup/qactiongroup.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qactiongroup QT += widgets testlib SOURCES += tst_qactiongroup.cpp diff --git a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp index 81e5542e91..52ca10d31f 100644 --- a/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.cpp +++ b/tests/auto/widgets/kernel/qactiongroup/tst_qactiongroup.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/kernel/qapplication/desktopsettingsaware/main.cpp b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp index f647d877c5..5e86bcb529 100644 --- a/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.cpp +++ b/tests/auto/widgets/kernel/qapplication/desktopsettingsaware/main.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/kernel/qapplication/modal/base.cpp b/tests/auto/widgets/kernel/qapplication/modal/base.cpp index d6e0c48509..19f8abebbd 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/base.cpp +++ b/tests/auto/widgets/kernel/qapplication/modal/base.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/kernel/qapplication/modal/base.h b/tests/auto/widgets/kernel/qapplication/modal/base.h index 0baef451b8..95eb427e61 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/base.h +++ b/tests/auto/widgets/kernel/qapplication/modal/base.h @@ -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/kernel/qapplication/modal/main.cpp b/tests/auto/widgets/kernel/qapplication/modal/main.cpp index c29378030a..400792637f 100644 --- a/tests/auto/widgets/kernel/qapplication/modal/main.cpp +++ b/tests/auto/widgets/kernel/qapplication/modal/main.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/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 424069c8ae..779773eff0 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.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$ ** @@ -103,13 +98,10 @@ Q_OBJECT public: tst_QApplication(); - virtual ~tst_QApplication(); -public slots: +private slots: void initTestCase(); - void init(); void cleanup(); -private slots: void sendEventsOnProcessEvents(); // this must be the first test void staticSetup(); @@ -133,9 +125,11 @@ private slots: void testDeleteLater(); void testDeleteLaterProcessEvents(); +#ifndef QT_NO_LIBRARY void libraryPaths(); void libraryPaths_qt_plugin_path(); void libraryPaths_qt_plugin_path_2(); +#endif void sendPostedEvents(); @@ -247,17 +241,6 @@ tst_QApplication::tst_QApplication() #endif } -tst_QApplication::~tst_QApplication() -{ - -} - -void tst_QApplication::init() -{ -// TODO: Add initialization code here. -// This will be executed immediately before each test is run. -} - void tst_QApplication::cleanup() { // TODO: Add cleanup code here. @@ -398,11 +381,12 @@ void tst_QApplication::setFont_data() if (!sizes.size()) sizes = fdb.standardSizes(); if (sizes.size() > 0) { - QTest::newRow(QString("data%1a").arg(cnt).toLatin1().constData()) + const QByteArray cntB = QByteArray::number(cnt); + QTest::newRow(("data" + cntB + "a").constData()) << family << sizes.first() << false; - QTest::newRow(QString("data%1b").arg(cnt).toLatin1().constData()) + QTest::newRow(("data" + cntB + "b").constData()) << family << sizes.first() << true; @@ -500,7 +484,7 @@ static QString cstrings2QString( char **args ) while ( args[i] ) { string += args[i]; if ( args[i+1] ) - string += " "; + string += QLatin1Char(' '); ++i; } return string; @@ -909,6 +893,7 @@ bool isPathListIncluded(const QStringList &l, const QStringList &r) return j == r.count(); } +#ifndef QT_NO_LIBRARY #define QT_TST_QAPP_DEBUG void tst_QApplication::libraryPaths() { @@ -1057,16 +1042,16 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() #ifdef Q_OS_UNIX QByteArray validPath = QDir("/tmp").canonicalPath().toLatin1(); QByteArray nonExistentPath = "/nonexistent"; - QByteArray pluginPath = validPath + ":" + nonExistentPath; + QByteArray pluginPath = validPath + ':' + nonExistentPath; #elif defined(Q_OS_WIN) # ifdef Q_OS_WINCE QByteArray validPath = "/Temp"; QByteArray nonExistentPath = "/nonexistent"; - QByteArray pluginPath = validPath + ";" + nonExistentPath; + QByteArray pluginPath = validPath + ';' + nonExistentPath; # else QByteArray validPath = "C:\\windows"; QByteArray nonExistentPath = "Z:\\nonexistent"; - QByteArray pluginPath = validPath + ";" + nonExistentPath; + QByteArray pluginPath = validPath + ';' + nonExistentPath; # endif #endif @@ -1114,6 +1099,7 @@ void tst_QApplication::libraryPaths_qt_plugin_path_2() qputenv("QT_PLUGIN_PATH", QByteArray()); } } +#endif class SendPostedEventsTester : public QObject { diff --git a/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro b/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro index e30a4b57b1..90e83f5285 100644 --- a/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro +++ b/tests/auto/widgets/kernel/qboxlayout/qboxlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qboxlayout QT += widgets testlib SOURCES += tst_qboxlayout.cpp diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index ed5b763b0f..0b35db1b5f 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.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/kernel/qdesktopwidget/qdesktopwidget.pro b/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro index 77709df5da..1ab155f22e 100644 --- a/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro +++ b/tests/auto/widgets/kernel/qdesktopwidget/qdesktopwidget.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdesktopwidget QT += widgets testlib SOURCES += tst_qdesktopwidget.cpp diff --git a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp index e94dfa5754..6f2847974f 100644 --- a/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.cpp +++ b/tests/auto/widgets/kernel/qdesktopwidget/tst_qdesktopwidget.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$ ** @@ -41,15 +36,9 @@ class tst_QDesktopWidget : public QObject { Q_OBJECT -public: - tst_QDesktopWidget(); - virtual ~tst_QDesktopWidget(); - -public slots: - void init(); +private slots: void cleanup(); -private slots: void numScreens(); void primaryScreen(); void screenNumberForQWidget(); @@ -59,18 +48,6 @@ private slots: void topLevels(); }; -tst_QDesktopWidget::tst_QDesktopWidget() -{ -} - -tst_QDesktopWidget::~tst_QDesktopWidget() -{ -} - -void tst_QDesktopWidget::init() -{ -} - void tst_QDesktopWidget::cleanup() { QVERIFY(QApplication::topLevelWidgets().isEmpty()); diff --git a/tests/auto/widgets/kernel/qformlayout/qformlayout.pro b/tests/auto/widgets/kernel/qformlayout/qformlayout.pro index 668b890c97..be944605a3 100644 --- a/tests/auto/widgets/kernel/qformlayout/qformlayout.pro +++ b/tests/auto/widgets/kernel/qformlayout/qformlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qformlayout QT += widgets testlib SOURCES += tst_qformlayout.cpp diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp index 5703d7e114..6c7197b85e 100644 --- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp +++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.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$ ** @@ -184,7 +179,7 @@ void tst_QFormLayout::getItemPosition() QList<QLabel*> labels; QList<QLineEdit*> fields; for (int i = 0; i < 5; ++i) { - labels.append(new QLabel(QString("Label %1").arg(i+1))); + labels.append(new QLabel(QLatin1String("Label " ) + QString::number(i + 1))); fields.append(new QLineEdit); fl->addRow(labels[i], fields[i]); } @@ -496,8 +491,8 @@ void tst_QFormLayout::addRow() QVERIFY(layout->itemAt(0, QFormLayout::LabelRole)->widget() == lbl1); QVERIFY(layout->itemAt(1, QFormLayout::LabelRole)->widget() == lbl2); - QVERIFY(layout->itemAt(2, QFormLayout::LabelRole)->widget()->property("text") == "Foo:"); - QVERIFY(layout->itemAt(3, QFormLayout::LabelRole)->widget()->property("text") == "Bar:"); + QCOMPARE(layout->itemAt(2, QFormLayout::LabelRole)->widget()->property("text").toString(), QLatin1String("Foo:")); + QCOMPARE(layout->itemAt(3, QFormLayout::LabelRole)->widget()->property("text").toString(), QLatin1String("Bar:")); QVERIFY(layout->itemAt(4, QFormLayout::LabelRole) == 0); QVERIFY(layout->itemAt(5, QFormLayout::LabelRole) == 0); diff --git a/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro b/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro index febcee6c55..ee64f8538f 100644 --- a/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro +++ b/tests/auto/widgets/kernel/qgridlayout/qgridlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qgridlayout QT += widgets widgets-private testlib diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp index 255481031b..e5da83ed37 100644 --- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp +++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.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$ ** @@ -540,7 +535,8 @@ public: } private: void init(int numPixels = -1){ - setText(QString::fromLatin1("(%1,%2)").arg(sh.width()).arg(sh.height())); + setText(QLatin1Char('(') + QString::number(sh.width()) + + QLatin1Char(',') + QString::number(sh.height()) + QLatin1Char(')')); setFrameStyle(QFrame::Box | QFrame::Plain); setNumberOfPixels(numPixels); } @@ -1434,8 +1430,9 @@ void tst_QGridLayout::layoutSpacing_data() w->setLayout(layout); int pw = up->sizeHint().width(); int ph = up->sizeHint().height(); - QByteArray testName = QString::fromLatin1("arrowpad with %1 empty rows, %2 empty columns").arg(yoff).arg(xoff).toLatin1(); - QTest::newRow(testName.data()) + QByteArray testName = "arrowpad with " + QByteArray::number(yoff) + + " empty rows, " + QByteArray::number(xoff) + " empty columns"; + QTest::newRow(testName.constData()) << w << (PointList() << QPoint(0 + pw + 5, 3) << QPoint(0, 3 + ph + 10) @@ -1688,7 +1685,7 @@ void tst_QGridLayout::replaceWidget() for (int n = 0; n < itemCount; ++n) { int x = n % 3; int y = n / 3; - labels[n] = new QLabel(QString("label %1").arg(n)); + labels[n] = new QLabel(QLatin1String("label ") + QString::number(n)); Qt::Alignment align = (n % 3 ? Qt::AlignLeft : Qt::AlignRight); l->addWidget(labels[n], x * 3, y * 3, (n % 2) + 1, (n + 1) % 2 + 1, align); } diff --git a/tests/auto/widgets/kernel/qlayout/qlayout.pro b/tests/auto/widgets/kernel/qlayout/qlayout.pro index 8bdbde9282..2213767950 100644 --- a/tests/auto/widgets/kernel/qlayout/qlayout.pro +++ b/tests/auto/widgets/kernel/qlayout/qlayout.pro @@ -12,7 +12,7 @@ wince* { TESTDATA += baseline/* } -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp b/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp index 4d15ac9a93..47fc002196 100644 --- a/tests/auto/widgets/kernel/qlayout/tst_qlayout.cpp +++ b/tests/auto/widgets/kernel/qlayout/tst_qlayout.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$ ** @@ -195,7 +190,7 @@ void tst_QLayout::smartMaxSize() int width = sz.width(); int expectedWidth = expectedWidths[expectedIndex]; if (width != expectedWidth) { - qDebug() << "error at index" << expectedIndex << ":" << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width; + qDebug() << "error at index" << expectedIndex << ':' << sizePolicy.horizontalPolicy() << align << minSize << sizeHint << maxSize << width; ++regressionCount; } ++expectedIndex; @@ -346,7 +341,7 @@ void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated() void tst_QLayout::testRetainSizeWhenHidden() { -#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK) +#if defined(Q_OS_ANDROID) QSKIP("Test does not work on platforms which default to showMaximized()"); #endif diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index 8fcc14bf00..62c75cadf3 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.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$ ** @@ -183,12 +178,13 @@ protected: QKeyEvent *ke = static_cast<QKeyEvent*>(e); if (ke->modifiers() && ke->key() > Qt::Key_Any && ke->key() < Qt::Key_ydiaeresis) { + const QChar c = QLatin1Char(char(ke->key())); if (ke->modifiers() == Qt::ControlModifier) - insertPlainText(QString("<Ctrl+%1>").arg(char(ke->key()))); + insertPlainText(QLatin1String("<Ctrl+") + c + QLatin1Char('>')); else if (ke->modifiers() == Qt::AltModifier) - insertPlainText(QString("<Alt+%1>").arg(char(ke->key()))); + insertPlainText(QLatin1String("<Alt+") + c + QLatin1Char('>')); else if (ke->modifiers() == Qt::ShiftModifier) - insertPlainText(QString("<Shift+%1>").arg(char(ke->key()))); + insertPlainText(QLatin1String("<Shift+") + c + QLatin1Char('>')); return true; } } diff --git a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp index 0f8c9d1c9e..9e5fc55379 100644 --- a/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.cpp +++ b/tests/auto/widgets/kernel/qsizepolicy/tst_qsizepolicy.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/kernel/qstackedlayout/qstackedlayout.pro b/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro index cd80253e12..1f94c1b386 100644 --- a/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro +++ b/tests/auto/widgets/kernel/qstackedlayout/qstackedlayout.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstackedlayout QT += widgets testlib SOURCES += tst_qstackedlayout.cpp diff --git a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp index eec572c3c4..badeca69bb 100644 --- a/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.cpp +++ b/tests/auto/widgets/kernel/qstackedlayout/tst_qstackedlayout.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$ ** @@ -46,16 +41,11 @@ class tst_QStackedLayout : public QObject public: tst_QStackedLayout(); - virtual ~tst_QStackedLayout(); - -public slots: - void initTestCase(); - void cleanupTestCase(); +private slots: void init(); void cleanup(); -private slots: void getSetCheck(); void testCase(); void deleteCurrent(); @@ -100,18 +90,6 @@ tst_QStackedLayout::tst_QStackedLayout() { } -tst_QStackedLayout::~tst_QStackedLayout() -{ -} - -void tst_QStackedLayout::initTestCase() -{ -} - -void tst_QStackedLayout::cleanupTestCase() -{ -} - void tst_QStackedLayout::init() { if (testWidget) { @@ -134,7 +112,6 @@ void tst_QStackedLayout::cleanup() testWidget = 0; } - void tst_QStackedLayout::testCase() { QStackedLayout onStack(testWidget); diff --git a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp index d7746a2ee1..c163117ef3 100644 --- a/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.cpp +++ b/tests/auto/widgets/kernel/qtooltip/tst_qtooltip.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/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 8fc882112e..98a4caf49e 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -9,6 +9,7 @@ osx [updateWhileMinimized] ubuntu-14.04 rhel-7.1 +rhel-7.2 osx [focusProxyAndInputMethods] linux diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index cc1aaa7d51..5a00b0dad9 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.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$ ** @@ -1518,7 +1513,7 @@ void tst_QWidget::mapFromAndTo() subWindow2->setGeometry(75, 75, 100, 100); subSubWindow->setGeometry(10, 10, 10, 10); -#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) || defined(Q_OS_BLACKBERRY) +#if !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) //update visibility if (windowMinimized) { if (!windowHidden) { @@ -5737,7 +5732,7 @@ void tst_QWidget::setToolTip() for (int pass = 0; pass < 2; ++pass) { QCursor::setPos(m_safeCursorPos); QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup)); - popup->setObjectName(QString::fromLatin1("tst_qwidget setToolTip #%1").arg(pass)); + popup->setObjectName(QLatin1String("tst_qwidget setToolTip #") + QString::number(pass)); popup->setWindowTitle(popup->objectName()); popup->setGeometry(50, 50, 150, 50); QFrame *frame = new QFrame(popup.data()); @@ -7445,7 +7440,7 @@ void tst_QWidget::updateWhileMinimized() { if (m_platform == QStringLiteral("wayland")) QSKIP("Wayland: This fails. Figure out why."); -#if defined(Q_OS_QNX) && !defined(Q_OS_BLACKBERRY) +#if defined(Q_OS_QNX) QSKIP("Platform does not support showMinimized()"); #endif UpdateWidget widget; @@ -8001,7 +7996,7 @@ void tst_QWidget::doubleRepaint() // Minmize: Should not trigger a repaint. widget.showMinimized(); QTest::qWait(10); -#if defined(Q_OS_QNX) && !defined(Q_OS_BLACKBERRY) +#if defined(Q_OS_QNX) QEXPECT_FAIL("", "Platform does not support showMinimized()", Continue); #endif QCOMPARE(widget.numPaintEvents, 0); diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h index a523c372ff..87de300da9 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.h @@ -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/kernel/qwidget/tst_qwidget_mac_helpers.mm b/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm index c67682fd85..e2d00aa25b 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget_mac_helpers.mm +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget_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$ ** @@ -39,7 +34,7 @@ #include <qpa/qplatformnativeinterface.h> #include <private/qcore_mac_p.h> -#include <Cocoa/Cocoa.h> +#include <AppKit/AppKit.h> QString nativeWindowTitle(QWidget *window, Qt::WindowState state) { diff --git a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro index d61681d5cb..8672c363a2 100644 --- a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro +++ b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwidget_window QT += widgets testlib core-private gui-private SOURCES += tst_qwidget_window.cpp diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index 3a4b563a6c..35b1596003 100644 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.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/kernel/qwidgetaction/qwidgetaction.pro b/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro index 0029ebd51e..e4158559a9 100644 --- a/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro +++ b/tests/auto/widgets/kernel/qwidgetaction/qwidgetaction.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwidgetaction QT += widgets testlib SOURCES += tst_qwidgetaction.cpp diff --git a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp index 207ce00dbf..1824285f05 100644 --- a/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/widgets/kernel/qwidgetaction/tst_qwidgetaction.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/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp index 5ea1a9d7b7..077e8de328 100644 --- a/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp +++ b/tests/auto/widgets/kernel/qwidgetmetatype/tst_qwidgetmetatype.cpp @@ -1,31 +1,26 @@ /**************************************************************************** ** ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com> -** Contact: http://www.qt.io/licensing/ +** 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/kernel/qwidgetsvariant/qwidgetsvariant.pro b/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro index e3f2da96bd..7979e92087 100644 --- a/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro +++ b/tests/auto/widgets/kernel/qwidgetsvariant/qwidgetsvariant.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qwidgetsvariant INCLUDEPATH += $$PWD/../../../other/qvariant_common SOURCES += tst_qwidgetsvariant.cpp diff --git a/tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.cpp b/tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.cpp index 690ef30f71..fd26e3e4c5 100644 --- a/tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.cpp +++ b/tests/auto/widgets/kernel/qwidgetsvariant/tst_qwidgetsvariant.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/kernel/qwindowcontainer/qwindowcontainer.pro b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro index 4ff05eb04a..17fc1d28b5 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro +++ b/tests/auto/widgets/kernel/qwindowcontainer/qwindowcontainer.pro @@ -1,6 +1,5 @@ CONFIG += testcase mac:CONFIG -= app_bundle -# CONFIG += parallel_test // Cannot be parallel due to the activation test TARGET = tst_qwindowcontainer QT += widgets testlib SOURCES += tst_qwindowcontainer.cpp diff --git a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp index 94b3f9089f..406b21ccf6 100644 --- a/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.cpp +++ b/tests/auto/widgets/kernel/qwindowcontainer/tst_qwindowcontainer.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/styles/qmacstyle/tst_qmacstyle.cpp b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp index 51a6fa64d7..fbd1505b30 100644 --- a/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.cpp +++ b/tests/auto/widgets/styles/qmacstyle/tst_qmacstyle.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/styles/qstyle/qstyle.pro b/tests/auto/widgets/styles/qstyle/qstyle.pro index b4546aa760..50445b9a45 100644 --- a/tests/auto/widgets/styles/qstyle/qstyle.pro +++ b/tests/auto/widgets/styles/qstyle/qstyle.pro @@ -1,7 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qstyle -TARGET.EPOCHEAPSIZE = 0x200000 0x800000 QT += widgets testlib SOURCES += tst_qstyle.cpp @@ -11,7 +9,7 @@ wince* { DEPLOYMENT += addPixmap } -android: !android-no-sdk { +android { RESOURCES += \ testdata.qrc } diff --git a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp b/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp index 361a7e7ed4..5c213fea04 100644 --- a/tests/auto/widgets/styles/qstyle/tst_qstyle.cpp +++ b/tests/auto/widgets/styles/qstyle/tst_qstyle.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$ ** @@ -92,17 +87,15 @@ class tst_QStyle : public QObject Q_OBJECT public: tst_QStyle(); - virtual ~tst_QStyle(); + private: bool testAllFunctions(QStyle *); bool testScrollBarSubControls(QStyle *); void testPainting(QStyle *style, const QString &platform); private slots: void drawItemPixmap(); - void initTestCase(); - void cleanup(); - void cleanupTestCase(); void init(); + void cleanup(); #ifndef QT_NO_STYLE_FUSION void testFusionStyle(); #endif @@ -145,10 +138,6 @@ tst_QStyle::tst_QStyle() testWidget = 0; } -tst_QStyle::~tst_QStyle() -{ -} - class MyWidget : public QWidget { public: @@ -168,14 +157,6 @@ void tst_QStyle::cleanup() testWidget = 0; } -void tst_QStyle::initTestCase() -{ -} - -void tst_QStyle::cleanupTestCase() -{ -} - void tst_QStyle::testStyleFactory() { QStringList keys = QStyleFactory::keys(); diff --git a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro index 2ca24c4f43..bf12a6b30f 100644 --- a/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro +++ b/tests/auto/widgets/styles/qstyleoption/qstyleoption.pro @@ -2,7 +2,6 @@ TEMPLATE = app TARGET = tst_qstyleoption CONFIG += testcase -CONFIG += parallel_test QT += widgets testlib SOURCES += tst_qstyleoption.cpp diff --git a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp index 2e26ba609b..883336b28f 100644 --- a/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.cpp +++ b/tests/auto/widgets/styles/qstyleoption/tst_qstyleoption.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/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 5da11e38ca..a506bbb114 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.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$ ** @@ -55,6 +50,7 @@ public: ~tst_QStyleSheetStyle(); private slots: + void init(); void repolish(); void numinstances(); void widgetsBeforeAppStyleSheet(); @@ -71,8 +67,12 @@ private slots: void layoutSpacing(); #endif void qproperty(); + void palettePropagation_data(); void palettePropagation(); + void fontPropagation_data(); void fontPropagation(); + void widgetStylePropagation_data(); + void widgetStylePropagation(); void onWidgetDestroyed(); void fontPrecedence(); void focusColors(); @@ -137,6 +137,12 @@ tst_QStyleSheetStyle::~tst_QStyleSheetStyle() { } +void tst_QStyleSheetStyle::init() +{ + qApp->setStyleSheet(QString()); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, false); +} + void tst_QStyleSheetStyle::numinstances() { QWidget w; @@ -627,31 +633,80 @@ void tst_QStyleSheetStyle::namespaces() QCOMPARE(BACKGROUND(pb2), red); } +void tst_QStyleSheetStyle::palettePropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<bool>("widgetStylePropagation"); + QTest::newRow("Widget style propagation") << " " << true; + QTest::newRow("Widget style propagation, no application style sheet") << QString() << true; + QTest::newRow("Default propagation") << " " << false; + QTest::newRow("Default propagation, no application style sheet") << QString() << false; +} + void tst_QStyleSheetStyle::palettePropagation() { - qApp->setStyleSheet(""); + QFETCH(QString, applicationStyleSheet); + QFETCH(bool, widgetStylePropagation); + + qApp->setStyleSheet(applicationStyleSheet); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, widgetStylePropagation); + QGroupBox gb; - QPushButton *push = new QPushButton(&gb); - QPushButton &pb = *push; - push->setText("AsdF"); + QLabel *label = new QLabel(&gb); + QLabel &lb = *label; + label->setText("AsdF"); gb.setStyleSheet("QGroupBox { color: red }"); - QVERIFY(COLOR(gb) == Qt::red); - QVERIFY(COLOR(pb) == APPCOLOR(pb)); // palette shouldn't propagate - gb.setStyleSheet("QGroupBox * { color: red }"); + QCOMPARE(COLOR(gb), QColor(Qt::red)); - QVERIFY(COLOR(pb) == Qt::red); - QVERIFY(COLOR(gb) == APPCOLOR(gb)); + if (widgetStylePropagation) { + QCOMPARE(COLOR(lb), QColor(Qt::red)); // palette should propagate in standard mode + } else { + QCOMPARE(COLOR(lb), APPCOLOR(lb)); // palette shouldn't propagate + } QWidget window; + lb.setParent(&window); + if (widgetStylePropagation) { + // In standard propagation mode, widgets that are not explicitly + // targeted do not have their propagated palette unset when they are + // unpolished by changing parents. This is consistent with regular Qt + // widgets, who also maintain their propagated palette when changing + // parents + QCOMPARE(COLOR(lb), QColor(Qt::red)); + } else { + QCOMPARE(COLOR(lb), APPCOLOR(lb)); + } + lb.setParent(&gb); + + gb.setStyleSheet("QGroupBox * { color: red }"); + + QCOMPARE(COLOR(lb), QColor(Qt::red)); + QCOMPARE(COLOR(gb), APPCOLOR(gb)); + window.setStyleSheet("* { color: white; }"); - pb.setParent(&window); - QVERIFY(COLOR(pb) == Qt::white); + lb.setParent(&window); + QCOMPARE(COLOR(lb), QColor(Qt::white)); +} + +void tst_QStyleSheetStyle::fontPropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<bool>("widgetStylePropagation"); + QTest::newRow("Widget style propagation") << " " << true; + QTest::newRow("Widget style propagation, no application style sheet") << QString() << true; + QTest::newRow("Default propagation") << " " << false; + QTest::newRow("Default propagation, no application style sheet") << QString() << false; } void tst_QStyleSheetStyle::fontPropagation() { - qApp->setStyleSheet(""); + QFETCH(QString, applicationStyleSheet); + QFETCH(bool, widgetStylePropagation); + + qApp->setStyleSheet(applicationStyleSheet); + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, widgetStylePropagation); + QComboBox cb; cb.addItem("item1"); cb.addItem("item2"); @@ -661,7 +716,11 @@ void tst_QStyleSheetStyle::fontPropagation() cb.setStyleSheet("QComboBox { font-size: 20pt; }"); QCOMPARE(FONTSIZE(cb), 20); - QCOMPARE(FONTSIZE(*popup), viewFontSize); + if (widgetStylePropagation) { + QCOMPARE(FONTSIZE(*popup), 20); + } else { + QCOMPARE(FONTSIZE(*popup), viewFontSize); + } QGroupBox gb; QPushButton *push = new QPushButton(&gb); QPushButton &pb = *push; @@ -670,7 +729,11 @@ void tst_QStyleSheetStyle::fontPropagation() gb.setStyleSheet("QGroupBox { font-size: 20pt }"); QCOMPARE(FONTSIZE(gb), 20); - QVERIFY(FONTSIZE(pb) == buttonFontSize); // font does not propagate + if (widgetStylePropagation) { + QCOMPARE(FONTSIZE(pb), 20); + } else { + QCOMPARE(FONTSIZE(pb), buttonFontSize); // font does not propagate + } gb.setStyleSheet("QGroupBox * { font-size: 20pt; }"); QCOMPARE(FONTSIZE(gb), gbFontSize); QCOMPARE(FONTSIZE(pb), 20); @@ -1471,12 +1534,14 @@ void tst_QStyleSheetStyle::embeddedFonts() QCOMPARE(spin.font().pixelSize(), 32); QCOMPARE(embedded->font().pixelSize(), 32); +#ifndef QT_NO_CONTEXTMENU QMenu *menu = embedded->createStandardContextMenu(); menu->show(); QTest::qWait(20); QVERIFY(menu); QVERIFY(menu->font().pixelSize() != 32); QCOMPARE(menu->font().pixelSize(), qApp->font(menu).pixelSize()); +#endif // QT_NO_CONTEXTMENU //task 242556 QComboBox box; @@ -1744,8 +1809,11 @@ void tst_QStyleSheetStyle::QTBUG36933_brokenPseudoClassLookup() QTableWidget widget(rowCount, columnCount); for (int row = 0; row < rowCount; ++row) { - for (int column = 0; column < columnCount; ++column) - widget.setItem(row, column, new QTableWidgetItem(QStringLiteral("row %1 column %2").arg(row + 1).arg(column + 1))); + for (int column = 0; column < columnCount; ++column) { + const QString t = QLatin1String("row ") + QString::number(row + 1) + + QLatin1String(" column ") + QString::number(column + 1); + widget.setItem(row, column, new QTableWidgetItem(t)); + } // put no visible text for the vertical headers, but still put some text or they will collapse widget.setVerticalHeaderItem(row, new QTableWidgetItem(QStringLiteral(" "))); @@ -1794,6 +1862,138 @@ void tst_QStyleSheetStyle::styleSheetChangeBeforePolish() QVERIFY(testForColors(image2, QColor(0x00, 0xFF, 0x00))); } +void tst_QStyleSheetStyle::widgetStylePropagation_data() +{ + QTest::addColumn<QString>("applicationStyleSheet"); + QTest::addColumn<QString>("parentStyleSheet"); + QTest::addColumn<QString>("childStyleSheet"); + QTest::addColumn<QFont>("parentFont"); + QTest::addColumn<QFont>("childFont"); + QTest::addColumn<QPalette>("parentPalette"); + QTest::addColumn<QPalette>("childPalette"); + QTest::addColumn<int>("parentExpectedSize"); + QTest::addColumn<int>("childExpectedSize"); + QTest::addColumn<QColor>("parentExpectedColor"); + QTest::addColumn<QColor>("childExpectedColor"); + + QFont noFont; + QFont font45; font45.setPointSize(45); + QFont font32; font32.setPointSize(32); + + QPalette noPalette; + QPalette redPalette; redPalette.setColor(QPalette::WindowText, QColor("red")); + QPalette greenPalette; greenPalette.setColor(QPalette::WindowText, QColor("green")); + + QLabel defaultLabel; + + int defaultSize = defaultLabel.font().pointSize(); + QColor defaultColor = defaultLabel.palette().color(defaultLabel.foregroundRole()); + QColor redColor("red"); + QColor greenColor("green"); + + // Check regular Qt propagation works as expected, with and without a + // non-interfering application stylesheet + QTest::newRow("defaults") + << QString() << QString() << QString() + << noFont << noFont << noPalette << noPalette + << defaultSize << defaultSize << defaultColor << defaultColor; + QTest::newRow("parent font propagation, no application style sheet") + << QString() << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + QTest::newRow("parent font propagation, dummy application style sheet") + << "QGroupBox { font-size: 64pt }" << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + QTest::newRow("parent color propagation, no application style sheet") + << QString() << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + QTest::newRow("parent color propagation, dummy application style sheet") + << "QGroupBox { color: blue }" << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + + // Parent style sheet propagates to child if child has not explicitly + // set a value + QTest::newRow("parent style sheet color propagation") + << "#parentLabel { color: red }" << QString() << QString() + << noFont << noFont << noPalette << noPalette + << defaultSize << defaultSize << redColor << redColor; + QTest::newRow("parent style sheet font propagation") + << "#parentLabel { font-size: 45pt }" << QString() << QString() + << noFont << noFont << noPalette << noPalette + << 45 << 45 << defaultColor << defaultColor; + + // Parent style sheet does not propagate to child if child has explicitly + // set a value + QTest::newRow("parent style sheet color propagation, child explicitly set") + << "#parentLabel { color: red }" << QString() << QString() + << noFont << noFont << noPalette << greenPalette + << defaultSize << defaultSize << redColor << greenColor; + QTest::newRow("parent style sheet font propagation, child explicitly set") + << "#parentLabel { font-size: 45pt }" << QString() << QString() + << noFont << font32 << noPalette << noPalette + << 45 << 32 << defaultColor << defaultColor; + + // Parent does not propagate to child when child is target of style sheet + QTest::newRow("parent style sheet font propagation, child application style sheet") + << "#childLabel { font-size: 32pt }" << QString() << QString() + << font45 << noFont << noPalette << noPalette + << 45 << 32 << defaultColor << defaultColor; + QTest::newRow("parent style sheet color propagation, child application style sheet") + << "#childLabel { color: green }" << QString() << QString() + << noFont << noFont << redPalette << noPalette + << defaultSize << defaultSize << redColor << greenColor; +} + +void tst_QStyleSheetStyle::widgetStylePropagation() +{ + QFETCH(QString, applicationStyleSheet); + QFETCH(QString, parentStyleSheet); + QFETCH(QString, childStyleSheet); + + QFETCH(QFont, parentFont); + QFETCH(QFont, childFont); + QFETCH(QPalette, parentPalette); + QFETCH(QPalette, childPalette); + + QFETCH(int, parentExpectedSize); + QFETCH(int, childExpectedSize); + QFETCH(QColor, parentExpectedColor); + QFETCH(QColor, childExpectedColor); + + QCoreApplication::setAttribute(Qt::AA_UseStyleSheetPropagationInWidgetStyles, true); + + qApp->setStyleSheet(applicationStyleSheet); + + QLabel parentLabel; + parentLabel.setObjectName("parentLabel"); + QLabel childLabel(&parentLabel); + childLabel.setObjectName("childLabel"); + + if (parentFont.resolve()) + parentLabel.setFont(parentFont); + if (childFont.resolve()) + childLabel.setFont(childFont); + if (parentPalette.resolve()) + parentLabel.setPalette(parentPalette); + if (childPalette.resolve()) + childLabel.setPalette(childPalette); + if (!parentStyleSheet.isEmpty()) + parentLabel.setStyleSheet(parentStyleSheet); + if (!childStyleSheet.isEmpty()) + childLabel.setStyleSheet(childStyleSheet); + + parentLabel.ensurePolished(); + childLabel.ensurePolished(); + + QCOMPARE(FONTSIZE(parentLabel), parentExpectedSize); + QCOMPARE(FONTSIZE(childLabel), childExpectedSize); + QCOMPARE(COLOR(parentLabel), parentExpectedColor); + QCOMPARE(COLOR(childLabel), childExpectedColor); +} + QTEST_MAIN(tst_QStyleSheetStyle) #include "tst_qstylesheetstyle.moc" diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp index 2a14d752e1..50e11611f2 100644 --- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.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$ ** @@ -61,7 +56,7 @@ public: protected: QStringList splitPath(const QString &path) const { - return csv ? path.split(",") : QCompleter::splitPath(path); + return csv ? path.split(QLatin1Char(',')) : QCompleter::splitPath(path); } private: @@ -382,7 +377,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data() QTest::addColumn<QString>("completion"); QTest::addColumn<QString>("completionText"); -#define ROWNAME(name) (qPrintable(QString("%1 %2").arg(name).arg(i))) +#define ROWNAME(name) ((QByteArray(name) + ' ' + QByteArray::number(i)).constData()) for (int i = 0; i < 2; i++) { if (i == 1) @@ -1179,7 +1174,7 @@ void tst_QCompleter::dynamicSortOrder() completer.setModelSorting(QCompleter::CaseSensitivelySortedModel); QStandardItem *root = model.invisibleRootItem(); for (int i = 0; i < 20; i++) { - root->appendRow(new QStandardItem(QString("%1").arg(i))); + root->appendRow(new QStandardItem(QString::number(i))); } root->appendRow(new QStandardItem("13")); root->sortChildren(0, Qt::AscendingOrder); @@ -1271,7 +1266,7 @@ void tst_QCompleter::task189564_omitNonSelectableItems() QStringList strings; for (int i = 0; i < n; ++i) - strings << QString("%1%2").arg(prefix).arg(i); + strings << prefix + QString::number(i); const QString omitString(strings.at(n / 2)); task189564_StringListModel model(omitString); model.setStringList(strings); @@ -1568,9 +1563,9 @@ void tst_QCompleter::task247560_keyboardNavigation() QStandardItemModel model; for (int i = 0; i < 5; i++) { - for (int j = 0; j < 5; j++) { - model.setItem(i, j, new QStandardItem(QString("row %1 column %2").arg(i).arg(j))); - } + const QString prefix = QLatin1String("row ") + QString::number(i) + QLatin1String(" column "); + for (int j = 0; j < 5; j++) + model.setItem(i, j, new QStandardItem(prefix + QString::number(j))); } diff --git a/tests/auto/widgets/util/qscroller/qscroller.pro b/tests/auto/widgets/util/qscroller/qscroller.pro index 55f57f5ed1..29e8378f2b 100644 --- a/tests/auto/widgets/util/qscroller/qscroller.pro +++ b/tests/auto/widgets/util/qscroller/qscroller.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qscroller QT += widgets testlib gui-private diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp index 58a655321c..2c398e1b2f 100644 --- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp +++ b/tests/auto/widgets/util/qscroller/tst_qscroller.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 $MODULE$ 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/util/qsystemtrayicon/qsystemtrayicon.pro b/tests/auto/widgets/util/qsystemtrayicon/qsystemtrayicon.pro index d409d23650..e9310fc234 100644 --- a/tests/auto/widgets/util/qsystemtrayicon/qsystemtrayicon.pro +++ b/tests/auto/widgets/util/qsystemtrayicon/qsystemtrayicon.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsystemtrayicon QT += widgets testlib SOURCES += tst_qsystemtrayicon.cpp diff --git a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp index 05511a17a1..a932cf5984 100644 --- a/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.cpp +++ b/tests/auto/widgets/util/qsystemtrayicon/tst_qsystemtrayicon.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/util/qundogroup/tst_qundogroup.cpp b/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp index 2b82cbfd03..99d067b7d7 100644 --- a/tests/auto/widgets/util/qundogroup/tst_qundogroup.cpp +++ b/tests/auto/widgets/util/qundogroup/tst_qundogroup.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/util/qundostack/tst_qundostack.cpp b/tests/auto/widgets/util/qundostack/tst_qundostack.cpp index 22867aba7c..8573cea35f 100644 --- a/tests/auto/widgets/util/qundostack/tst_qundostack.cpp +++ b/tests/auto/widgets/util/qundostack/tst_qundostack.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/widgets/qabstractbutton/tst_qabstractbutton.cpp b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp index 43d6912c6e..9efa8cf47e 100644 --- a/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.cpp +++ b/tests/auto/widgets/widgets/qabstractbutton/tst_qabstractbutton.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$ ** @@ -48,17 +43,11 @@ class tst_QAbstractButton : public QObject { Q_OBJECT -public: - tst_QAbstractButton(); - virtual ~tst_QAbstractButton(); - - -public slots: +private slots: void initTestCase(); void cleanupTestCase(); void init(); - void cleanup(); -private slots: + void setAutoRepeat_data(); void setAutoRepeat(); @@ -147,14 +136,6 @@ private: } }; -tst_QAbstractButton::tst_QAbstractButton() -{ -} - -tst_QAbstractButton::~tst_QAbstractButton() -{ -} - void tst_QAbstractButton::initTestCase() { testWidget = new MyButton(0); @@ -188,10 +169,6 @@ void tst_QAbstractButton::init() click_count = 0; } -void tst_QAbstractButton::cleanup() -{ -} - void tst_QAbstractButton::resetValues() { toggle_count = 0; diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/qabstractscrollarea.pro b/tests/auto/widgets/widgets/qabstractscrollarea/qabstractscrollarea.pro index 911898407b..2d9aa52e3a 100644 --- a/tests/auto/widgets/widgets/qabstractscrollarea/qabstractscrollarea.pro +++ b/tests/auto/widgets/widgets/qabstractscrollarea/qabstractscrollarea.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractscrollarea QT += widgets testlib SOURCES += tst_qabstractscrollarea.cpp diff --git a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp index 129b9e97d0..60efcddc60 100644 --- a/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.cpp +++ b/tests/auto/widgets/widgets/qabstractscrollarea/tst_qabstractscrollarea.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/widgets/qabstractslider/qabstractslider.pro b/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro index 020be08867..6453999786 100644 --- a/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro +++ b/tests/auto/widgets/widgets/qabstractslider/qabstractslider.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractslider QT += widgets testlib SOURCES += tst_qabstractslider.cpp diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp index a9fe805e39..17a5320433 100644 --- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.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/widgets/qabstractspinbox/qabstractspinbox.pro b/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro index 8fa1c0fcac..f9b601228e 100644 --- a/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro +++ b/tests/auto/widgets/widgets/qabstractspinbox/qabstractspinbox.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qabstractspinbox QT += widgets testlib SOURCES += tst_qabstractspinbox.cpp diff --git a/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp b/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp index 53234f33de..36f5df4649 100644 --- a/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.cpp +++ b/tests/auto/widgets/widgets/qabstractspinbox/tst_qabstractspinbox.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/widgets/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp index 5dec6224ca..7684f16c47 100644 --- a/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/widgets/widgets/qbuttongroup/tst_qbuttongroup.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,14 +63,7 @@ protected: class tst_QButtonGroup : public QObject { Q_OBJECT -public: - tst_QButtonGroup(); -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); private slots: void arrowKeyNavigation(); void exclusive(); @@ -91,27 +79,6 @@ private slots: void task209485_removeFromGroupInEventHandler(); }; -tst_QButtonGroup::tst_QButtonGroup() -{ -} - - -void tst_QButtonGroup::initTestCase() -{ -} - -void tst_QButtonGroup::cleanupTestCase() -{ -} - -void tst_QButtonGroup::init() -{ -} - -void tst_QButtonGroup::cleanup() -{ -} - QT_BEGIN_NAMESPACE extern bool Q_GUI_EXPORT qt_tab_all_widgets(); QT_END_NAMESPACE diff --git a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp index 9b8ab110cd..8e4a800a75 100644 --- a/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.cpp +++ b/tests/auto/widgets/widgets/qcalendarwidget/tst_qcalendarwidget.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$ ** @@ -46,15 +41,6 @@ class tst_QCalendarWidget : public QObject { Q_OBJECT -public: - tst_QCalendarWidget(); - virtual ~tst_QCalendarWidget(); -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void getSetCheck(); void buttonClickCheck(); @@ -265,31 +251,6 @@ void tst_QCalendarWidget::setWeekdayFormat() } } -tst_QCalendarWidget::tst_QCalendarWidget() -{ -} - -tst_QCalendarWidget::~tst_QCalendarWidget() -{ -} - -void tst_QCalendarWidget::initTestCase() -{ -} - -void tst_QCalendarWidget::cleanupTestCase() -{ -} - -void tst_QCalendarWidget::init() -{ -} - -void tst_QCalendarWidget::cleanup() -{ -} - - typedef void (QCalendarWidget::*ShowFunc)(); Q_DECLARE_METATYPE(ShowFunc) diff --git a/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp b/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp index 5696382fab..c9699bfb81 100644 --- a/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.cpp +++ b/tests/auto/widgets/widgets/qcheckbox/tst_qcheckbox.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$ ** @@ -45,17 +40,12 @@ class tst_QCheckBox : public QObject { Q_OBJECT -public: - tst_QCheckBox(); - virtual ~tst_QCheckBox(); - -public slots: +private slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); -private slots: void setChecked(); void setTriState(); void setText_data(); @@ -86,14 +76,6 @@ private: QCheckBox *testWidget; }; -tst_QCheckBox::tst_QCheckBox() -{ -} - -tst_QCheckBox::~tst_QCheckBox() -{ -} - void tst_QCheckBox::initTestCase() { // Create the test class diff --git a/tests/auto/widgets/widgets/qcombobox/qcombobox.pro b/tests/auto/widgets/widgets/qcombobox/qcombobox.pro index 03e8ed75ed..88b9d08557 100644 --- a/tests/auto/widgets/widgets/qcombobox/qcombobox.pro +++ b/tests/auto/widgets/widgets/qcombobox/qcombobox.pro @@ -2,4 +2,3 @@ CONFIG += testcase TARGET = tst_qcombobox QT += widgets widgets-private gui-private core-private testlib SOURCES += tst_qcombobox.cpp -DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 15bf686699..50024460fc 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.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$ ** @@ -2316,9 +2311,10 @@ void tst_QComboBox::task191329_size() QStandardItemModel model(rows, 2); for (int row = 0; row < model.rowCount(); ++row) { + const QString rowS = QLatin1String("row ") + QString::number(row); for (int column = 0; column < model.columnCount(); ++column) { - QStandardItem *item = new QStandardItem(QString("row %0, column %1").arg(row).arg(column)); - model.setItem(row, column, item); + const QString text = rowS + QLatin1String(", column ") + QString::number(column); + model.setItem(row, column, new QStandardItem(text)); } } QTableView *table = new QTableView(); @@ -2401,7 +2397,7 @@ void tst_QComboBox::task248169_popupWithMinimalSize() QTest::qWaitForWindowExposed(comboBox.view()); QTRY_VERIFY(comboBox.view()->isVisible()); -#if defined QT_BUILD_INTERNAL && !defined Q_OS_BLACKBERRY +#if defined QT_BUILD_INTERNAL QFrame *container = comboBox.findChild<QComboBoxPrivateContainer *>(); QVERIFY(container); QTRY_VERIFY(desktop.screenGeometry(container).contains(container->geometry())); @@ -2695,7 +2691,8 @@ void tst_QComboBox::resetModel() void reset() { - QStringListModel::reset(); + QStringListModel::beginResetModel(); + QStringListModel::endResetModel(); } }; QComboBox cb; @@ -2867,10 +2864,11 @@ void tst_QComboBox::task_QTBUG_10491_currentIndexAndModelColumn() QStandardItemModel model(4, 4, &comboBox); for (int i = 0; i < 4; i++){ - model.setItem(i, 0, new QStandardItem(QString("Employee Nr %1").arg(i))); - model.setItem(i, 1, new QStandardItem(QString("Street Nr %1").arg(i))); - model.setItem(i, 2, new QStandardItem(QString("Town Nr %1").arg(i))); - model.setItem(i, 3, new QStandardItem(QString("Phone Nr %1").arg(i))); + const QString iS = QString::number(i); + model.setItem(i, 0, new QStandardItem(QLatin1String("Employee Nr ") + iS)); + model.setItem(i, 1, new QStandardItem(QLatin1String("Street Nr ") + iS)); + model.setItem(i, 2, new QStandardItem(QLatin1String("Town Nr ") + iS)); + model.setItem(i, 3, new QStandardItem(QLatin1String("Phone Nr ") + iS)); } comboBox.setModel(&model); comboBox.setModelColumn(0); @@ -2916,12 +2914,12 @@ void tst_QComboBox::itemData() // ensure that the currentText(), the DisplayRole and the EditRole // stay in sync when using QComboBox's default model for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); + QString itemText = QLatin1String("item text ") + QString::number(i); comboBox.addItem(itemText); } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); + QString itemText = QLatin1String("item text ") + QString::number(i); QCOMPARE(comboBox.itemText(i), itemText); QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -2933,14 +2931,11 @@ void tst_QComboBox::itemData() QCOMPARE(comboBox.currentData(Qt::EditRole).toString(), itemText); } - for (int i = 0; i < itemCount; ++i) { - // now change by using setItemText - QString itemText = QString("setItemText %1").arg(i); - comboBox.setItemText(i, itemText); - } + for (int i = 0; i < itemCount; ++i) // now change by using setItemText + comboBox.setItemText(i, QLatin1String("setItemText ") + QString::number(i)); for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("setItemText %1").arg(i); + QString itemText = QLatin1String("setItemText ") + QString::number(i); QCOMPARE(comboBox.itemText(i), itemText); QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -2954,12 +2949,12 @@ void tst_QComboBox::itemData() for (int i = 0; i < itemCount; ++i) { // now change by changing the DisplayRole's data - QString itemText = QString("setItemData(DisplayRole) %1").arg(i); + QString itemText = QLatin1String("setItemData(DisplayRole) ") + QString::number(i); comboBox.setItemData(i, QVariant(itemText), Qt::DisplayRole); } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("setItemData(DisplayRole) %1").arg(i); + QString itemText = QLatin1String("setItemData(DisplayRole) ") + QString::number(i); QCOMPARE(comboBox.itemText(i), itemText); QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -2973,12 +2968,12 @@ void tst_QComboBox::itemData() for (int i = 0; i < itemCount; ++i) { // now change by changing the EditRole's data - QString itemText = QString("setItemData(EditRole) %1").arg(i); + QString itemText = QLatin1String("setItemData(EditRole) ") + QString::number(i); comboBox.setItemData(i, QVariant(itemText), Qt::EditRole); } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("setItemData(EditRole) %1").arg(i); + QString itemText = QLatin1String("setItemData(EditRole) ") + QString::number(i); QCOMPARE(comboBox.itemText(i), itemText); QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -2995,14 +2990,14 @@ void tst_QComboBox::itemData() // set additional user data in the addItem call for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); - QString itemDataText = QString("item data %1").arg(i); - comboBox.addItem(itemText, QVariant(itemDataText)); + const QString iS = QString::number(i); + comboBox.addItem(QLatin1String("item text ") + iS, QVariant(QLatin1String("item data ") + iS)); } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); - QString itemDataText = QString("item data %1").arg(i); + const QString iS = QString::number(i); + QString itemText = QLatin1String("item text ") + iS; + QString itemDataText = QLatin1String("item data ") + iS; QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); QCOMPARE(comboBox.itemData(i).toString(), itemDataText); @@ -3025,8 +3020,9 @@ void tst_QComboBox::itemData() QString qtlogoPath = QFINDTESTDATA("qtlogo.png"); QIcon icon = QIcon(QPixmap(qtlogoPath)); for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); - QString itemDataText = QString("item data %1").arg(i); + const QString iS = QString::number(i); + QString itemText = QLatin1String("item text ") + iS; + QString itemDataText = QLatin1String("item data ") + iS; double d = i; comboBox.addItem(itemText); comboBox.setItemData(i, QVariant(itemDataText), Qt::UserRole); @@ -3035,8 +3031,9 @@ void tst_QComboBox::itemData() } for (int i = 0; i < itemCount; ++i) { - QString itemText = QString("item text %1").arg(i); - QString itemDataText = QString("item data %1").arg(i); + const QString iS = QString::number(i); + QString itemText = QLatin1String("item text ") + iS; + QString itemDataText = QLatin1String("item data ") + iS; double d = i; QCOMPARE(comboBox.itemData(i, Qt::DisplayRole).toString(), itemText); QCOMPARE(comboBox.itemData(i, Qt::EditRole).toString(), itemText); @@ -3243,12 +3240,12 @@ void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated() box.setModel(&model); box.setCurrentIndex(500); box.show(); - QTest::qWaitForWindowShown(&box); + QTest::qWaitForWindowExposed(&box); QTest::mouseMove(&box, QPoint(5, 5), 100); box.showPopup(); QFrame *container = box.findChild<QComboBoxPrivateContainer *>(); QVERIFY(container); - QTest::qWaitForWindowShown(container); + QTest::qWaitForWindowExposed(container); QList<QComboBoxPrivateScroller *> scrollers = container->findChildren<QComboBoxPrivateScroller *>(); // Not all styles support scrollers. We rely only on those platforms that do to catch any regression. diff --git a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp index a57553097a..667e348945 100644 --- a/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.cpp +++ b/tests/auto/widgets/widgets/qcommandlinkbutton/tst_qcommandlinkbutton.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$ ** @@ -48,16 +43,12 @@ class tst_QCommandLinkButton : public QObject { Q_OBJECT -public: - tst_QCommandLinkButton(); - virtual ~tst_QCommandLinkButton(); -public slots: +private slots: void initTestCase(); void cleanupTestCase(); void init(); - void cleanup(); -private slots: + void getSetCheck(); void pressed(); void setAccel(); @@ -112,14 +103,6 @@ void tst_QCommandLinkButton::getSetCheck() delete var1; } -tst_QCommandLinkButton::tst_QCommandLinkButton() -{ -} - -tst_QCommandLinkButton::~tst_QCommandLinkButton() -{ -} - void tst_QCommandLinkButton::initTestCase() { // Create the test class @@ -153,10 +136,6 @@ void tst_QCommandLinkButton::init() resetCounters(); } -void tst_QCommandLinkButton::cleanup() -{ -} - void tst_QCommandLinkButton::resetCounters() { toggle_count = 0; diff --git a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro index 690edd5c9e..411185ae2a 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro +++ b/tests/auto/widgets/widgets/qdatetimeedit/qdatetimeedit.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdatetimeedit QT += widgets testlib core-private widgets-private SOURCES += tst_qdatetimeedit.cpp diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 08a28f3ea0..31eb05a957 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.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$ ** @@ -125,15 +120,13 @@ public: class tst_QDateTimeEdit : public QObject { Q_OBJECT -public: - tst_QDateTimeEdit(); - virtual ~tst_QDateTimeEdit(); -public slots: + +private slots: void initTestCase(); void init(); void cleanup(); void cleanupTestCase(); -private slots: + void cachedDayTest(); void getSetCheck(); void constructor_qwidget(); @@ -315,14 +308,6 @@ void tst_QDateTimeEdit::getSetCheck() QCOMPARE(timeEdit.inputMethodQuery(Qt::ImHints), QVariant(int(Qt::ImhPreferNumbers))); } -tst_QDateTimeEdit::tst_QDateTimeEdit() -{ -} - -tst_QDateTimeEdit::~tst_QDateTimeEdit() -{ -} - void tst_QDateTimeEdit::initTestCase() { QLocale system = QLocale::system(); @@ -3444,7 +3429,7 @@ void tst_QDateTimeEdit::deleteCalendarWidget() // it should create a new widget QVERIFY(edit.calendarWidget()); - QVERIFY(edit.calendarWidget()->objectName() != "cw1"); + QVERIFY(edit.calendarWidget()->objectName() != QLatin1String("cw1")); } } @@ -3577,7 +3562,7 @@ void tst_QDateTimeEdit::dateEditCorrectSectionSize_data() << threeDigitDayIssueKeypresses_DayName << QString::fromLatin1("00/2/Tuesday"); QTest::newRow("no fixday, leap, yy/M/ddd") << defaultLocale << defaultDate << QString::fromLatin1("yy/M/ddd") - << threeDigitDayIssueKeypresses_DayName << QString::fromLatin1("00/2/Tue"); + << threeDigitDayIssueKeypresses_DayName << QString::fromLatin1("00/2/Tue."); QTest::newRow("no fixday, leap, yy/MM/dddd") << defaultLocale << defaultDate << QString::fromLatin1("yy/MM/dddd") << threeDigitDayIssueKeypresses_DayName << QString::fromLatin1("00/02/Tuesday"); @@ -3625,13 +3610,13 @@ void tst_QDateTimeEdit::dateEditCorrectSectionSize_data() << threeDigitDayIssueKeypresses_YearDayMonth << QString::fromLatin1("2000/29/2"); QTest::newRow("fixday, leap, yyyy/MMM/dd") << defaultLocale << defaultDate << QString::fromLatin1("yyyy/MMM/dd") - << threeDigitDayIssueKeypresses_ShortMonthName << QString::fromLatin1("2000/Feb/29"); + << threeDigitDayIssueKeypresses_ShortMonthName << QString::fromLatin1("2000/Feb./29"); QTest::newRow("fixday, leap, yyyy/MMM/d") << defaultLocale << defaultDate << QString::fromLatin1("yyyy/MMM/d") - << threeDigitDayIssueKeypresses_ShortMonthName << QString::fromLatin1("2000/Feb/29"); + << threeDigitDayIssueKeypresses_ShortMonthName << QString::fromLatin1("2000/Feb./29"); QTest::newRow("fixday, leap, yy/MMM/dd") << defaultLocale << defaultDate << QString::fromLatin1("yy/MMM/dd") - << threeDigitDayIssueKeypresses_ShortMonthName << QString::fromLatin1("00/Feb/29"); + << threeDigitDayIssueKeypresses_ShortMonthName << QString::fromLatin1("00/Feb./29"); QTest::newRow("fixday, leap, yyyy/dddd/M") << defaultLocale << defaultDate << QString::fromLatin1("yyyy/dddd/M") << threeDigitDayIssueKeypresses_DayName_YearDayMonth << QString::fromLatin1("2000/Tuesday/2"); @@ -3706,16 +3691,16 @@ void tst_QDateTimeEdit::dateEditCorrectSectionSize_data() << threeDigitDayIssueKeypresses_MonthYearDay << QString::fromLatin1("02/2000/29"); QTest::newRow("fixday, leap, MMM/yy/d") << defaultLocale << defaultDate << QString::fromLatin1("MMM/yy/d") - << threeDigitDayIssueKeypresses_ShortMonthName_MonthYearDay << QString::fromLatin1("Feb/00/29"); + << threeDigitDayIssueKeypresses_ShortMonthName_MonthYearDay << QString::fromLatin1("Feb./00/29"); QTest::newRow("fixday, leap, MMM/yyyy/d") << defaultLocale << defaultDate << QString::fromLatin1("MMM/yyyy/d") - << threeDigitDayIssueKeypresses_ShortMonthName_MonthYearDay << QString::fromLatin1("Feb/2000/29"); + << threeDigitDayIssueKeypresses_ShortMonthName_MonthYearDay << QString::fromLatin1("Feb./2000/29"); QTest::newRow("fixday, MMM/yyyy/d") << defaultLocale << defaultDate.addYears(1) << QString::fromLatin1("MMM/yyyy/d") - << threeDigitDayIssueKeypresses_ShortMonthName_MonthYearDay << QString::fromLatin1("Feb/2001/28"); + << threeDigitDayIssueKeypresses_ShortMonthName_MonthYearDay << QString::fromLatin1("Feb./2001/28"); QTest::newRow("fixday, leap, MMM/yyyy/dd") << defaultLocale << defaultDate << QString::fromLatin1("MMM/yyyy/dd") - << threeDigitDayIssueKeypresses_ShortMonthName_MonthYearDay << QString::fromLatin1("Feb/2000/29"); + << threeDigitDayIssueKeypresses_ShortMonthName_MonthYearDay << QString::fromLatin1("Feb./2000/29"); QTest::newRow("fixday, leap, dddd, dd. MMMM yyyy") << defaultLocale << defaultDate << QString::fromLatin1("dddd, dd. MMMM yyyy") diff --git a/tests/auto/widgets/widgets/qdial/qdial.pro b/tests/auto/widgets/widgets/qdial/qdial.pro index 0af9633236..9bdd61f9d5 100644 --- a/tests/auto/widgets/widgets/qdial/qdial.pro +++ b/tests/auto/widgets/widgets/qdial/qdial.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdial QT += widgets testlib SOURCES += tst_qdial.cpp diff --git a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp b/tests/auto/widgets/widgets/qdial/tst_qdial.cpp index e047e86067..7db3b44dc8 100644 --- a/tests/auto/widgets/widgets/qdial/tst_qdial.cpp +++ b/tests/auto/widgets/widgets/qdial/tst_qdial.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/widgets/qdialogbuttonbox/qdialogbuttonbox.pro b/tests/auto/widgets/widgets/qdialogbuttonbox/qdialogbuttonbox.pro index 9892c48e0c..7f2ad59581 100644 --- a/tests/auto/widgets/widgets/qdialogbuttonbox/qdialogbuttonbox.pro +++ b/tests/auto/widgets/widgets/qdialogbuttonbox/qdialogbuttonbox.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test QT += widgets testlib SOURCES += tst_qdialogbuttonbox.cpp diff --git a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index 32412afcd5..a35ea8eb6e 100644 --- a/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/widgets/widgets/qdialogbuttonbox/tst_qdialogbuttonbox.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/widgets/qdockwidget/qdockwidget.pro b/tests/auto/widgets/widgets/qdockwidget/qdockwidget.pro index eca396f1a8..5c1ef52036 100644 --- a/tests/auto/widgets/widgets/qdockwidget/qdockwidget.pro +++ b/tests/auto/widgets/widgets/qdockwidget/qdockwidget.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qdockwidget QT += widgets widgets-private testlib QT += core-private gui-private diff --git a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp index 61a9461a62..cb55bd32b0 100644 --- a/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.cpp +++ b/tests/auto/widgets/widgets/qdockwidget/tst_qdockwidget.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$ ** @@ -934,9 +929,6 @@ void tst_QDockWidget::task237438_setFloatingCrash() void tst_QDockWidget::task248604_infiniteResize() { -#if defined Q_OS_BLACKBERRY - QSKIP("Top level window is stretched to fullscreen"); -#endif QDockWidget d; QTabWidget *t = new QTabWidget; t->addTab(new QWidget, "Foo"); diff --git a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp index 6a1ce17aab..59ddd54194 100644 --- a/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/widgets/widgets/qdoublespinbox/tst_qdoublespinbox.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$ ** @@ -214,12 +209,15 @@ void tst_QDoubleSpinBox::setPrefixSuffix_data() QTest::newRow("data0") << QString() << QString() << 10.5 << 1 << "10.5" << "10.5" << false; QTest::newRow("data1") << QString() << "cm" << 10.5 << 2 << "10.50cm" << "10.50" << false; - QTest::newRow("data2") << "cm: " << QString() << 10.5 << 0 << "cm: 10" << "10" << false; + + // 10.5 is rounded correctly to 11 when using libdouble-conversion, or incorrectly to 10 when + // using snprintf. This is not the point of this test, though. + QTest::newRow("data2") << "cm: " << QString() << 10.4 << 0 << "cm: 10" << "10" << false; QTest::newRow("data3") << "length: " << "cm" << 10.5 << 3 << "length: 10.500cm" << "10.500" << false; QTest::newRow("data4") << QString() << QString() << 10.5 << 1 << "10.5" << "10.5" << true; QTest::newRow("data5") << QString() << "cm" << 10.5 << 2 << "10.50cm" << "10.50" << true; - QTest::newRow("data6") << "cm: " << QString() << 10.5 << 0 << "cm: 10" << "10" << true; + QTest::newRow("data6") << "cm: " << QString() << 10.4 << 0 << "cm: 10" << "10" << true; QTest::newRow("data7") << "length: " << "cm" << 10.5 << 3 << "length: 10.500cm" << "10.500" << true; } @@ -817,8 +815,10 @@ void tst_QDoubleSpinBox::editingFinished() QCOMPARE(editingFinishedSpy1.count(), 4); QCOMPARE(editingFinishedSpy2.count(), 4); - testFocusWidget->show(); // On BlackBerry this is our root window we need to show it again - // otherwise subsequent tests will fail + // On some platforms this is our root window + // we need to show it again otherwise subsequent + // tests will fail + testFocusWidget->show(); } void tst_QDoubleSpinBox::removeAll() diff --git a/tests/auto/widgets/widgets/qfocusframe/qfocusframe.pro b/tests/auto/widgets/widgets/qfocusframe/qfocusframe.pro index 6fa0589f95..404edcd075 100644 --- a/tests/auto/widgets/widgets/qfocusframe/qfocusframe.pro +++ b/tests/auto/widgets/widgets/qfocusframe/qfocusframe.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfocusframe QT += widgets testlib SOURCES += tst_qfocusframe.cpp diff --git a/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp b/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp index 105a1ac55a..e6e689336a 100644 --- a/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.cpp +++ b/tests/auto/widgets/widgets/qfocusframe/tst_qfocusframe.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/widgets/qfontcombobox/qfontcombobox.pro b/tests/auto/widgets/widgets/qfontcombobox/qfontcombobox.pro index b21729bb9b..418789ac0f 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/qfontcombobox.pro +++ b/tests/auto/widgets/widgets/qfontcombobox/qfontcombobox.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qfontcombobox QT += widgets testlib SOURCES += tst_qfontcombobox.cpp diff --git a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp index 10e447c417..9e6b16d4ce 100644 --- a/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.cpp +++ b/tests/auto/widgets/widgets/qfontcombobox/tst_qfontcombobox.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,12 +34,6 @@ class tst_QFontComboBox : public QObject { Q_OBJECT -public slots: - void initTestCase(); - void cleanupTestCase(); - void init(); - void cleanup(); - private slots: void qfontcombobox_data(); void qfontcombobox(); @@ -69,28 +58,6 @@ public: { return SubQFontComboBox::event(e); } }; -// This will be called before the first test function is executed. -// It is only called once. -void tst_QFontComboBox::initTestCase() -{ -} - -// This will be called after the last test function is executed. -// It is only called once. -void tst_QFontComboBox::cleanupTestCase() -{ -} - -// This will be called before each test function is executed. -void tst_QFontComboBox::init() -{ -} - -// This will be called after every test function. -void tst_QFontComboBox::cleanup() -{ -} - void tst_QFontComboBox::qfontcombobox_data() { } @@ -253,7 +220,7 @@ void tst_QFontComboBox::writingSystem_data() QTest::newRow("Runic") << QFontDatabase::Runic; for (int i = 0; i < 31; ++i) - QTest::newRow(qPrintable(QString("enum %1").arg(i))) << (QFontDatabase::WritingSystem)i; + QTest::newRow(("enum " + QByteArray::number(i)).constData()) << (QFontDatabase::WritingSystem)i; } // public QFontDatabase::WritingSystem writingSystem() const diff --git a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp index 81a6ba2ee3..432f4474c5 100644 --- a/tests/auto/widgets/widgets/qframe/tst_qframe.cpp +++ b/tests/auto/widgets/widgets/qframe/tst_qframe.cpp @@ -1,32 +1,27 @@ /**************************************************************************** ** -** Copyright (C) 2015 The Qt Company Ltd. +** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> -** Contact: http://www.qt.io/licensing/ +** 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$ ** @@ -73,22 +68,24 @@ static void provideFrameData() for (int lineWidth = 0; lineWidth < 3; ++lineWidth) { for (int midLineWidth = 0; midLineWidth < 3; ++midLineWidth) { - QTest::newRow(qPrintable(QStringLiteral("box_noshadow_%1_%2").arg(lineWidth).arg(midLineWidth))) - << "box_noshadow" << lineWidth << midLineWidth << QFrame::Box << (QFrame::Shadow)0; - QTest::newRow(qPrintable(QStringLiteral("box_plain_%1_%2").arg(lineWidth).arg(midLineWidth))) + const QByteArray postFix = '_' + QByteArray::number(lineWidth) + '_' + + QByteArray::number(midLineWidth); + QTest::newRow(("box_noshadow" + postFix).constData()) + << "box_noshadow" << lineWidth << midLineWidth << QFrame::Box << (QFrame::Shadow)0; + QTest::newRow(("box_plain" + postFix).constData()) << "box_plain" << lineWidth << midLineWidth << QFrame::Box << QFrame::Plain; - QTest::newRow(qPrintable(QStringLiteral("box_raised_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("box_raised" + postFix).constData()) << "box_raised" << lineWidth << midLineWidth << QFrame::Box << QFrame::Raised; - QTest::newRow(qPrintable(QStringLiteral("box_sunken_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("box_sunken" + postFix).constData()) << "box_sunken" << lineWidth << midLineWidth << QFrame::Box << QFrame::Sunken; - QTest::newRow(qPrintable(QStringLiteral("winpanel_noshadow_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("winpanel_noshadow" + postFix).constData()) << "winpanel_noshadow" << lineWidth << midLineWidth << QFrame::WinPanel << (QFrame::Shadow)0; - QTest::newRow(qPrintable(QStringLiteral("winpanel_plain_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("winpanel_plain" + postFix).constData()) << "winpanel_plain" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Plain; - QTest::newRow(qPrintable(QStringLiteral("winpanel_raised_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("winpanel_raised" + postFix).constData()) << "winpanel_raised" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Raised; - QTest::newRow(qPrintable(QStringLiteral("winpanel_sunken_%1_%2").arg(lineWidth).arg(midLineWidth))) + QTest::newRow(("winpanel_sunken" + postFix).constData()) << "winpanel_sunken" << lineWidth << midLineWidth << QFrame::WinPanel << QFrame::Sunken; } } @@ -174,7 +171,10 @@ void tst_QFrame::testPainting() const QPixmap pixmap = frame.grab(); - const QString referenceFilePath = QFINDTESTDATA(QStringLiteral("images/%1_%2_%3.png").arg(basename).arg(lineWidth).arg(midLineWidth)); + const QString fileName = QLatin1String("images/") + basename + QLatin1Char('_') + + QString::number(lineWidth) + QLatin1Char('_') + QString::number(midLineWidth) + + QLatin1String(".png"); + const QString referenceFilePath = QFINDTESTDATA(fileName); const QPixmap referencePixmap(referenceFilePath); QVERIFY2(!referencePixmap.isNull(), qPrintable(QStringLiteral("Could not load reference pixmap %1").arg(referenceFilePath))); QCOMPARE(pixmap, referencePixmap); diff --git a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp index 53eec99258..62224217d6 100644 --- a/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.cpp +++ b/tests/auto/widgets/widgets/qgroupbox/tst_qgroupbox.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$ ** @@ -73,6 +68,7 @@ private slots: void childrenAreDisabled(); void propagateFocus(); void task_QTBUG_19170_ignoreMouseReleseEvent(); + void task_QTBUG_15519_propagateMouseEvents(); private: bool checked; @@ -80,6 +76,7 @@ private: qint64 clickTimeStamp; qint64 toggleTimeStamp; + static void sendMouseMoveEvent(QWidget *widget, const QPoint &localPos); }; tst_QGroupBox::tst_QGroupBox() @@ -502,5 +499,114 @@ void tst_QGroupBox::task_QTBUG_19170_ignoreMouseReleseEvent() QCOMPARE(box.isChecked(), false); } +class MouseEventTestWidget : public QWidget +{ +public: + bool mousePressed; + bool mouseReleased; + bool mouseMoved; + + void reset() + { + mousePressed = false; + mouseReleased = false; + mouseMoved = false; + } + +protected: + void mousePressEvent(QMouseEvent*) + { + mousePressed = true; + } + + void mouseReleaseEvent(QMouseEvent*) + { + mouseReleased = true; + } + + void mouseMoveEvent(QMouseEvent*) + { + mouseMoved = true; + } +}; + +void tst_QGroupBox::task_QTBUG_15519_propagateMouseEvents() +{ + MouseEventTestWidget parent; + QGroupBox box(&parent); + parent.setMouseTracking(true); + box.setMouseTracking(true); + box.resize(100, 100); + box.setTitle("This is a test for QTBUG-15519"); + box.show(); + + QStyleOptionGroupBox option; + option.initFrom(&box); + option.subControls = QStyle::SubControls(QStyle::SC_All); + QRect checkBoxRect = box.style()->subControlRect(QStyle::CC_GroupBox, &option, + QStyle::SC_GroupBoxCheckBox, &box); + + // Without a checkbox, all mouse events should propagate + + parent.reset(); + QTest::mousePress(&box, Qt::LeftButton, 0, checkBoxRect.center()); + QCOMPARE(parent.mousePressed, true); + + parent.reset(); + QTest::mousePress(&box, Qt::LeftButton, 0, box.rect().center()); + QCOMPARE(parent.mousePressed, true); + + parent.reset(); + QTest::mouseRelease(&box, Qt::LeftButton, 0, checkBoxRect.center()); + QCOMPARE(parent.mouseReleased, true); + + parent.reset(); + QTest::mouseRelease(&box, Qt::LeftButton, 0, box.rect().center()); + QCOMPARE(parent.mouseReleased, true); + + parent.reset(); + sendMouseMoveEvent(&box, checkBoxRect.center()); + QCOMPARE(parent.mouseMoved, true); + + parent.reset(); + sendMouseMoveEvent(&box, box.rect().center()); + QCOMPARE(parent.mouseMoved, true); + + // With a checkbox, presses and releases to the checkbox should not propagate + + box.setCheckable(true); + + parent.reset(); + QTest::mousePress(&box, Qt::LeftButton, 0, checkBoxRect.center()); + QCOMPARE(parent.mousePressed, false); + + parent.reset(); + QTest::mousePress(&box, Qt::LeftButton, 0, box.rect().center()); + QCOMPARE(parent.mousePressed, true); + + parent.reset(); + QTest::mouseRelease(&box, Qt::LeftButton, 0, checkBoxRect.center()); + QCOMPARE(parent.mouseReleased, false); + + parent.reset(); + QTest::mouseRelease(&box, Qt::LeftButton, 0, box.rect().center()); + QCOMPARE(parent.mouseReleased, true); + + parent.reset(); + sendMouseMoveEvent(&box, checkBoxRect.center()); + QCOMPARE(parent.mouseMoved, true); + + parent.reset(); + sendMouseMoveEvent(&box, box.rect().center()); + QCOMPARE(parent.mouseMoved, true); +} + +void tst_QGroupBox::sendMouseMoveEvent(QWidget *widget, const QPoint &localPos) +{ + // Send a MouseMove event without actually moving the pointer + QMouseEvent event(QEvent::MouseMove, localPos, Qt::NoButton, Qt::NoButton, Qt::NoModifier); + QApplication::sendEvent(widget, &event); +} + QTEST_MAIN(tst_QGroupBox) #include "tst_qgroupbox.moc" diff --git a/tests/auto/widgets/widgets/qkeysequenceedit/qkeysequenceedit.pro b/tests/auto/widgets/widgets/qkeysequenceedit/qkeysequenceedit.pro index 097cb00d11..c660b398ce 100644 --- a/tests/auto/widgets/widgets/qkeysequenceedit/qkeysequenceedit.pro +++ b/tests/auto/widgets/widgets/qkeysequenceedit/qkeysequenceedit.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qkeysequenceedit QT += widgets testlib SOURCES += tst_qkeysequenceedit.cpp diff --git a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp index 3472d0487a..191031c485 100644 --- a/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.cpp +++ b/tests/auto/widgets/widgets/qkeysequenceedit/tst_qkeysequenceedit.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/widgets/qlabel/qlabel.pro b/tests/auto/widgets/widgets/qlabel/qlabel.pro index 6c259bc5a3..6a5757fb5c 100644 --- a/tests/auto/widgets/widgets/qlabel/qlabel.pro +++ b/tests/auto/widgets/widgets/qlabel/qlabel.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qlabel QT += widgets widgets-private testlib diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp index d76dbf6b46..ad971c6b5f 100644 --- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp +++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.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/widgets/qlcdnumber/qlcdnumber.pro b/tests/auto/widgets/widgets/qlcdnumber/qlcdnumber.pro index 220380b1d5..1508806fb0 100644 --- a/tests/auto/widgets/widgets/qlcdnumber/qlcdnumber.pro +++ b/tests/auto/widgets/widgets/qlcdnumber/qlcdnumber.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qlcdnumber QT += widgets testlib SOURCES += tst_qlcdnumber.cpp diff --git a/tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.cpp b/tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.cpp index a6d586ca19..9dcfd813ac 100644 --- a/tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.cpp +++ b/tests/auto/widgets/widgets/qlcdnumber/tst_qlcdnumber.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/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index b46609c371..598b518810 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.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$ ** @@ -64,6 +59,7 @@ #include <qsortfilterproxymodel.h> #include <qdebug.h> #include <qscreen.h> +#include <qshortcut.h> #include "qcommonstyle.h" #include "qstyleoption.h" @@ -131,14 +127,13 @@ public: enum EventStates { Press, Release, Click }; tst_QLineEdit(); - virtual ~tst_QLineEdit(); -public slots: +private slots: void initTestCase(); void cleanupTestCase(); void init(); void cleanup(); -private slots: + void getSetCheck(); void experimental(); @@ -313,6 +308,9 @@ private slots: void shouldShowPlaceholderText(); void QTBUG1266_setInputMaskEmittingTextEdited(); + void shortcutOverrideOnReadonlyLineEdit_data(); + void shortcutOverrideOnReadonlyLineEdit(); + protected slots: void editingFinished(); @@ -377,10 +375,6 @@ tst_QLineEdit::tst_QLineEdit() : validInput(false), m_testWidget(0), m_keyboardS } } -tst_QLineEdit::~tst_QLineEdit() -{ -} - QLineEdit *tst_QLineEdit::ensureTestWidget() { if (!m_testWidget) { @@ -2245,6 +2239,7 @@ void tst_QLineEdit::deleteSelectedText() edit.setText(text); edit.selectAll(); +#ifndef QT_NO_CONTEXTMENU QMenu *menu = edit.createStandardContextMenu(); for (int i = 0; i < menu->actions().count(); ++i) { QAction *current = menu->actions().at(i); @@ -2253,6 +2248,7 @@ void tst_QLineEdit::deleteSelectedText() QVERIFY(edit.text().isEmpty()); } } +#endif // QT_NO_CONTEXTMENU } @@ -2888,6 +2884,11 @@ void tst_QLineEdit::insert() QCOMPARE(testWidget->text(), QString("No Crash! This is a nice test")); } +static inline QByteArray selectionTestName(int start, int length) +{ + return "selection start: " + QByteArray::number(start) + " length: " + QByteArray::number(length); +} + void tst_QLineEdit::setSelection_data() { QTest::addColumn<QString>("text"); @@ -2901,39 +2902,39 @@ void tst_QLineEdit::setSelection_data() int start, length, pos; start = 0; length = 1; pos = 1; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("A") << true; start = 0; length = 2; pos = 2; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("Ab") << true; start = 0; length = 4; pos = 4; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("Abc ") << true; start = -1; length = 0; pos = text.length(); - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString() << false; start = 34; length = 1; pos = 35; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("z") << true; start = 34; length = 2; pos = 35; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("z") << true; start = 34; length = -1; pos = 33; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("y") << true; start = 1; length = -2; pos = 0; - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString("A") << true; start = -1; length = -1; pos = text.length(); - QTest::newRow(QString("selection start: %1 length: %2").arg(start).arg(length).toLatin1()) + QTest::newRow(selectionTestName(start, length).constData()) << text << start << length << pos << QString() << false; } @@ -3314,7 +3315,7 @@ void tst_QLineEdit::inlineCompletion() QStandardItem *root = model->invisibleRootItem(); QStandardItem *items[5]; for (int i = 0; i < 5; i++) { - items[i] = new QStandardItem(QString("item%1").arg(i)); + items[i] = new QStandardItem(QLatin1String("item") + QString::number(i)); if ((i+2)%2 == 0) { // disable 0,2,4 items[i]->setFlags(items[i]->flags() & ~Qt::ItemIsEnabled); } @@ -4504,5 +4505,61 @@ void tst_QLineEdit::QTBUG1266_setInputMaskEmittingTextEdited() QCOMPARE(spy.count(), 0); } +void tst_QLineEdit::shortcutOverrideOnReadonlyLineEdit_data() +{ + QTest::addColumn<QKeySequence>("keySequence"); + QTest::addColumn<bool>("shouldBeHandledByQLineEdit"); + + QTest::newRow("Copy") << QKeySequence(QKeySequence::Copy) << true; + QTest::newRow("MoveToNextChar") << QKeySequence(QKeySequence::MoveToNextChar) << true; + QTest::newRow("SelectAll") << QKeySequence(QKeySequence::SelectAll) << true; + QTest::newRow("Right press") << QKeySequence(Qt::Key_Right) << true; + QTest::newRow("Left press") << QKeySequence(Qt::Key_Left) << true; + + QTest::newRow("Paste") << QKeySequence(QKeySequence::Paste) << false; + QTest::newRow("Paste") << QKeySequence(QKeySequence::Cut) << false; + QTest::newRow("Undo") << QKeySequence(QKeySequence::Undo) << false; + QTest::newRow("Redo") << QKeySequence(QKeySequence::Redo) << false; + + QTest::newRow("a") << QKeySequence(Qt::Key_A) << false; + QTest::newRow("b") << QKeySequence(Qt::Key_B) << false; + QTest::newRow("c") << QKeySequence(Qt::Key_C) << false; + QTest::newRow("x") << QKeySequence(Qt::Key_X) << false; + QTest::newRow("X") << QKeySequence(Qt::ShiftModifier + Qt::Key_X) << false; + + QTest::newRow("Alt+Home") << QKeySequence(Qt::AltModifier + Qt::Key_Home) << false; +} + +void tst_QLineEdit::shortcutOverrideOnReadonlyLineEdit() +{ + QFETCH(QKeySequence, keySequence); + QFETCH(bool, shouldBeHandledByQLineEdit); + + QWidget widget; + + QShortcut *shortcut = new QShortcut(keySequence, &widget); + QSignalSpy spy(shortcut, &QShortcut::activated); + QVERIFY(spy.isValid()); + + QLineEdit *lineEdit = new QLineEdit(QStringLiteral("Test"), &widget); + lineEdit->setReadOnly(true); + lineEdit->setFocus(); + + widget.show(); + + QVERIFY(QTest::qWaitForWindowActive(&widget)); + + const int keySequenceCount = keySequence.count(); + for (int i = 0; i < keySequenceCount; ++i) { + const uint key = keySequence[i]; + QTest::keyClick(lineEdit, + Qt::Key(key & ~Qt::KeyboardModifierMask), + Qt::KeyboardModifier(key & Qt::KeyboardModifierMask)); + } + + const int activationCount = shouldBeHandledByQLineEdit ? 0 : 1; + QCOMPARE(spy.count(), activationCount); +} + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" diff --git a/tests/auto/widgets/widgets/qmainwindow/qmainwindow.pro b/tests/auto/widgets/widgets/qmainwindow/qmainwindow.pro index bd4fc6ba97..7e0a5320b0 100644 --- a/tests/auto/widgets/widgets/qmainwindow/qmainwindow.pro +++ b/tests/auto/widgets/widgets/qmainwindow/qmainwindow.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qmainwindow QT += widgets widgets-private testlib SOURCES += tst_qmainwindow.cpp diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index ece011d145..6ee5f76c6a 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.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$ ** @@ -1373,7 +1368,7 @@ void tst_QMainWindow::restoreStateFromPreviousVersion() QVector<QDockWidget*> docks; for(int i = 0; i < 16; ++i) { - const QString name = QString::fromLatin1("dock %1").arg(i); + const QString name = QStringLiteral("dock ") + QString::number(i); QDockWidget *dock = new QDockWidget(name); docks += dock; dock->setObjectName(name); diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index f832ebfee0..809fa56a61 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.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$ ** @@ -623,6 +618,11 @@ void tst_QMdiArea::showWindows() //#define USE_SHOW +static inline QString windowTitle(const QString &t, const QString &f) +{ + return t + QLatin1String(" - [") + f + QLatin1Char(']'); +} + void tst_QMdiArea::changeWindowTitle() { const QString mwc = QString::fromLatin1("MainWindow's Caption"); @@ -634,7 +634,7 @@ void tst_QMdiArea::changeWindowTitle() mw->setWindowTitle( mwc ); QMdiArea *ws = new QMdiArea( mw ); mw->setCentralWidget( ws ); - mw->menuBar(); + mw->menuBar()->setNativeMenuBar(false); mw->show(); QVERIFY(QTest::qWaitForWindowExposed(mw)); @@ -650,7 +650,7 @@ void tst_QMdiArea::changeWindowTitle() widget->setWindowState(Qt::WindowMaximized); #endif #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif mw->hide(); @@ -659,7 +659,7 @@ void tst_QMdiArea::changeWindowTitle() QVERIFY(QTest::qWaitForWindowExposed(mw)); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); #endif #ifdef USE_SHOW @@ -677,11 +677,11 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QTRY_COMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc) ); + QTRY_COMPARE( mw->windowTitle(), windowTitle(mwc, wc) ); widget->setWindowTitle( wc2 ); - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc).arg(wc2) ); + QCOMPARE( mw->windowTitle(), windowTitle(mwc, wc2) ); mw->setWindowTitle( mwc2 ); - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc2).arg(wc2) ); + QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif mw->show(); @@ -695,7 +695,7 @@ void tst_QMdiArea::changeWindowTitle() qApp->processEvents(); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc2).arg(wc2) ); + QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif #ifdef USE_SHOW widget->showNormal(); @@ -716,7 +716,7 @@ void tst_QMdiArea::changeWindowTitle() #endif qApp->processEvents(); #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QCOMPARE( mw->windowTitle(), QString::fromLatin1("%1 - [%2]").arg(mwc2).arg(wc2) ); + QCOMPARE( mw->windowTitle(), windowTitle(mwc2, wc2) ); #endif #ifdef USE_SHOW @@ -743,7 +743,7 @@ void tst_QMdiArea::changeModified() mw->setWindowTitle( mwc ); QMdiArea *ws = new QMdiArea( mw ); mw->setCentralWidget( ws ); - mw->menuBar(); + mw->menuBar()->setNativeMenuBar(false); mw->show(); QWidget *widget = new QWidget( ws ); @@ -2008,6 +2008,7 @@ void tst_QMdiArea::iconGeometryInMenuBar() #if !defined (Q_OS_MAC) && !defined(Q_OS_WINCE) QMainWindow mainWindow; QMenuBar *menuBar = mainWindow.menuBar(); + menuBar->setNativeMenuBar(false); QMdiArea *mdiArea = new QMdiArea; QMdiSubWindow *subWindow = mdiArea->addSubWindow(new QWidget); mainWindow.setCentralWidget(mdiArea); @@ -2323,7 +2324,7 @@ void tst_QMdiArea::setViewMode() iconPixmap.fill(Qt::red); for (int i = 0; i < 5; ++i) { QMdiSubWindow *subWindow = mdiArea.addSubWindow(new QWidget); - subWindow->setWindowTitle(QString(QLatin1String("Title %1")).arg(i)); + subWindow->setWindowTitle(QLatin1String("Title ") + QString::number(i)); subWindow->setWindowIcon(iconPixmap); } diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index db252347ac..3fbb9a3f3f 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.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$ ** @@ -202,6 +197,7 @@ private slots: void task_226929(); void styleChange(); void testFullScreenState(); + void testRemoveBaseWidget(); }; void tst_QMdiSubWindow::initTestCase() @@ -363,25 +359,25 @@ void tst_QMdiSubWindow::mainWindowSupport() mainWindow.show(); mainWindow.menuBar()->setVisible(true); qApp->setActiveWindow(&mainWindow); - - // QMainWindow's window title is empty -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - { - QCOMPARE(mainWindow.windowTitle(), QString()); - QMdiSubWindow *window = workspace->addSubWindow(new QPushButton(QLatin1String("Test"))); - QString expectedTitle = QLatin1String("MainWindow's title is empty"); - window->setWindowTitle(expectedTitle); - QCOMPARE(window->windowTitle(), expectedTitle); - window->showMaximized(); - QVERIFY(window->isMaximized()); - QCOMPARE(window->windowTitle(), expectedTitle); - QCOMPARE(mainWindow.windowTitle(), expectedTitle); - window->showNormal(); - QCOMPARE(window->windowTitle(), expectedTitle); - QCOMPARE(mainWindow.windowTitle(), QString()); - window->close(); + bool nativeMenuBar = mainWindow.menuBar()->isNativeMenuBar(); + + // QMainWindow's window title is empty, so on a platform which does NOT have a native menubar, + // the maximized subwindow's title is imposed onto the main window's titlebar. + if (!nativeMenuBar) { + QCOMPARE(mainWindow.windowTitle(), QString()); + QMdiSubWindow *window = workspace->addSubWindow(new QPushButton(QLatin1String("Test"))); + QString expectedTitle = QLatin1String("MainWindow's title is empty"); + window->setWindowTitle(expectedTitle); + QCOMPARE(window->windowTitle(), expectedTitle); + window->showMaximized(); + QVERIFY(window->isMaximized()); + QCOMPARE(window->windowTitle(), expectedTitle); + QCOMPARE(mainWindow.windowTitle(), expectedTitle); + window->showNormal(); + QCOMPARE(window->windowTitle(), expectedTitle); + QCOMPARE(mainWindow.windowTitle(), QString()); + window->close(); } -#endif QString originalWindowTitle = QString::fromLatin1("MainWindow"); mainWindow.setWindowTitle(originalWindowTitle); @@ -396,7 +392,7 @@ void tst_QMdiSubWindow::mainWindowSupport() QMdiArea *nestedWorkspace = new QMdiArea; // :-) window->setWidget(nestedWorkspace); - window->widget()->setWindowTitle(QString::fromLatin1("Window %1").arg(i)); + window->widget()->setWindowTitle(QLatin1String("Window ") + QString::number(i)); workspace->addSubWindow(window); QVERIFY(!window->maximizedButtonsWidget()); @@ -417,37 +413,37 @@ void tst_QMdiSubWindow::mainWindowSupport() window->showMaximized(); qApp->processEvents(); QVERIFY(window->isMaximized()); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QVERIFY(window->maximizedButtonsWidget()); - QCOMPARE(window->maximizedButtonsWidget(), mainWindow.menuBar()->cornerWidget(Qt::TopRightCorner)); - QVERIFY(window->maximizedSystemMenuIconWidget()); - QCOMPARE(window->maximizedSystemMenuIconWidget(), qobject_cast<QWidget *>(mainWindow.menuBar() - ->cornerWidget(Qt::TopLeftCorner))); - QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]") - .arg(originalWindowTitle, window->widget()->windowTitle())); -#endif + if (!nativeMenuBar) { + QVERIFY(window->maximizedButtonsWidget()); + QCOMPARE(window->maximizedButtonsWidget(), mainWindow.menuBar()->cornerWidget(Qt::TopRightCorner)); + QVERIFY(window->maximizedSystemMenuIconWidget()); + QCOMPARE(window->maximizedSystemMenuIconWidget(), + qobject_cast<QWidget *>(mainWindow.menuBar()->cornerWidget(Qt::TopLeftCorner))); + const QString expectedTitle = originalWindowTitle + QLatin1String(" - [") + + window->widget()->windowTitle() + QLatin1Char(']'); + QCOMPARE(mainWindow.windowTitle(), expectedTitle); + } // Check that nested child windows don't set window title nestedWorkspace->show(); QMdiSubWindow *nestedWindow = new QMdiSubWindow; nestedWindow->setWidget(new QWidget); nestedWorkspace->addSubWindow(nestedWindow); - nestedWindow->widget()->setWindowTitle(QString::fromLatin1("NestedWindow %1").arg(i)); + nestedWindow->widget()->setWindowTitle(QLatin1String("NestedWindow ") + QString::number(i)); nestedWindow->showMaximized(); qApp->processEvents(); QVERIFY(nestedWindow->isMaximized()); QVERIFY(!nestedWindow->maximizedButtonsWidget()); QVERIFY(!nestedWindow->maximizedSystemMenuIconWidget()); -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) && !defined(Q_OS_QNX) - QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]") - .arg(originalWindowTitle, window->widget()->windowTitle())); -#endif + if (!nativeMenuBar) { + QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]") + .arg(originalWindowTitle, window->widget()->windowTitle())); + } } -#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) - return; -#endif + if (nativeMenuBar) + return; workspace->activateNextSubWindow(); qApp->processEvents(); @@ -970,7 +966,7 @@ void tst_QMdiSubWindow::setSystemMenu() QMdiArea *mdiArea = new QMdiArea; mdiArea->addSubWindow(subWindow); mainWindow.setCentralWidget(mdiArea); - mainWindow.menuBar(); + mainWindow.menuBar()->setNativeMenuBar(false); mainWindow.show(); QVERIFY(QTest::qWaitForWindowExposed(&mainWindow)); QTest::qWait(60); @@ -1470,6 +1466,7 @@ void tst_QMdiSubWindow::hideAndShow() QMainWindow mainWindow; mainWindow.setGeometry(0, 0, 640, 480); QMenuBar *menuBar = mainWindow.menuBar(); + menuBar->setNativeMenuBar(false); mainWindow.setCentralWidget(tabWidget); mainWindow.show(); QVERIFY(QTest::qWaitForWindowExposed(&mainWindow)); @@ -1738,6 +1735,7 @@ void tst_QMdiSubWindow::replaceMenuBarWhileMaximized() mainWindow.setCentralWidget(mdiArea); QMenuBar *menuBar = mainWindow.menuBar(); + menuBar->setNativeMenuBar(false); mainWindow.show(); QVERIFY(QTest::qWaitForWindowExposed(&mainWindow)); @@ -1754,6 +1752,7 @@ void tst_QMdiSubWindow::replaceMenuBarWhileMaximized() // Replace. mainWindow.setMenuBar(new QMenuBar); menuBar = mainWindow.menuBar(); + menuBar->setNativeMenuBar(false); qApp->processEvents(); QVERIFY(subWindow->maximizedButtonsWidget()); @@ -1911,14 +1910,14 @@ void tst_QMdiSubWindow::mdiArea() void tst_QMdiSubWindow::task_182852() { -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) - QMdiArea *workspace = new QMdiArea; QMainWindow mainWindow; mainWindow.setCentralWidget(workspace); mainWindow.show(); mainWindow.menuBar()->setVisible(true); qApp->setActiveWindow(&mainWindow); + if (mainWindow.menuBar()->isNativeMenuBar()) + return; // The main window's title is not overwritten if we have a native menubar (macOS, Unity etc.) QString originalWindowTitle = QString::fromLatin1("MainWindow - [foo]"); mainWindow.setWindowTitle(originalWindowTitle); @@ -1954,9 +1953,6 @@ void tst_QMdiSubWindow::task_182852() QCOMPARE(mainWindow.windowTitle(), QString::fromLatin1("%1 - [%2]") .arg(originalWindowTitle, window->widget()->windowTitle())); - - -#endif } void tst_QMdiSubWindow::task_233197() @@ -2080,6 +2076,27 @@ void tst_QMdiSubWindow::testFullScreenState() QCOMPARE(subWindow->size(), QSize(300, 300)); } +void tst_QMdiSubWindow::testRemoveBaseWidget() +{ + QMdiArea mdiArea; + mdiArea.show(); + + QWidget *widget1 = new QWidget; + mdiArea.addSubWindow(widget1); + + QWidget *widget2 = new QWidget; + mdiArea.addSubWindow(widget2); + + mdiArea.removeSubWindow(widget1); + QVERIFY(!widget1->parent()); + + widget2->setParent(widget1); + mdiArea.removeSubWindow(widget2); + QCOMPARE(widget2->parent(), widget1); + + delete widget1; +} + QTEST_MAIN(tst_QMdiSubWindow) #include "tst_qmdisubwindow.moc" diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index 4deade0b4d..741d6839db 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.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$ ** @@ -456,6 +451,7 @@ void tst_QMenu::overrideMenuAction() //test the override menu action by first creating an action to which we set its menu QMainWindow w; w.resize(300, 200); + w.menuBar()->setNativeMenuBar(false); centerOnScreen(&w); QAction *aFileMenu = new QAction("&File", &w); @@ -559,7 +555,7 @@ void tst_QMenu::widgetActionFocus() QMenu m; QListWidget *l = new QListWidget(&m); for (int i = 1; i<3 ; i++) - l->addItem(QString("item%1").arg(i)); + l->addItem(QStringLiteral("item" ) + QString::number(i)); QWidgetAction *wa = new QWidgetAction(&m); wa->setDefaultWidget(l); m.addAction(wa); @@ -596,10 +592,19 @@ void tst_QMenu::widgetActionFocus() QCOMPARE(m.activeAction(), (QAction *)wa); } +static QMenu *getTornOffMenu() +{ + foreach (QWidget *w, QApplication::allWidgets()) { + if (w->isVisible() && w->inherits("QTornOffMenu")) + return static_cast<QMenu *>(w); + } + return Q_NULLPTR; +} + void tst_QMenu::tearOff() { QWidget widget; - QMenu *menu = new QMenu(&widget); + QScopedPointer<QMenu> menu(new QMenu(&widget)); QVERIFY(!menu->isTearOffEnabled()); //default value menu->setTearOffEnabled(true); menu->addAction("aaa"); @@ -612,24 +617,43 @@ void tst_QMenu::tearOff() widget.activateWindow(); QVERIFY(QTest::qWaitForWindowActive(&widget)); menu->popup(widget.geometry().topRight() + QPoint(50, 0)); - QVERIFY(QTest::qWaitForWindowActive(menu)); + QVERIFY(QTest::qWaitForWindowActive(menu.data())); QVERIFY(!menu->isTearOffMenuVisible()); - QTest::mouseClick(menu, Qt::LeftButton, 0, QPoint(3, 3), 10); + QTest::mouseClick(menu.data(), Qt::LeftButton, 0, QPoint(3, 3), 10); QTRY_VERIFY(menu->isTearOffMenuVisible()); - QPointer<QMenu> torn = 0; - foreach (QWidget *w, QApplication::allWidgets()) { - if (w->inherits("QTornOffMenu")) { - torn = static_cast<QMenu *>(w); - break; - } - } + QPointer<QMenu> torn = getTornOffMenu(); QVERIFY(torn); QVERIFY(torn->isVisible()); menu->hideTearOffMenu(); QVERIFY(!menu->isTearOffMenuVisible()); QVERIFY(!torn->isVisible()); + +#ifndef QT_NO_CURSOR + // Test under-mouse positioning + menu->showTearOffMenu(); + torn = getTornOffMenu(); + QVERIFY(torn); + QVERIFY(torn->isVisible()); + QVERIFY(menu->isTearOffMenuVisible()); + // Some platforms include the window title bar in its geometry. + QTRY_COMPARE(torn->windowHandle()->position(), QCursor::pos()); + + menu->hideTearOffMenu(); + QVERIFY(!menu->isTearOffMenuVisible()); + QVERIFY(!torn->isVisible()); + + // Test custom positioning + const QPoint &pos = QCursor::pos() / 2 + QPoint(10, 10); + menu->showTearOffMenu(pos); + torn = getTornOffMenu(); + QVERIFY(torn); + QVERIFY(torn->isVisible()); + QVERIFY(menu->isTearOffMenuVisible()); + // Some platforms include the window title bar in its geometry. + QTRY_COMPARE(torn->windowHandle()->position(), pos); +#endif // QT_NO_CURSOR } void tst_QMenu::submenuTearOffDontClose() @@ -852,7 +876,7 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition() uint i = 2; while (main.columnCount() < 2) { - main.addAction(QString("Item %1").arg(i)); + main.addAction(QLatin1String("Item ") + QString::number(i)); ++i; QVERIFY(i<1000); } @@ -1232,7 +1256,7 @@ public: MyMenu() : m_currentIndex(0) { for (int i = 0; i < 2; ++i) - dialogActions[i] = addAction( QString("dialog %1").arg(i), dialogs + i, SLOT(exec())); + dialogActions[i] = addAction(QLatin1String("dialog ") + QString::number(i), dialogs + i, SLOT(exec())); } void activateAction(int index) diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm b/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm index b1708d8669..f90af47c19 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu_mac.mm @@ -1,37 +1,32 @@ /**************************************************************************** ** -** 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$ ** ****************************************************************************/ -#import <Cocoa/Cocoa.h> +#import <AppKit/AppKit.h> #include <QMenu> #include <QTest> diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 45eae18240..9a68655fb6 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.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$ ** @@ -98,7 +93,6 @@ private slots: #if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) void accel(); void activatedCount(); - void allowActiveAndDisabled(); void check_accelKeys(); void check_cursorKeys1(); @@ -107,6 +101,9 @@ private slots: void check_escKey(); #endif +#ifndef Q_OS_WINCE + void allowActiveAndDisabled(); +#endif void check_endKey(); void check_homeKey(); @@ -172,8 +169,6 @@ void tst_QMenuBar::getSetCheck() #include <qcursor.h> -const int RESET = 0; - /*! Test plan: insertItem (all flavors and combinations) @@ -217,6 +212,7 @@ void tst_QMenuBar::cleanup() TestMenu tst_QMenuBar::initSimpleMenuBar(QMenuBar *mb) { TestMenu result; + mb->setNativeMenuBar(false); connect(mb, SIGNAL(triggered(QAction*)), this, SLOT(onSimpleActivated(QAction*))); QMenu *menu = mb->addMenu(QStringLiteral("&accel")); QAction *action = menu->addAction(QStringLiteral("menu1") ); @@ -284,6 +280,7 @@ void tst_QMenuBar::onComplexActionTriggered() TestMenu tst_QMenuBar::initComplexMenuBar(QMenuBar *mb) { TestMenu result; + mb->setNativeMenuBar(false); QMenu *menu = addNumberedMenu(mb, 1); result.menus << menu; for (char c = 'a'; c < 'c'; ++c) @@ -926,10 +923,11 @@ void tst_QMenuBar::check_escKey() // QCOMPARE(m_complexActionTriggerCount['h'], (uint)itemH_count); // } -#if !defined(Q_OS_MAC) && !defined(Q_OS_WINCE) +#ifndef Q_OS_WINCE void tst_QMenuBar::allowActiveAndDisabled() { QMenuBar menuBar; + menuBar.setNativeMenuBar(false); // Task 241043 : check that second menu is activated if only // disabled menu items are added @@ -997,6 +995,7 @@ void tst_QMenuBar::check_altClosePress() QMainWindow w; w.setWindowTitle(QTest::currentTestFunction()); + w.menuBar()->setNativeMenuBar(false); QMenu *menuFile = w.menuBar()->addMenu(tr("&File")); menuFile->addAction("Quit"); QMenu *menuEdit = w.menuBar()->addMenu(tr("&Edit")); @@ -1072,6 +1071,7 @@ void tst_QMenuBar::check_menuPosition() menu.addAction("item"); } + w.menuBar()->setNativeMenuBar(false); QAction *menu_action = w.menuBar()->addMenu(&menu); centerOnScreen(&w); w.show(); @@ -1405,6 +1405,7 @@ void tst_QMenuBar::cornerWidgets() widget.setWindowTitle(QLatin1String(QTest::currentTestFunction()) + dataTag); QVBoxLayout *layout = new QVBoxLayout(&widget); QMenuBar *menuBar = new QMenuBar(&widget); + menuBar->setNativeMenuBar(false); layout->addWidget(menuBar); QMenu *fileMenu = menuBar->addMenu("File"); fileMenu->addAction("Quit"); diff --git a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST index cdff75ba65..fa326a6ea5 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST +++ b/tests/auto/widgets/widgets/qopenglwidget/BLACKLIST @@ -1,4 +1,17 @@ [clearAndGrab] opensuse-13.1 + +#QTBUG-31611 +[painter] +windows msvc-2010 32bit developer-build + +#QTBUG-31611 +[reparentToAlreadyCreated] +windows msvc-2010 32bit developer-build + +#QTBUG-31611 +[reparentToNotYetCreated] +windows msvc-2010 32bit developer-build + [stackWidgetOpaqueChildIsVisible] windows diff --git a/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro b/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro index bbc6e987af..2d4cff9e10 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro +++ b/tests/auto/widgets/widgets/qopenglwidget/qopenglwidget.pro @@ -1,8 +1,5 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qopenglwidget QT += gui-private core-private testlib widgets SOURCES += tst_qopenglwidget.cpp - -win32-msvc2010:contains(QT_CONFIG, angle):CONFIG += insignificant_test # QTBUG-31611 diff --git a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp index f5c127a063..e3e26d612f 100644 --- a/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.cpp +++ b/tests/auto/widgets/widgets/qopenglwidget/tst_qopenglwidget.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/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index 8c86056ad3..b58d236a91 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.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/widgets/qprogressbar/tst_qprogressbar.cpp b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp index 5455ebb830..205ef34958 100644 --- a/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.cpp +++ b/tests/auto/widgets/widgets/qprogressbar/tst_qprogressbar.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/widgets/qpushbutton/tst_qpushbutton.cpp b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp index 44a554ad82..302d290c72 100644 --- a/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.cpp +++ b/tests/auto/widgets/widgets/qpushbutton/tst_qpushbutton.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$ ** @@ -49,17 +44,12 @@ class tst_QPushButton : public QObject { Q_OBJECT -public: - tst_QPushButton(); - virtual ~tst_QPushButton(); - -public slots: +private slots: void initTestCase(); void cleanupTestCase(); void init(); - void cleanup(); -private slots: + void getSetCheck(); void autoRepeat(); void pressed(); @@ -109,14 +99,6 @@ void tst_QPushButton::getSetCheck() delete var1; } -tst_QPushButton::tst_QPushButton() -{ -} - -tst_QPushButton::~tst_QPushButton() -{ -} - void tst_QPushButton::initTestCase() { // Create the test class @@ -149,11 +131,6 @@ void tst_QPushButton::init() resetCounters(); } -void tst_QPushButton::cleanup() -{ -} - - void tst_QPushButton::resetCounters() { toggle_count = 0; @@ -537,9 +514,6 @@ void tst_QPushButton::sizeHint_data() #if !defined(QT_NO_STYLE_WINDOWS) QTest::newRow("windows") << QString::fromLatin1("windows"); #endif -#if !defined(QT_NO_STYLE_GTK) - QTest::newRow("gtk") << QString::fromLatin1("gtk"); -#endif #if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) QTest::newRow("macintosh") << QString::fromLatin1("macintosh"); #endif diff --git a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp index 7d8190c932..e3752df09e 100644 --- a/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.cpp +++ b/tests/auto/widgets/widgets/qradiobutton/tst_qradiobutton.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/widgets/qscrollarea/qscrollarea.pro b/tests/auto/widgets/widgets/qscrollarea/qscrollarea.pro index 0cd706420e..bdf18a0252 100644 --- a/tests/auto/widgets/widgets/qscrollarea/qscrollarea.pro +++ b/tests/auto/widgets/widgets/qscrollarea/qscrollarea.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qscrollarea QT += widgets testlib SOURCES += tst_qscrollarea.cpp diff --git a/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp b/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp index ce6afc0a57..d1923e4bb0 100644 --- a/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.cpp +++ b/tests/auto/widgets/widgets/qscrollarea/tst_qscrollarea.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/widgets/qscrollbar/qscrollbar.pro b/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro index 8c6ea6e1d4..2863dd2034 100644 --- a/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro +++ b/tests/auto/widgets/widgets/qscrollbar/qscrollbar.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qscrollbar QT += widgets testlib SOURCES += tst_qscrollbar.cpp diff --git a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp index 0b7189179d..08ef96bf1b 100644 --- a/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.cpp +++ b/tests/auto/widgets/widgets/qscrollbar/tst_qscrollbar.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/widgets/qsizegrip/qsizegrip.pro b/tests/auto/widgets/widgets/qsizegrip/qsizegrip.pro index ceb897c612..1149b50feb 100644 --- a/tests/auto/widgets/widgets/qsizegrip/qsizegrip.pro +++ b/tests/auto/widgets/widgets/qsizegrip/qsizegrip.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsizegrip INCLUDEPATH += . QT += widgets testlib diff --git a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp index d5f6ac689f..7610adc155 100644 --- a/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.cpp +++ b/tests/auto/widgets/widgets/qsizegrip/tst_qsizegrip.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/widgets/qslider/qslider.pro b/tests/auto/widgets/widgets/qslider/qslider.pro index d0a61e5a95..4c8b061459 100644 --- a/tests/auto/widgets/widgets/qslider/qslider.pro +++ b/tests/auto/widgets/widgets/qslider/qslider.pro @@ -3,7 +3,6 @@ ############################################################ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qslider QT += widgets testlib SOURCES += tst_qslider.cpp diff --git a/tests/auto/widgets/widgets/qslider/tst_qslider.cpp b/tests/auto/widgets/widgets/qslider/tst_qslider.cpp index 3bbf41d61b..65cc3c9ece 100644 --- a/tests/auto/widgets/widgets/qslider/tst_qslider.cpp +++ b/tests/auto/widgets/widgets/qslider/tst_qslider.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/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp index 6d011eed59..808c7f9d3d 100644 --- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.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/widgets/qsplashscreen/tst_qsplashscreen.cpp b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp index f9632a5974..91a9c49b00 100644 --- a/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.cpp +++ b/tests/auto/widgets/widgets/qsplashscreen/tst_qsplashscreen.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/widgets/qsplitter/qsplitter.pro b/tests/auto/widgets/widgets/qsplitter/qsplitter.pro index c43847b11f..8ae745ea9d 100644 --- a/tests/auto/widgets/widgets/qsplitter/qsplitter.pro +++ b/tests/auto/widgets/widgets/qsplitter/qsplitter.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qsplitter QT += widgets testlib SOURCES += tst_qsplitter.cpp diff --git a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp index a54ad6ecd0..f490446c8a 100644 --- a/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/widgets/widgets/qsplitter/tst_qsplitter.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$ ** @@ -678,9 +673,9 @@ void tst_QSplitter::task187373_addAbstractScrollAreas_data() classNames << QLatin1String("QTreeView"); foreach (QString className, classNames) { - QTest::newRow(qPrintable(QString("%1 1").arg(className))) << className << false << true; - QTest::newRow(qPrintable(QString("%1 2").arg(className))) << className << true << false; - QTest::newRow(qPrintable(QString("%1 3").arg(className))) << className << true << true; + QTest::newRow(qPrintable(className + QLatin1String(" 1"))) << className << false << true; + QTest::newRow(qPrintable(className + QLatin1String(" 2"))) << className << true << false; + QTest::newRow(qPrintable(className + QLatin1String(" 3"))) << className << true << true; } } diff --git a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp index d9219f8941..2df5f01627 100644 --- a/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.cpp +++ b/tests/auto/widgets/widgets/qstackedwidget/tst_qstackedwidget.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$ ** @@ -149,7 +144,7 @@ private: void createWidgets() { for (int i = 0; i < m_n; ++i) { QLineEdit *le = new QLineEdit(this); - le->setObjectName(QString::fromLatin1("lineEdit%1").arg(i)); + le->setObjectName(QLatin1String("lineEdit") + QString::number(i)); layout ()->addWidget(le); m_les << le; } diff --git a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp index 991e72acd0..14ee6cb9bd 100644 --- a/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.cpp +++ b/tests/auto/widgets/widgets/qstatusbar/tst_qstatusbar.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$ ** @@ -44,21 +39,13 @@ class tst_QStatusBar: public QObject { Q_OBJECT -public: - tst_QStatusBar(); - virtual ~tst_QStatusBar(); - - protected slots: void messageChanged(const QString&); -public slots: - void initTestCase(); - void cleanupTestCase(); +private slots: void init(); void cleanup(); -private slots: void tempMessage(); void insertWidget(); void insertPermanentWidget(); @@ -73,14 +60,6 @@ private: QString currentMessage; }; -tst_QStatusBar::tst_QStatusBar() -{ -} - -tst_QStatusBar::~tst_QStatusBar() -{ -} - void tst_QStatusBar::init() { testWidget = new QStatusBar; @@ -97,14 +76,6 @@ void tst_QStatusBar::cleanup() delete testWidget; } -void tst_QStatusBar::initTestCase() -{ -} - -void tst_QStatusBar::cleanupTestCase() -{ -} - void tst_QStatusBar::messageChanged(const QString &m) { currentMessage = m; diff --git a/tests/auto/widgets/widgets/qtabbar/qtabbar.pro b/tests/auto/widgets/widgets/qtabbar/qtabbar.pro index 8772005bef..01b3c4a404 100644 --- a/tests/auto/widgets/widgets/qtabbar/qtabbar.pro +++ b/tests/auto/widgets/widgets/qtabbar/qtabbar.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtabbar QT += widgets testlib SOURCES += tst_qtabbar.cpp diff --git a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp index 3f1badeda1..550cca8145 100644 --- a/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.cpp +++ b/tests/auto/widgets/widgets/qtabbar/tst_qtabbar.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$ ** @@ -600,7 +595,7 @@ public slots: void updateTabText() { count++; - setTabText(0, QString("%1").arg(count)); + setTabText(0, QString::number(count)); } }; diff --git a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp index a991f18110..f8125bf749 100644 --- a/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.cpp +++ b/tests/auto/widgets/widgets/qtabwidget/tst_qtabwidget.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$ ** @@ -76,13 +71,11 @@ class QTabWidgetChild:public QTabWidget { class tst_QTabWidget:public QObject { Q_OBJECT - public: - tst_QTabWidget(); - public slots: +private slots: void init(); void cleanup(); - private slots: + void getSetCheck(); void testChild(); void addRemoveTab(); @@ -156,10 +149,6 @@ void tst_QTabWidget::getSetCheck() QCOMPARE(w5, obj1.currentWidget()); // current not changed } -tst_QTabWidget::tst_QTabWidget() -{ -} - void tst_QTabWidget::init() { tw = new QTabWidget(0); diff --git a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp index 8c9e908228..700fa505c1 100644 --- a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.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$ ** @@ -72,15 +67,11 @@ QVariant TestBrowser::loadResource(int type, const QUrl &name) class tst_QTextBrowser : public QObject { Q_OBJECT -public: - tst_QTextBrowser(); - virtual ~tst_QTextBrowser(); -public slots: +private slots: void init(); void cleanup(); -private slots: void noReloadOnAnchorJump(); void bgColorOnSourceChange(); void forwardButton(); @@ -105,14 +96,6 @@ private: TestBrowser *browser; }; -tst_QTextBrowser::tst_QTextBrowser() -{ -} - -tst_QTextBrowser::~tst_QTextBrowser() -{ -} - void tst_QTextBrowser::init() { QString prefix = QFileInfo(QFINDTESTDATA("subdir")).absolutePath(); diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index 690a25a87d..69f0ff0f7e 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.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/widgets/qtoolbar/tst_qtoolbar.cpp b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp index e653a85d96..3525dcddd6 100644 --- a/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.cpp +++ b/tests/auto/widgets/widgets/qtoolbar/tst_qtoolbar.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/widgets/qtoolbox/qtoolbox.pro b/tests/auto/widgets/widgets/qtoolbox/qtoolbox.pro index a8c62ec54a..19b3a03443 100644 --- a/tests/auto/widgets/widgets/qtoolbox/qtoolbox.pro +++ b/tests/auto/widgets/widgets/qtoolbox/qtoolbox.pro @@ -1,5 +1,4 @@ CONFIG += testcase -CONFIG += parallel_test TARGET = tst_qtoolbox QT += widgets testlib SOURCES += tst_qtoolbox.cpp diff --git a/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp b/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp index b016811eeb..8637b2e8f9 100644 --- a/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.cpp +++ b/tests/auto/widgets/widgets/qtoolbox/tst_qtoolbox.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$ ** @@ -44,19 +39,13 @@ class tst_QToolBox : public QObject { Q_OBJECT -public: - tst_QToolBox(); - virtual ~tst_QToolBox(); - protected slots: void currentChanged(int); -public slots: - void initTestCase(); - void cleanupTestCase(); +private slots: void init(); void cleanup(); -private slots: + void getSetCheck(); void populate(); void change(); @@ -106,14 +95,6 @@ void tst_QToolBox::getSetCheck() QCOMPARE(w3, obj1.currentWidget()); } -tst_QToolBox::tst_QToolBox() -{ -} - -tst_QToolBox::~tst_QToolBox() -{ -} - class tst_QToolBoxPrivate { public: @@ -183,14 +164,6 @@ void tst_QToolBox::cleanup() delete d; } -void tst_QToolBox::initTestCase() -{ -} - -void tst_QToolBox::cleanupTestCase() -{ -} - void tst_QToolBox::currentChanged(int index) { currentIndex = index; diff --git a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp index 0d1abe5032..1775f03680 100644 --- a/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.cpp +++ b/tests/auto/widgets/widgets/qtoolbutton/tst_qtoolbutton.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$ ** |