summaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/cocoa/noclickthrough/main.cpp48
-rw-r--r--tests/manual/cocoa/noclickthrough/noclickthrough.pro4
-rw-r--r--tests/manual/dialogs/filedialogpanel.cpp15
-rw-r--r--tests/manual/dialogs/main.cpp17
-rw-r--r--tests/manual/dialogs/printdialogpanel.cpp12
-rw-r--r--tests/manual/embeddedintoforeignwindow/embeddedintoforeignwindow.pro3
-rw-r--r--tests/manual/filetest/filetest.pro3
-rw-r--r--tests/manual/foreignwindows/foreignwindows.pro3
-rw-r--r--tests/manual/foreignwindows/main.cpp11
-rw-r--r--tests/manual/gestures/graphicsview/gestures.cpp2
-rw-r--r--tests/manual/highdpi/highdpi.pro3
-rw-r--r--tests/manual/lance/lance.pro3
-rw-r--r--tests/manual/qcursor/grab_override/mainwindow.cpp4
-rw-r--r--tests/manual/qdesktopservices/qdesktopservices.pro3
-rw-r--r--tests/manual/qgraphicsitemgroup/widget.cpp2
-rw-r--r--tests/manual/qmimedatabase/qmimedatabase.pro3
-rw-r--r--tests/manual/qsslsocket/main.cpp12
-rw-r--r--tests/manual/qstorageinfo/qstorageinfo.pro3
-rw-r--r--tests/manual/qsysinfo/main.cpp22
-rw-r--r--tests/manual/qsysinfo/qsysinfo.pro3
-rw-r--r--tests/manual/qtabletevent/regular_widgets/main.cpp2
-rw-r--r--tests/manual/textrendering/nativetext/main.cpp320
-rw-r--r--tests/manual/textrendering/nativetext/nativetext.pro7
-rw-r--r--tests/manual/textrendering/textrendering.pro3
-rw-r--r--tests/manual/widgets/styles/styles.pro3
-rw-r--r--tests/manual/widgets/widgets/qmainwindow/saveStateSize/main.cpp111
-rw-r--r--tests/manual/widgets/widgets/qmainwindow/saveStateSize/saveStateSize.pro4
-rw-r--r--tests/manual/widgets/widgets/widgets.pro5
28 files changed, 591 insertions, 40 deletions
diff --git a/tests/manual/cocoa/noclickthrough/main.cpp b/tests/manual/cocoa/noclickthrough/main.cpp
new file mode 100644
index 0000000000..eee7729999
--- /dev/null
+++ b/tests/manual/cocoa/noclickthrough/main.cpp
@@ -0,0 +1,48 @@
+/****************************************************************************
+ **
+ ** 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$
+ **
+ ****************************************************************************/
+
+#include <QtWidgets>
+
+int main(int argc, char **argv)
+{
+ QApplication a(argc, argv);
+ QWidget w;
+ QVBoxLayout *vbox = new QVBoxLayout;
+ QLabel *label = new QLabel("Make the window inactive, but visible.\n"
+ "Then click on the Two item.\n"
+ "The item should not be selected, but the window should be active.");
+ vbox->addWidget(label);
+ QListWidget *list = new QListWidget;
+ list->addItems(QStringList() << "One" << "Two" << "Three");
+ list->selectionModel()->select(list->model()->index(0, 0), QItemSelectionModel::Select);
+ list->viewport()->setAttribute(Qt::WA_MacNoClickThrough);
+ vbox->addWidget(list);
+ w.setLayout(vbox);
+ w.show();
+ return a.exec();
+}
diff --git a/tests/manual/cocoa/noclickthrough/noclickthrough.pro b/tests/manual/cocoa/noclickthrough/noclickthrough.pro
new file mode 100644
index 0000000000..a8e30cb146
--- /dev/null
+++ b/tests/manual/cocoa/noclickthrough/noclickthrough.pro
@@ -0,0 +1,4 @@
+QT += widgets
+TEMPLATE = app
+TARGET = noclickthrough
+SOURCES += main.cpp
diff --git a/tests/manual/dialogs/filedialogpanel.cpp b/tests/manual/dialogs/filedialogpanel.cpp
index 9e3c761cff..25c1e44b8c 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));
@@ -505,8 +505,15 @@ void FileDialogPanel::accepted()
Q_ASSERT(d);
m_result.clear();
QDebug(&m_result).nospace()
+#if QT_VERSION >= 0x050000
+ << "URLs: " << d->selectedUrls() << '\n'
+#endif
<< "Files: " << d->selectedFiles()
- << "\nDirectory: " << d->directory().absolutePath()
+ << "\nDirectory: "
+#if QT_VERSION >= 0x050000
+ << d->directoryUrl() << ", "
+#endif
+ << d->directory().absolutePath()
<< "\nName filter: " << d->selectedNameFilter();
QTimer::singleShot(0, this, SLOT(showAcceptedResult())); // Avoid problems with the closing (modal) dialog as parent.
}
diff --git a/tests/manual/dialogs/main.cpp b/tests/manual/dialogs/main.cpp
index 83089e684c..07df8f5cf4 100644
--- a/tests/manual/dialogs/main.cpp
+++ b/tests/manual/dialogs/main.cpp
@@ -44,6 +44,8 @@
#include <QAction>
#include <QKeySequence>
+static bool optNoPrinter = false;
+
// Test for dialogs, allowing to play with all dialog options for implementing native dialogs.
// Compiles with Qt 4.8 and Qt 5.
@@ -92,7 +94,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
QMenu *editMenu = menuBar()->addMenu(tr("&Edit"));
QAction *action = editMenu->addAction(tr("Cut"));
- action->setShortcut(QKeySequence(QKeySequence::Quit));
+ action->setShortcut(QKeySequence(QKeySequence::Cut));
action = editMenu->addAction(tr("Copy"));
action->setShortcut(QKeySequence(QKeySequence::Copy));
action = editMenu->addAction(tr("Paste"));
@@ -109,7 +111,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
tabWidget->addTab(new WizardPanel, tr("QWizard"));
tabWidget->addTab(new MessageBoxPanel, tr("QMessageBox"));
#ifndef QT_NO_PRINTER
- tabWidget->addTab(new PrintDialogPanel, tr("QPrintDialog"));
+ if (!optNoPrinter)
+ tabWidget->addTab(new PrintDialogPanel, tr("QPrintDialog"));
#endif
setCentralWidget(tabWidget);
}
@@ -123,14 +126,20 @@ void MainWindow::aboutDialog()
int main(int argc, char *argv[])
{
-#if QT_VERSION >= 0x050700
+#if QT_VERSION >= 0x050600
+ QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
+#endif
+
for (int a = 1; a < argc; ++a) {
if (!qstrcmp(argv[a], "-n")) {
qDebug("AA_DontUseNativeDialogs");
+#if QT_VERSION >= 0x050700
QCoreApplication::setAttribute(Qt::AA_DontUseNativeDialogs);
+#endif
+ } else if (!qstrcmp(argv[a], "-p")) {
+ optNoPrinter = true; // Avoid startup slowdown by printer code
}
}
-#endif // Qt 5
QApplication a(argc, argv);
MainWindow w;
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/embeddedintoforeignwindow/embeddedintoforeignwindow.pro b/tests/manual/embeddedintoforeignwindow/embeddedintoforeignwindow.pro
index 93da4b8c91..dba33a139e 100644
--- a/tests/manual/embeddedintoforeignwindow/embeddedintoforeignwindow.pro
+++ b/tests/manual/embeddedintoforeignwindow/embeddedintoforeignwindow.pro
@@ -1,7 +1,6 @@
TEMPLATE = app
QT += gui-private
-CONFIG += console c++11
-CONFIG -= app_bundle
+CONFIG += cmdline c++11
SOURCES += main.cpp itemwindow.cpp
HEADERS += itemwindow.h
include(../diaglib/diaglib.pri)
diff --git a/tests/manual/filetest/filetest.pro b/tests/manual/filetest/filetest.pro
index 5d2ba9b82b..b91689e0ff 100644
--- a/tests/manual/filetest/filetest.pro
+++ b/tests/manual/filetest/filetest.pro
@@ -1,6 +1,5 @@
TEMPLATE = app
QT = core
-CONFIG += console
-CONFIG -= app_bundle
+CONFIG += cmdline
SOURCES += main.cpp
diff --git a/tests/manual/foreignwindows/foreignwindows.pro b/tests/manual/foreignwindows/foreignwindows.pro
index 6a370a6813..15bf2395f8 100644
--- a/tests/manual/foreignwindows/foreignwindows.pro
+++ b/tests/manual/foreignwindows/foreignwindows.pro
@@ -1,6 +1,5 @@
TEMPLATE = app
QT += widgets
-CONFIG += console c++11
-CONFIG -= app_bundle
+CONFIG += cmdline c++11
SOURCES += main.cpp
include(../diaglib/diaglib.pri)
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/gestures/graphicsview/gestures.cpp b/tests/manual/gestures/graphicsview/gestures.cpp
index cc0ff3e1aa..6e5b07bf18 100644
--- a/tests/manual/gestures/graphicsview/gestures.cpp
+++ b/tests/manual/gestures/graphicsview/gestures.cpp
@@ -44,11 +44,13 @@ QGestureRecognizer::Result ThreeFingerSlideGestureRecognizer::recognize(QGesture
switch (event->type()) {
case QEvent::TouchBegin:
result = QGestureRecognizer::MayBeGesture;
+ break;
case QEvent::TouchEnd:
if (d->gestureFired)
result = QGestureRecognizer::FinishGesture;
else
result = QGestureRecognizer::CancelGesture;
+ break;
case QEvent::TouchUpdate:
if (d->state() != Qt::NoGesture) {
QTouchEvent *ev = static_cast<QTouchEvent*>(event);
diff --git a/tests/manual/highdpi/highdpi.pro b/tests/manual/highdpi/highdpi.pro
index 7d6b42535e..9db083cd82 100644
--- a/tests/manual/highdpi/highdpi.pro
+++ b/tests/manual/highdpi/highdpi.pro
@@ -2,8 +2,7 @@ TEMPLATE = app
TARGET = highdpi
INCLUDEPATH += .
QT += widgets gui-private
-CONFIG +=console
-CONFIG -= app_bundle
+CONFIG += cmdline
CONFIG += c++11
# Input
SOURCES += \
diff --git a/tests/manual/lance/lance.pro b/tests/manual/lance/lance.pro
index 312106c2f0..78ca2f56e5 100644
--- a/tests/manual/lance/lance.pro
+++ b/tests/manual/lance/lance.pro
@@ -1,6 +1,5 @@
LANCELOT_DIR = $$PWD/../../auto/other/lancelot
-CONFIG+=console moc
-CONFIG -= app_bundle
+CONFIG += cmdline moc
TEMPLATE = app
INCLUDEPATH += . $$LANCELOT_DIR
QT += core-private gui-private widgets printsupport
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/qdesktopservices/qdesktopservices.pro b/tests/manual/qdesktopservices/qdesktopservices.pro
index c96287e159..baa3c325ff 100644
--- a/tests/manual/qdesktopservices/qdesktopservices.pro
+++ b/tests/manual/qdesktopservices/qdesktopservices.pro
@@ -1,8 +1,7 @@
QT += testlib
TARGET = tst_qdesktopservices
-CONFIG += console
-CONFIG -= app_bundle
+CONFIG += cmdline
TEMPLATE = app
diff --git a/tests/manual/qgraphicsitemgroup/widget.cpp b/tests/manual/qgraphicsitemgroup/widget.cpp
index b0e7a47cf8..ba9ed815fa 100644
--- a/tests/manual/qgraphicsitemgroup/widget.cpp
+++ b/tests/manual/qgraphicsitemgroup/widget.cpp
@@ -224,7 +224,7 @@ void Widget::updateUngroupButton()
CustomItem * Widget::checkedItem() const
{
- CustomItem *item;
+ CustomItem *item = nullptr;
if (ui->blue->isChecked())
item = rectBlue;
diff --git a/tests/manual/qmimedatabase/qmimedatabase.pro b/tests/manual/qmimedatabase/qmimedatabase.pro
index 5473330edf..fd931d5eec 100644
--- a/tests/manual/qmimedatabase/qmimedatabase.pro
+++ b/tests/manual/qmimedatabase/qmimedatabase.pro
@@ -1,5 +1,4 @@
TEMPLATE = app
QT = core
-CONFIG += console
-CONFIG -= app_bundle
+CONFIG += cmdline
SOURCES += main.cpp
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/qstorageinfo/qstorageinfo.pro b/tests/manual/qstorageinfo/qstorageinfo.pro
index 25acd24c80..e47ecc5b3e 100644
--- a/tests/manual/qstorageinfo/qstorageinfo.pro
+++ b/tests/manual/qstorageinfo/qstorageinfo.pro
@@ -1,4 +1,3 @@
QT = core
-CONFIG += console
-CONFIG -= app_bundle
+CONFIG += cmdline
SOURCES += main.cpp
diff --git a/tests/manual/qsysinfo/main.cpp b/tests/manual/qsysinfo/main.cpp
index 62d0c51416..1d39514236 100644
--- a/tests/manual/qsysinfo/main.cpp
+++ b/tests/manual/qsysinfo/main.cpp
@@ -57,6 +57,11 @@ QByteArray windowsVersionToString(QSysInfo::WinVersion v)
CASE_VERSION(WV_WINDOWS8_1);
CASE_VERSION(WV_WINDOWS10);
case QSysInfo::WV_NT_based: // shouldn't happen
+ case QSysInfo::WV_CE:
+ case QSysInfo::WV_CENET:
+ case QSysInfo::WV_CE_5:
+ case QSysInfo::WV_CE_6:
+ case QSysInfo::WV_CE_based:
break;
}
@@ -82,6 +87,7 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_10_9);
CASE_VERSION(MV_10_10);
CASE_VERSION(MV_10_11);
+ CASE_VERSION(MV_10_12);
CASE_VERSION(MV_IOS_4_3);
CASE_VERSION(MV_IOS_5_0);
@@ -96,8 +102,24 @@ QByteArray macVersionToString(QSysInfo::MacVersion v)
CASE_VERSION(MV_IOS_8_3);
CASE_VERSION(MV_IOS_8_4);
CASE_VERSION(MV_IOS_9_0);
+ CASE_VERSION(MV_IOS_9_1);
+ CASE_VERSION(MV_IOS_9_2);
+ CASE_VERSION(MV_IOS_9_3);
+ CASE_VERSION(MV_IOS_10_0);
case QSysInfo::MV_IOS: // shouldn't happen:
+ case QSysInfo::MV_TVOS:
+ case QSysInfo::MV_WATCHOS:
break;
+
+ CASE_VERSION(MV_TVOS_9_0);
+ CASE_VERSION(MV_TVOS_9_1);
+ CASE_VERSION(MV_TVOS_9_2);
+ CASE_VERSION(MV_TVOS_10_0);
+
+ CASE_VERSION(MV_WATCHOS_2_0);
+ CASE_VERSION(MV_WATCHOS_2_1);
+ CASE_VERSION(MV_WATCHOS_2_2);
+ CASE_VERSION(MV_WATCHOS_3_0);
}
if (v & QSysInfo::MV_IOS) {
diff --git a/tests/manual/qsysinfo/qsysinfo.pro b/tests/manual/qsysinfo/qsysinfo.pro
index c73d8282cb..ff0a09d42e 100644
--- a/tests/manual/qsysinfo/qsysinfo.pro
+++ b/tests/manual/qsysinfo/qsysinfo.pro
@@ -1,7 +1,6 @@
QT = core
TARGET = qsysinfo
TEMPLATE = app
-CONFIG += console
-CONFIG -= app_bundle
+CONFIG += cmdline
SOURCES += main.cpp
diff --git a/tests/manual/qtabletevent/regular_widgets/main.cpp b/tests/manual/qtabletevent/regular_widgets/main.cpp
index c0366dea63..4816e2f3b9 100644
--- a/tests/manual/qtabletevent/regular_widgets/main.cpp
+++ b/tests/manual/qtabletevent/regular_widgets/main.cpp
@@ -284,7 +284,7 @@ int main(int argc, char *argv[])
mainWindow.setWindowTitle(QString::fromLatin1("Tablet Test %1").arg(QT_VERSION_STR));
EventReportWidget *widget = new EventReportWidget;
QObject::connect(proximityEventFilter, &ProximityEventFilter::proximityChanged,
- widget, QOverload<void>::of(&QWidget::update));
+ widget, QOverload<>::of(&QWidget::update));
widget->setMinimumSize(640, 480);
QMenu *fileMenu = mainWindow.menuBar()->addMenu("File");
fileMenu->addAction("Clear", widget, &EventReportWidget::clearPoints);
diff --git a/tests/manual/textrendering/nativetext/main.cpp b/tests/manual/textrendering/nativetext/main.cpp
new file mode 100644
index 0000000000..b481e44bae
--- /dev/null
+++ b/tests/manual/textrendering/nativetext/main.cpp
@@ -0,0 +1,320 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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$
+**
+****************************************************************************/
+
+#include <QtWidgets>
+
+#ifdef Q_OS_DARWIN
+#include <private/qcoregraphics_p.h>
+#include <private/qcore_mac_p.h>
+#include <Foundation/Foundation.h>
+#include <private/qfont_p.h>
+#include <private/qfontengine_p.h>
+#endif
+
+static int s_mode;
+static QString s_text = QString::fromUtf8("The quick brown \xF0\x9F\xA6\x8A jumps over the lazy \xF0\x9F\x90\xB6");
+
+class TextRenderer : public QWidget
+{
+ Q_OBJECT
+public:
+ enum RenderingMode { QtRendering, NativeRendering };
+ Q_ENUM(RenderingMode);
+
+ TextRenderer(qreal pointSize, const QString &text, const QColor &textColor = QColor(), const QColor &bgColor = QColor())
+ : m_text(text)
+ {
+ if (pointSize) {
+ QFont f = font();
+ f.setPointSize(pointSize);
+ setFont(f);
+ }
+
+ if (textColor.isValid()) {
+ QPalette p = palette();
+ p.setColor(QPalette::Text, textColor);
+ setPalette(p);
+ }
+
+ if (bgColor.isValid()) {
+ QPalette p = palette();
+ p.setColor(QPalette::Window, bgColor);
+ setPalette(p);
+ }
+ }
+
+ QString text() const
+ {
+ return !m_text.isNull() ? m_text : s_text;
+ }
+
+ QSize sizeHint() const override
+ {
+ QFontMetrics fm = fontMetrics();
+ return QSize(fm.boundingRect(text()).width(), fm.height());
+ }
+
+ bool event(QEvent * event) override
+ {
+ if (event->type() == QEvent::ToolTip) {
+ QString toolTip;
+ QDebug debug(&toolTip);
+ debug << "textColor =" << palette().color(QPalette::Text) << "bgColor =" << palette().color(QPalette::Window);
+ setToolTip(toolTip);
+ }
+
+ return QWidget::event(event);
+ }
+
+ void paintEvent(QPaintEvent *) override
+ {
+ QImage image(size() * devicePixelRatio(), QImage::Format_ARGB32_Premultiplied);
+ image.setDevicePixelRatio(devicePixelRatio());
+
+ QPainter p(&image);
+ p.fillRect(QRect(0, 0, image.width(), image.height()), palette().window().color());
+
+ const int ascent = fontMetrics().ascent();
+
+ QPen metricsPen(QColor(112, 216, 255), 1.0);
+ metricsPen.setCosmetic(true);
+ p.setPen(metricsPen);
+ p.drawLine(QPoint(0, ascent), QPoint(width(), ascent));
+ p.end();
+
+ if (s_mode == QtRendering)
+ renderQtText(image);
+ else
+ renderNativeText(image);
+
+ QPainter wp(this);
+ wp.drawImage(QPoint(0, 0), image);
+ }
+
+ void renderQtText(QImage &image)
+ {
+ QPainter p(&image);
+
+ const int ascent = fontMetrics().ascent();
+
+ p.setPen(palette().text().color());
+
+ QFont f = font();
+ f.resolve(-1);
+ p.setFont(f);
+
+ p.drawText(QPoint(0, ascent), text());
+ }
+
+ void renderNativeText(QImage &image)
+ {
+#ifdef Q_OS_DARWIN
+ QMacAutoReleasePool pool;
+ QMacCGContext ctx(&image);
+
+ const auto *fontEngine = QFontPrivate::get(font())->engineForScript(QChar::Script_Common);
+ Q_ASSERT(fontEngine);
+ if (fontEngine->type() == QFontEngine::Multi) {
+ fontEngine = static_cast<const QFontEngineMulti *>(fontEngine)->engine(0);
+ Q_ASSERT(fontEngine);
+ }
+ Q_ASSERT(fontEngine->type() == QFontEngine::Mac);
+
+ QColor textColor = palette().text().color();
+ auto nsColor = [NSColor colorWithSRGBRed:textColor.redF()
+ green:textColor.greenF()
+ blue:textColor.blueF()
+ alpha:textColor.alphaF()];
+
+ if (font().styleStrategy() & QFont::NoAntialias)
+ CGContextSetShouldAntialias(ctx, false);
+
+ // Flip to what CT expects
+ CGContextScaleCTM(ctx, 1, -1);
+ CGContextTranslateCTM(ctx, 0, -height());
+
+ // Set up baseline
+ CGContextSetTextPosition(ctx, 0, height() - fontMetrics().ascent());
+
+ auto *attributedString = [[NSAttributedString alloc] initWithString:text().toNSString()
+ attributes:@{
+ NSFontAttributeName : (NSFont *)fontEngine->handle(),
+ NSForegroundColorAttributeName : nsColor
+ }
+ ];
+
+ QCFType<CTLineRef> line = CTLineCreateWithAttributedString(CFAttributedStringRef([attributedString autorelease]));
+ CTLineDraw(line, ctx);
+#endif
+ }
+
+public:
+
+ RenderingMode m_mode = QtRendering;
+ QString m_text;
+};
+
+class TestWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ TestWidget()
+ {
+ auto *mainLayout = new QVBoxLayout;
+
+ m_previews = new QWidget;
+ m_previews->setLayout(new QHBoxLayout);
+
+ for (int i = 0; i < 6; ++i) {
+ auto *layout = new QVBoxLayout;
+ QString text;
+ if (i > 0)
+ text = "ABC";
+
+ QPair<QColor, QColor> color = [i] {
+ switch (i) {
+ case 0: return qMakePair(QColor(), QColor());
+ case 1: return qMakePair(QColor(Qt::black), QColor(Qt::white));
+ case 2: return qMakePair(QColor(Qt::white), QColor(Qt::black));
+ case 3: return qMakePair(QColor(Qt::magenta), QColor(Qt::green));
+ case 4: return qMakePair(QColor(0, 0, 0, 128), QColor(Qt::white));
+ case 5: return qMakePair(QColor(255, 255, 255, 128), QColor(Qt::black));
+ default: return qMakePair(QColor(), QColor());
+ }
+ }();
+
+ for (int pointSize : {8, 12, 24, 36, 48})
+ layout->addWidget(new TextRenderer(pointSize, text, color.first, color.second));
+
+ static_cast<QHBoxLayout*>(m_previews->layout())->addLayout(layout);
+ }
+
+ mainLayout->addWidget(m_previews);
+
+ auto *controls = new QHBoxLayout;
+ auto *lineEdit = new QLineEdit(s_text);
+ connect(lineEdit, &QLineEdit::textChanged, [&](const QString &text) {
+ s_text = text;
+ for (TextRenderer *renderer : m_previews->findChildren<TextRenderer *>())
+ renderer->updateGeometry();
+ });
+ controls->addWidget(lineEdit);
+
+ auto *colorButton = new QPushButton("Color...");
+ connect(colorButton, &QPushButton::clicked, [&] {
+ auto *colorDialog = new QColorDialog(this);
+ colorDialog->setOptions(QColorDialog::NoButtons | QColorDialog::ShowAlphaChannel);
+ colorDialog->setModal(false);
+ connect(colorDialog, &QColorDialog::currentColorChanged, [&](const QColor &color) {
+ QPalette p = palette();
+ p.setColor(QPalette::Text, color);
+ setPalette(p);
+ });
+ colorDialog->setCurrentColor(palette().text().color());
+ colorDialog->setVisible(true);
+ });
+ controls->addWidget(colorButton);
+ auto *fontButton = new QPushButton("Font...");
+ connect(fontButton, &QPushButton::clicked, [&] {
+ auto *fontDialog = new QFontDialog(this);
+ fontDialog->setOptions(QFontDialog::NoButtons);
+ fontDialog->setModal(false);
+ fontDialog->setCurrentFont(m_previews->font());
+ connect(fontDialog, &QFontDialog::currentFontChanged, [&](const QFont &font) {
+ m_previews->setFont(font);
+ });
+ fontDialog->setVisible(true);
+ });
+ controls->addWidget(fontButton);
+
+ auto *aaButton = new QCheckBox("NoAntialias");
+ connect(aaButton, &QCheckBox::stateChanged, [&] {
+ for (TextRenderer *renderer : m_previews->findChildren<TextRenderer *>()) {
+ QFont font = renderer->font();
+ font.setStyleStrategy(QFont::StyleStrategy(font.styleStrategy() ^ QFont::NoAntialias));
+ renderer->setFont(font);
+ }
+ });
+ controls->addWidget(aaButton);
+
+ auto *subpixelAAButton = new QCheckBox("NoSubpixelAntialias");
+ connect(subpixelAAButton, &QCheckBox::stateChanged, [&] {
+ for (TextRenderer *renderer : m_previews->findChildren<TextRenderer *>()) {
+ QFont font = renderer->font();
+ font.setStyleStrategy(QFont::StyleStrategy(font.styleStrategy() ^ QFont::NoSubpixelAntialias));
+ renderer->setFont(font);
+ }
+ });
+ controls->addWidget(subpixelAAButton);
+ controls->addStretch();
+
+ mainLayout->addLayout(controls);
+
+ mainLayout->setSizeConstraint(QLayout::SetFixedSize);
+ setLayout(mainLayout);
+
+ setMode(TextRenderer::QtRendering);
+ setFocusPolicy(Qt::StrongFocus);
+ setFocus();
+ }
+
+ void setMode(TextRenderer::RenderingMode mode)
+ {
+ s_mode = mode;
+ setWindowTitle(s_mode == TextRenderer::QtRendering ? "Qt" : "Native");
+
+ for (TextRenderer *renderer : m_previews->findChildren<TextRenderer *>())
+ renderer->update();
+ }
+
+ void mousePressEvent(QMouseEvent *) override
+ {
+ setMode(TextRenderer::RenderingMode(!s_mode));
+ }
+
+ void keyPressEvent(QKeyEvent *e) override
+ {
+ if (e->key() == Qt::Key_Space)
+ setMode(TextRenderer::RenderingMode(!s_mode));
+ }
+
+ QWidget *m_previews;
+};
+
+int main(int argc, char **argv)
+{
+ qputenv("QT_MAX_CACHED_GLYPH_SIZE", "97");
+ QApplication app(argc, argv);
+
+ TestWidget widget;
+ widget.show();
+ return app.exec();
+}
+
+#include "main.moc"
+
diff --git a/tests/manual/textrendering/nativetext/nativetext.pro b/tests/manual/textrendering/nativetext/nativetext.pro
new file mode 100644
index 0000000000..fb3e3799e7
--- /dev/null
+++ b/tests/manual/textrendering/nativetext/nativetext.pro
@@ -0,0 +1,7 @@
+QT += widgets core-private gui-private
+SOURCES += main.cpp
+CONFIG -= app_bundle
+darwin {
+ QMAKE_CXXFLAGS += -x objective-c++
+ LIBS += -framework Foundation -framework CoreGraphics -framework AppKit
+}
diff --git a/tests/manual/textrendering/textrendering.pro b/tests/manual/textrendering/textrendering.pro
index 92f0741bf3..14806e416c 100644
--- a/tests/manual/textrendering/textrendering.pro
+++ b/tests/manual/textrendering/textrendering.pro
@@ -1,4 +1,5 @@
TEMPLATE=subdirs
SUBDIRS = glyphshaping \
- textperformance
+ textperformance \
+ nativetext
diff --git a/tests/manual/widgets/styles/styles.pro b/tests/manual/widgets/styles/styles.pro
index ef8217a9a3..d302ae0691 100644
--- a/tests/manual/widgets/styles/styles.pro
+++ b/tests/manual/widgets/styles/styles.pro
@@ -1,7 +1,6 @@
TEMPLATE = app
QT = widgets
-CONFIG += console
-CONFIG -= app_bundle
+CONFIG += cmdline
CONFIG += c++11
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
diff --git a/tests/manual/widgets/widgets/widgets.pro b/tests/manual/widgets/widgets/widgets.pro
new file mode 100644
index 0000000000..1fccb09d79
--- /dev/null
+++ b/tests/manual/widgets/widgets/widgets.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+SUBDIRS = bigmenucreator \
+ defaultUpMenuBar \
+ multiscreen-menus \
+ qtoolbutton/menuOnMultiScreens