diff options
Diffstat (limited to 'tests/manual')
10 files changed, 251 insertions, 13 deletions
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp index 9e3c761cff..800baae45e 100644 --- a/tests/manual/dialogs/filedialogpanel.cpp +++ b/tests/manual/dialogs/filedialogpanel.cpp @@ -438,9 +438,9 @@ void FileDialogPanel::restoreDefaults() setComboBoxValue(m_viewMode, d.viewMode()); m_showDirsOnly->setChecked(d.testOption(QFileDialog::ShowDirsOnly)); m_allowedSchemes->setText(QString()); - m_confirmOverWrite->setChecked(d.confirmOverwrite()); - m_nameFilterDetailsVisible->setChecked(d.isNameFilterDetailsVisible()); - m_resolveSymLinks->setChecked(d.resolveSymlinks()); + m_confirmOverWrite->setChecked(!d.testOption(QFileDialog::DontConfirmOverwrite)); + m_nameFilterDetailsVisible->setChecked(!d.testOption(QFileDialog::HideNameFilterDetails)); + m_resolveSymLinks->setChecked(!d.testOption(QFileDialog::DontResolveSymlinks)); m_readOnly->setChecked(d.isReadOnly()); m_native->setChecked(true); m_customDirIcons->setChecked(d.testOption(QFileDialog::DontUseCustomDirectoryIcons)); diff --git a/tests/manual/dialogs/printdialogpanel.cpp b/tests/manual/dialogs/printdialogpanel.cpp index d999dbc30c..8d64d2f6a6 100644 --- a/tests/manual/dialogs/printdialogpanel.cpp +++ b/tests/manual/dialogs/printdialogpanel.cpp @@ -55,6 +55,10 @@ #include <QTextStream> #include <QDir> +#if QT_VERSION >= 0x050000 +# include <QScreen> +#endif + const FlagData printerModeComboData[] = { {"ScreenResolution", QPrinter::ScreenResolution}, @@ -705,7 +709,13 @@ void PrintDialogPanel::showPreviewDialog() { applySettings(m_printer.data()); PrintPreviewDialog dialog(m_printer.data(), this); - dialog.resize(QApplication::desktop()->availableGeometry().size() * 4/ 5); +#if QT_VERSION >= 0x050000 + const int screenNumber = QApplication::desktop()->screenNumber(this); + const QSize availableSize = QGuiApplication::screens().at(screenNumber)->availableSize(); +#else + const QSize availableSize = QApplication::desktop()->availableGeometry().size(); +#endif + dialog.resize(availableSize * 4/ 5); if (dialog.exec() == QDialog::Accepted) retrieveSettings(m_printer.data()); } diff --git a/tests/manual/foreignwindows/main.cpp b/tests/manual/foreignwindows/main.cpp index 74c6d8c376..44aff54773 100644 --- a/tests/manual/foreignwindows/main.cpp +++ b/tests/manual/foreignwindows/main.cpp @@ -195,6 +195,9 @@ static QString description(const QString &appName) "tests embedding foreign windows into Qt.\n\nUse cases:\n\n" << appName << " -a Dump a list of all native window ids.\n" << appName << " <winid> Dump information on the window.\n" + << appName << " -m <winid> Move window to top left corner\n" + << QByteArray(appName.size(), ' ') + << " (recover lost windows after changing monitor setups).\n" << appName << " -c <winid> Dump information on the window continuously.\n" << appName << " -e <winid> Embed window into a Qt widget.\n" << "\nOn Windows, class names of well known controls (EDIT, BUTTON...) can be\n" @@ -245,6 +248,10 @@ int main(int argc, char *argv[]) parser.addOption(outputAllOption); QCommandLineOption continuousOption(QStringList() << QStringLiteral("c") << QStringLiteral("continuous"), QStringLiteral("Output continuously.")); + parser.addOption(outputAllOption); + QCommandLineOption moveOption(QStringList() << QStringLiteral("m") << QStringLiteral("move"), + QStringLiteral("Move window to top left corner.")); + parser.addOption(moveOption); parser.addOption(continuousOption); QCommandLineOption embedOption(QStringList() << QStringLiteral("e") << QStringLiteral("embed"), QStringLiteral("Embed a foreign window into a Qt widget.")); @@ -274,8 +281,12 @@ int main(int argc, char *argv[]) return -1; } QWindow *foreignWindow = QWindow::fromWinId(wid); + if (!foreignWindow) + return -1; foreignWindow->setObjectName("ForeignWindow" + QString::number(wid, 16)); windows.append(foreignWindow); + if (parser.isSet(moveOption)) + foreignWindow->setFramePosition(QGuiApplication::primaryScreen()->availableGeometry().topLeft()); } if (windows.isEmpty()) diff --git a/tests/manual/qcursor/grab_override/mainwindow.cpp b/tests/manual/qcursor/grab_override/mainwindow.cpp index d2b7311846..087ee8d1d8 100644 --- a/tests/manual/qcursor/grab_override/mainwindow.cpp +++ b/tests/manual/qcursor/grab_override/mainwindow.cpp @@ -79,10 +79,10 @@ void MainWindow::toggleOverrideCursor() { switch (override) { case 0: - QApplication::setOverrideCursor(Qt::BusyCursor); + QGuiApplication::setOverrideCursor(Qt::BusyCursor); break; case 1: - QApplication::restoreOverrideCursor(); + QGuiApplication::restoreOverrideCursor(); break; case 2: ui->label->grabMouse(Qt::ForbiddenCursor); diff --git a/tests/manual/qsslsocket/main.cpp b/tests/manual/qsslsocket/main.cpp index b2cc1b5f23..58da520c07 100644 --- a/tests/manual/qsslsocket/main.cpp +++ b/tests/manual/qsslsocket/main.cpp @@ -91,21 +91,21 @@ void tst_QSslSocket::nextProtocolNegotiation_data() << QSslConfiguration::NextProtocolNegotiationNegotiated; tag = host.toLocal8Bit(); - tag.append("-spdy/3"); + tag.append("-h2"); QTest::newRow(tag) << true << host - << (QList<QByteArray>() << QSslConfiguration::NextProtocolSpdy3_0) - << QByteArray(QSslConfiguration::NextProtocolSpdy3_0) + << (QList<QByteArray>() << QSslConfiguration::ALPNProtocolHTTP2) + << QByteArray(QSslConfiguration::ALPNProtocolHTTP2) << QSslConfiguration::NextProtocolNegotiationNegotiated; tag = host.toLocal8Bit(); - tag.append("-spdy/3-and-http/1.1"); + tag.append("-h2-and-http/1.1"); QTest::newRow(tag) << true << host - << (QList<QByteArray>() << QSslConfiguration::NextProtocolSpdy3_0 << QSslConfiguration::NextProtocolHttp1_1) - << QByteArray(QSslConfiguration::NextProtocolSpdy3_0) + << (QList<QByteArray>() << QSslConfiguration::ALPNProtocolHTTP2 << QSslConfiguration::NextProtocolHttp1_1) + << QByteArray(QSslConfiguration::ALPNProtocolHTTP2) << QSslConfiguration::NextProtocolNegotiationNegotiated; } } diff --git a/tests/manual/widgets/itemviews/itemviews.pro b/tests/manual/widgets/itemviews/itemviews.pro index 53f658d54d..8884cc3aae 100644 --- a/tests/manual/widgets/itemviews/itemviews.pro +++ b/tests/manual/widgets/itemviews/itemviews.pro @@ -1,2 +1,8 @@ TEMPLATE = subdirs -SUBDIRS = delegate qheaderview qtreeview qtreewidget tableview-span-navigation +SUBDIRS = delegate \ + qconcatenatetablesproxymodel \ + qheaderview \ + qtreeview \ + qtreewidget \ + tableview-span-navigation \ + diff --git a/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp new file mode 100644 index 0000000000..2c1825f29f --- /dev/null +++ b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/main.cpp @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author David Faure <david.faure@kdab.com> +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $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 https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** 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$ +** +****************************************************************************/ + +#include <QApplication> +#include <QConcatenateTablesProxyModel> +#include <QStandardItemModel> +#include <QTableView> +#include <QTreeView> + +static void prepareModel(const QString &prefix, QStandardItemModel *model) +{ + for (int row = 0; row < model->rowCount(); ++row) { + for (int column = 0; column < model->columnCount(); ++column) { + QStandardItem *item = new QStandardItem(prefix + QString(" %1,%2").arg(row).arg(column)); + item->setDragEnabled(true); + item->setDropEnabled(true); + model->setItem(row, column, item); + } + } +} + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QStandardItemModel firstModel(4, 4); + prepareModel("First", &firstModel); + QStandardItemModel secondModel(2, 2); + + QConcatenateTablesProxyModel proxy; + proxy.addSourceModel(&firstModel); + proxy.addSourceModel(&secondModel); + + prepareModel("Second", &secondModel); + + QTableView tableView; + tableView.setWindowTitle("concat proxy, in QTableView"); + tableView.setDragDropMode(QAbstractItemView::DragDrop); + tableView.setModel(&proxy); + tableView.show(); + + QTreeView treeView; + treeView.setWindowTitle("concat proxy, in QTreeView"); + treeView.setDragDropMode(QAbstractItemView::DragDrop); + treeView.setModel(&proxy); + treeView.show(); + + // For comparison, views on top on QStandardItemModel + + QTableView tableViewTest; + tableViewTest.setWindowTitle("first model, in QTableView"); + tableViewTest.setDragDropMode(QAbstractItemView::DragDrop); + tableViewTest.setModel(&firstModel); + tableViewTest.show(); + + QTreeView treeViewTest; + treeViewTest.setWindowTitle("first model, in QTreeView"); + treeViewTest.setDragDropMode(QAbstractItemView::DragDrop); + treeViewTest.setModel(&firstModel); + treeViewTest.show(); + + return app.exec(); +} diff --git a/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro new file mode 100644 index 0000000000..19904212a7 --- /dev/null +++ b/tests/manual/widgets/itemviews/qconcatenatetablesproxymodel/qconcatenatetablesproxymodel.pro @@ -0,0 +1,8 @@ + +TEMPLATE = app +TARGET = qconcatenatetablesproxymodel +INCLUDEPATH += . + +QT += widgets + +SOURCES += main.cpp diff --git a/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp new file mode 100644 index 0000000000..dbca6df454 --- /dev/null +++ b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp @@ -0,0 +1,111 @@ +/**************************************************************************** + ** + ** Copyright (C) 2019 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: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 https://www.qt.io/terms-conditions. For further + ** information use the contact form at https://www.qt.io/contact-us. + ** + ** 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$ + ** + ****************************************************************************/ + +// Test that the size of the saved state bytearray does not change due to moving a +// toolbar from one area to another. It should stay the same size as the first time +// it had that toolbar in it + +#include <QApplication> +#include <QMainWindow> +#include <QToolBar> +#include <QPushButton> +#include <QLabel> +#include <QVBoxLayout> +#include <QMessageBox> + +class MainWindow : public QMainWindow +{ + Q_OBJECT +public: + MainWindow() : QMainWindow() + { + auto *tb = new QToolBar(this); + tb->setObjectName("Toolbar"); + tb->addAction("Test action"); + tb->addAction("Test action"); + addToolBar(Qt::TopToolBarArea, tb); + auto *movableTb = new QToolBar(this); + movableTb->setObjectName("Movable Toolbar"); + movableTb->addAction("Test action"); + movableTb->addAction("Test action"); + addToolBar(Qt::TopToolBarArea, movableTb); + auto *widget = new QWidget; + auto *vbox = new QVBoxLayout; + auto *label = new QLabel; + label->setText("1. Click on check state size to save initial state\n" + "2. Drag the movable toolbar in the top dock area to the left area." + " Click on check state size to save moved state\n" + "3. Drag the movable toolbar from the left dock area to the top area." + " Click on check state size to compare the state sizes.\n" + "4. Drag the movable toolbar in the top dock area to the left area." + " Click on check state size to compare the state sizes.\n" + "5. Drag the movable toolbar from the left dock area to the top area." + " Click on check state size to compare the state sizes.\n"); + vbox->addWidget(label); + auto *pushButton = new QPushButton("Check state size"); + connect(pushButton, &QPushButton::clicked, this, &MainWindow::checkState); + vbox->addWidget(pushButton); + widget->setLayout(vbox); + setCentralWidget(widget); + } +public slots: + void checkState() + { + stepCounter++; + QString messageText; + if (stepCounter == 1) { + beforeMoveStateData = saveState(); + messageText = QLatin1String("Initial state saved"); + } else if (stepCounter == 2) { + afterMoveStateData = saveState(); + messageText = QLatin1String("Moved state saved"); + } else { + const int currentSaveSize = saveState().size(); + const int compareValue = (stepCounter == 4) ? afterMoveStateData.size() : beforeMoveStateData.size(); + messageText = QString::fromLatin1("%1 step %2") + .arg((currentSaveSize == compareValue) ? QLatin1String("SUCCESS") : QLatin1String("FAIL")) + .arg(stepCounter); + } + QMessageBox::information(this, "Step done", messageText); + } +private: + int stepCounter = 0; + QByteArray beforeMoveStateData; + QByteArray afterMoveStateData; +}; + +#include "main.moc" + +int main(int argc, char **argv) +{ + QApplication a(argc, argv); + MainWindow mw; + mw.show(); + return a.exec(); +} + diff --git a/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro new file mode 100644 index 0000000000..6ee128ed3b --- /dev/null +++ b/tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro @@ -0,0 +1,4 @@ +QT += widgets +TEMPLATE = app +TARGET = saveStateSize +SOURCES += main.cpp |