summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/text/qfont/tst_qfont.cpp7
-rw-r--r--tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp49
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp1
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp23
4 files changed, 80 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp
index d722856366..9487436336 100644
--- a/tests/auto/gui/text/qfont/tst_qfont.cpp
+++ b/tests/auto/gui/text/qfont/tst_qfont.cpp
@@ -301,6 +301,13 @@ void tst_QFont::resolve()
font5.setFamilies(fontFamilies);
font6 = font6.resolve(font5);
QCOMPARE(font6.families(), fontFamilies);
+
+ QFont font7, font8;
+ font7.setFamily(QLatin1String("Helvetica"));
+ font8.setFamilies(fontFamilies);
+ font7 = font7.resolve(font8);
+ QCOMPARE(font7.families(), QStringList({"Helvetica", "Arial"}));
+ QCOMPARE(font7.family(), "Helvetica");
}
#ifndef QT_NO_WIDGETS
diff --git a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 4e02320362..e599ebf199 100644
--- a/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -260,6 +260,8 @@ private slots:
void disabledProtocols_data();
void disabledProtocols();
+ void oldErrorsOnSocketReuse();
+
void setEmptyDefaultConfiguration(); // this test should be last
protected slots:
@@ -4387,6 +4389,53 @@ void tst_QSslSocket::disabledProtocols()
}
}
+void tst_QSslSocket::oldErrorsOnSocketReuse()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return; // not relevant
+ SslServer server;
+ server.protocol = QSsl::TlsV1_1;
+ server.m_certFile = testDataDir + "certs/fluke.cert";
+ server.m_keyFile = testDataDir + "certs/fluke.key";
+ QVERIFY(server.listen(QHostAddress::SpecialAddress::LocalHost));
+
+ QSslSocket socket;
+ socket.setProtocol(QSsl::TlsV1_1);
+ QList<QSslError> errorList;
+ auto connection = connect(&socket, QOverload<const QList<QSslError> &>::of(&QSslSocket::sslErrors),
+ [&socket, &errorList](const QList<QSslError> &errors) {
+ errorList += errors;
+ socket.ignoreSslErrors(errors);
+ socket.resume();
+ });
+
+ socket.connectToHostEncrypted(QString::fromLatin1("localhost"), server.serverPort());
+ QVERIFY(QTest::qWaitFor([&socket](){ return socket.isEncrypted(); }));
+ socket.disconnectFromHost();
+ if (socket.state() != QAbstractSocket::UnconnectedState) {
+ QVERIFY(QTest::qWaitFor(
+ [&socket](){
+ return socket.state() == QAbstractSocket::UnconnectedState;
+ }));
+ }
+
+ auto oldList = errorList;
+ errorList.clear();
+ server.close();
+ server.m_certFile = testDataDir + "certs/bogus-client.crt";
+ server.m_keyFile = testDataDir + "certs/bogus-client.key";
+ QVERIFY(server.listen(QHostAddress::SpecialAddress::LocalHost));
+
+ socket.connectToHostEncrypted(QString::fromLatin1("localhost"), server.serverPort());
+ QVERIFY(QTest::qWaitFor([&socket](){ return socket.isEncrypted(); }));
+
+ for (const auto &error : oldList) {
+ QVERIFY2(!errorList.contains(error),
+ "The new errors should not contain any of the old ones");
+ }
+}
+
#endif // QT_NO_SSL
QTEST_MAIN(tst_QSslSocket)
diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
index a5aaf62855..c8e6e8fcd0 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
@@ -225,6 +225,7 @@ void tst_QFontDialog::qtbug_41513_stylesheetStyle()
// The fontdialog sets the styleName, when the fontdatabase knows the style name.
resultFont.setStyleName(testFont.styleName());
+ testFont.setFamilies(QStringList(testFont.family()));
QCOMPARE(resultFont, testFont);
// reset stylesheet
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 40377eb946..882323ba4f 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -401,6 +401,7 @@ private slots:
void tabletTracking();
void closeEvent();
+ void closeWithChildWindow();
private:
bool ensureScreenSize(int width, int height);
@@ -11122,5 +11123,27 @@ void tst_QWidget::closeEvent()
QCOMPARE(widget.closeCount, 1);
}
+void tst_QWidget::closeWithChildWindow()
+{
+ QWidget widget;
+ auto childWidget = new QWidget(&widget);
+ childWidget->setAttribute(Qt::WA_NativeWindow);
+ childWidget->windowHandle()->create();
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ widget.windowHandle()->close();
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ // Check that the child window inside the window is now visible
+ QVERIFY(childWidget->isVisible());
+
+ // Now explicitly hide the childWidget
+ childWidget->hide();
+ widget.windowHandle()->close();
+ widget.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ QVERIFY(!childWidget->isVisible());
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"