summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/android/testdata/top_level_dir/file_in_top_dir.txt1
-rw-r--r--tests/auto/other/android/testdata/top_level_dir/sub_dir/file_in_sub_dir.txt1
-rw-r--r--tests/auto/other/android/testdata/top_level_dir/sub_dir/sub_dir2/sub_dir3/file_in_sub_dir_3.txt1
-rw-r--r--tests/auto/other/android/tst_android.cpp21
-rw-r--r--tests/auto/other/gestures/BLACKLIST28
-rw-r--r--tests/auto/other/lancelot/paintcommands.cpp25
-rw-r--r--tests/auto/other/lancelot/paintcommands.h1
-rw-r--r--tests/auto/other/lancelot/scripts/cosmetic.qps55
-rw-r--r--tests/auto/other/lancelot/scripts/linedashes2.qps48
-rw-r--r--tests/auto/other/lancelot/scripts/tinydashes.qps34
-rw-r--r--tests/auto/other/lancelot/tst_lancelot.cpp49
-rw-r--r--tests/auto/other/networkselftest/BLACKLIST3
-rw-r--r--tests/auto/other/networkselftest/networkselftest.pro3
-rw-r--r--tests/auto/other/networkselftest/tst_networkselftest.cpp236
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp119
-rw-r--r--tests/auto/other/qaccessibilitymac/BLACKLIST4
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp2
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h3
-rw-r--r--tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm26
19 files changed, 542 insertions, 118 deletions
diff --git a/tests/auto/other/android/testdata/top_level_dir/file_in_top_dir.txt b/tests/auto/other/android/testdata/top_level_dir/file_in_top_dir.txt
new file mode 100644
index 0000000000..87b10bd8e6
--- /dev/null
+++ b/tests/auto/other/android/testdata/top_level_dir/file_in_top_dir.txt
@@ -0,0 +1 @@
+FooBar
diff --git a/tests/auto/other/android/testdata/top_level_dir/sub_dir/file_in_sub_dir.txt b/tests/auto/other/android/testdata/top_level_dir/sub_dir/file_in_sub_dir.txt
new file mode 100644
index 0000000000..87b10bd8e6
--- /dev/null
+++ b/tests/auto/other/android/testdata/top_level_dir/sub_dir/file_in_sub_dir.txt
@@ -0,0 +1 @@
+FooBar
diff --git a/tests/auto/other/android/testdata/top_level_dir/sub_dir/sub_dir2/sub_dir3/file_in_sub_dir_3.txt b/tests/auto/other/android/testdata/top_level_dir/sub_dir/sub_dir2/sub_dir3/file_in_sub_dir_3.txt
new file mode 100644
index 0000000000..87b10bd8e6
--- /dev/null
+++ b/tests/auto/other/android/testdata/top_level_dir/sub_dir/sub_dir2/sub_dir3/file_in_sub_dir_3.txt
@@ -0,0 +1 @@
+FooBar
diff --git a/tests/auto/other/android/tst_android.cpp b/tests/auto/other/android/tst_android.cpp
index 57d592d45f..389d465427 100644
--- a/tests/auto/other/android/tst_android.cpp
+++ b/tests/auto/other/android/tst_android.cpp
@@ -27,6 +27,7 @@
****************************************************************************/
#include <QtTest/QtTest>
+#include <QtCore/qdiriterator.h>
class tst_Android : public QObject
{
@@ -34,6 +35,7 @@ Q_OBJECT
private slots:
void assetsRead();
void assetsNotWritable();
+ void assetsIterating();
};
void tst_Android::assetsRead()
@@ -59,6 +61,25 @@ void tst_Android::assetsNotWritable()
QVERIFY(!file.open(QIODevice::Append));
}
+void tst_Android::assetsIterating()
+{
+ QStringList assets = {"assets:/top_level_dir/file_in_top_dir.txt",
+ "assets:/top_level_dir/sub_dir",
+ "assets:/top_level_dir/sub_dir/file_in_sub_dir.txt",
+ "assets:/top_level_dir/sub_dir/sub_dir_2",
+ "assets:/top_level_dir/sub_dir/sub_dir_2/sub_dir_3",
+ "assets:/top_level_dir/sub_dir/sub_dir_2/sub_dir_3/file_in_sub_dir_3.txt"};
+ // Note that we have an "assets:/top_level_dir/sub_dir/empty_sub_dir" in the test's
+ // assets physical directory, but empty folders are not packaged in the built apk,
+ // so it's expected to not have such folder be listed in the assets on runtime
+ QDirIterator it("assets:/top_level_dir", QDirIterator::Subdirectories);
+ QStringList iteratorAssets;
+ while (it.hasNext())
+ iteratorAssets.append(it.next());
+ QVERIFY(assets == iteratorAssets);
+}
+
+
QTEST_MAIN(tst_Android)
#include "tst_android.moc"
diff --git a/tests/auto/other/gestures/BLACKLIST b/tests/auto/other/gestures/BLACKLIST
index 2af5d40359..1de0e369a9 100644
--- a/tests/auto/other/gestures/BLACKLIST
+++ b/tests/auto/other/gestures/BLACKLIST
@@ -2,26 +2,54 @@
rhel-7.4
rhel-7.6
ubuntu-18.04
+sles-15
+sles-15.4
+rhel-8.4
[customGesture]
opensuse-leap
# QTBUG-67254
opensuse-42.3
[graphicsItemGesture]
+# QTBUG-103054
+ubuntu-20
ubuntu-18.04
rhel-7.4
rhel-7.6
+sles-15
+sles-15.4
+rhel-8.4
[graphicsItemTreeGesture]
+# QTBUG-103054
+ubuntu-20
ubuntu-18.04
[graphicsView]
+# QTBUG-103054
+ubuntu-20
ubuntu-18.04
rhel-7.4
rhel-7.6
+sles-15
+sles-15.4
+rhel-8.4
[explicitGraphicsObjectTarget]
+# QTBUG-103054
+ubuntu-20
ubuntu-18.04
rhel-7.4
rhel-7.6
+sles-15
+sles-15.4
+rhel-8.4
[autoCancelGestures2]
+# QTBUG-103054
+ubuntu-20
ubuntu-18.04
rhel-7.4
rhel-7.6
+sles-15
+sles-15.4
+rhel-8.4
+#QTBUG-103054
+[testReuseCanceledGestures]
+ubuntu-20 \ No newline at end of file
diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp
index e98df3781e..0dab5376a0 100644
--- a/tests/auto/other/lancelot/paintcommands.cpp
+++ b/tests/auto/other/lancelot/paintcommands.cpp
@@ -376,6 +376,10 @@ void PaintCommands::staticInit()
"^drawLine\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$",
"drawLine <x1> <y1> <x2> <y2>",
"drawLine 10.0 10.0 20.0 20.0");
+ DECL_PAINTCOMMAND("drawLines", command_drawLines,
+ "^drawLines\\s+\\[([\\w\\s\\-.]*)\\]$",
+ "drawLines <[ <l1x1> <l1y1> <l1x2> <l1y2> <l2x1> <l2y1> ... ]>",
+ "drawLines [ 10 10 50 10 50 20 10 20 ]");
DECL_PAINTCOMMAND("drawRect", command_drawRect,
"^drawRect\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$",
"drawRect <x> <y> <w> <h>",
@@ -433,7 +437,7 @@ void PaintCommands::staticInit()
"drawConvexPolygon <[ <x1> <y1> ... <xn> <yn> ]>",
"drawConvexPolygon [ 1 4 6 8 5 3 ]");
DECL_PAINTCOMMAND("drawPolyline", command_drawPolyline,
- "^drawPolyline\\s+\\[([\\w\\s]*)\\]$",
+ "^drawPolyline\\s+\\[([\\w\\s\\-.]*)\\]$",
"drawPolyline <[ <x1> <y1> ... <xn> <yn> ]>",
"drawPolyline [ 1 4 6 8 5 3 ]");
DECL_PAINTCOMMAND("drawText", command_drawText,
@@ -975,6 +979,25 @@ void PaintCommands::command_drawLine(QRegularExpressionMatch re)
}
/***************************************************************************************************/
+void PaintCommands::command_drawLines(QRegularExpressionMatch re)
+{
+ static QRegularExpression separators("\\s");
+ QStringList numbers = re.captured(1).split(separators, Qt::SkipEmptyParts);
+
+ QVector<QLineF> array;
+ for (int i = 0; i + 3 < numbers.size(); i += 4) {
+ QPointF pt1(numbers.at(i).toFloat(), numbers.at(i + 1).toFloat());
+ QPointF pt2(numbers.at(i + 2).toFloat(), numbers.at(i + 3).toFloat());
+ array.append(QLineF(pt1, pt2));
+ }
+
+ if (m_verboseMode)
+ printf(" -(lance) drawLines(size=%zd)\n", size_t(array.size()));
+
+ m_painter->drawLines(array);
+}
+
+/***************************************************************************************************/
void PaintCommands::command_drawPath(QRegularExpressionMatch re)
{
if (m_verboseMode)
diff --git a/tests/auto/other/lancelot/paintcommands.h b/tests/auto/other/lancelot/paintcommands.h
index 816ecd6fa2..4a1a89556d 100644
--- a/tests/auto/other/lancelot/paintcommands.h
+++ b/tests/auto/other/lancelot/paintcommands.h
@@ -187,6 +187,7 @@ private:
void command_drawEllipse(QRegularExpressionMatch re);
void command_drawImage(QRegularExpressionMatch re);
void command_drawLine(QRegularExpressionMatch re);
+ void command_drawLines(QRegularExpressionMatch re);
void command_drawPath(QRegularExpressionMatch re);
void command_drawPie(QRegularExpressionMatch re);
void command_drawPixmap(QRegularExpressionMatch re);
diff --git a/tests/auto/other/lancelot/scripts/cosmetic.qps b/tests/auto/other/lancelot/scripts/cosmetic.qps
new file mode 100644
index 0000000000..3c730cf26f
--- /dev/null
+++ b/tests/auto/other/lancelot/scripts/cosmetic.qps
@@ -0,0 +1,55 @@
+drawRect 0 0 800 800
+
+setRenderHint Antialiasing true
+image_load dome_argb32.png img
+
+save
+setBrush springgreen SolidPattern
+
+begin_block primitives
+
+setPen black 2 DashLine
+pen_setCosmetic true
+drawLine 10 60 60 10
+drawRect 80 10.0 30 50
+drawText 130 50 "Foo"
+drawImage img 160 10 50 50
+
+pen_setCosmetic false
+drawLine 10 160 60 110
+drawRect 80 110.0 30 50
+drawText 130 150 "Foo"
+drawImage img 160 110 50 50
+
+setPen NoPen
+drawLine 10 260 60 210
+drawRect 80 210.0 30 50
+drawText 130 250 "Foo"
+drawImage img 160 210 50 50
+
+end_block primitives
+
+
+translate 250 0
+rotate 10
+scale 2.5 1
+repeat_block primitives
+
+resetMatrix
+# Force non-simple pen in Pdf
+setOpacity 0.5
+translate 0 400
+repeat_block primitives
+
+translate 250 0
+rotate 10
+scale 2.5 1
+repeat_block primitives
+
+restore
+setPen blue 4 DotLine
+setBrush olive SolidPattern
+pen_setCosmetic true
+translate 50 720
+scale 2 2
+drawRect 0 0 30 30
diff --git a/tests/auto/other/lancelot/scripts/linedashes2.qps b/tests/auto/other/lancelot/scripts/linedashes2.qps
index 1dc4fd310e..b9a4cb9566 100644
--- a/tests/auto/other/lancelot/scripts/linedashes2.qps
+++ b/tests/auto/other/lancelot/scripts/linedashes2.qps
@@ -111,8 +111,9 @@ translate 0 780
repeat_block vertical
resetMatrix
-translate 40 400
-setPen 0xffff0000 5 dashdotline flatcap
+translate 20 380
+setPen 0xffff00ff 5 dashdotline flatcap
+begin_block offset
pen_setDashPattern [1 1 4 1 1 4]
pen_setDashOffset -4
drawLine 0 0 300 0
@@ -146,9 +147,50 @@ drawLine 0 0 300 0
translate 0 8
pen_setDashOffset 16
drawLine 0 0 300 0
+end_block offset
+
+resetMatrix
+translate 420 380
+setPen 0xffff00ff 5 dashdotline roundcap
+repeat_block offset
resetMatrix
setPen black 3 dashdotline
pen_setCosmetic true
translate 0 -150
-drawLine 500 160 500 410 \ No newline at end of file
+drawLine 500 160 500 410
+
+resetMatrix
+translate 300 480
+setPen blue 0
+
+begin_block clip_lines
+pen_setDashPattern [ 20 4 5 4 1 4 ]
+pen_setDashOffset 26.0
+drawLines [0 0 1000000 10 1000000 10 -1000000 20 -1000000 20 0 30]
+end_block clip_lines
+
+translate 0 45
+setPen blue 5
+repeat_block clip_lines
+
+translate 0 45
+setPen blue 5 SolidLine RoundCap
+repeat_block clip_lines
+
+translate 0 45
+setPen green 0
+
+begin_block clip_poly
+pen_setDashPattern [ 20 4 5 4 1 4 ]
+pen_setDashOffset 26.0
+drawPolyline [0 0 1000000 10 -1000000 20 0 30]
+end_block clip_poly
+
+translate 0 45
+setPen green 5
+repeat_block clip_poly
+
+translate 0 45
+setPen green 5 SolidLine RoundCap
+repeat_block clip_poly
diff --git a/tests/auto/other/lancelot/scripts/tinydashes.qps b/tests/auto/other/lancelot/scripts/tinydashes.qps
new file mode 100644
index 0000000000..d41ced7f5f
--- /dev/null
+++ b/tests/auto/other/lancelot/scripts/tinydashes.qps
@@ -0,0 +1,34 @@
+# Version: 1
+# CheckVsReference: 5%
+
+path_addEllipse mypath 20.0 20.0 200.0 200.0
+
+save
+setPen blue 20 SolidLine FlatCap
+pen_setCosmetic true
+pen_setDashPattern [ 0.0004 0.0004 ]
+setBrush yellow
+
+drawPath mypath
+translate 300 0
+setRenderHint Antialiasing true
+drawPath mypath
+restore
+
+path_addEllipse bigpath 200000.0 200000.0 2000000.0 2000000.0
+
+setPen blue 20 DotLine FlatCap
+setBrush yellow
+
+save
+translate 0 300
+scale 0.0001 0.00011
+drawPath bigpath
+restore
+
+save
+translate 300 300
+setRenderHint Antialiasing true
+scale 0.0001 0.00011
+drawPath bigpath
+restore
diff --git a/tests/auto/other/lancelot/tst_lancelot.cpp b/tests/auto/other/lancelot/tst_lancelot.cpp
index 7c0d809c01..516cf09f2f 100644
--- a/tests/auto/other/lancelot/tst_lancelot.cpp
+++ b/tests/auto/other/lancelot/tst_lancelot.cpp
@@ -30,6 +30,9 @@
#include <qbaselinetest.h>
#include <QDir>
#include <QPainter>
+#include <QPdfWriter>
+#include <QTemporaryFile>
+#include <QProcess>
#ifndef QT_NO_OPENGL
#include <QOpenGLFramebufferObjectFormat>
@@ -53,7 +56,8 @@ public:
private:
enum GraphicsEngine {
Raster = 0,
- OpenGL = 1
+ OpenGL = 1,
+ Pdf = 2
};
void setupTestSuite(const QStringList& blacklist = QStringList());
@@ -88,6 +92,9 @@ private slots:
void testRasterRGBA64PM_data();
void testRasterRGBA64PM();
+ void testPdf_data();
+ void testPdf();
+
#ifndef QT_NO_OPENGL
void testOpenGL_data();
void testOpenGL();
@@ -239,6 +246,21 @@ void tst_Lancelot::testRasterRGBA64PM()
}
+void tst_Lancelot::testPdf_data()
+{
+#ifdef Q_OS_MACOS
+ setupTestSuite();
+#else
+ QSKIP("Pdf testing only implemented for macOS");
+#endif
+}
+
+void tst_Lancelot::testPdf()
+{
+ runTestSuite(Pdf, QImage::Format_RGB32);
+}
+
+
#ifndef QT_NO_OPENGL
bool tst_Lancelot::checkSystemGLSupport()
{
@@ -370,6 +392,28 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format, co
paint(&pdv, engine, format, script, QFileInfo(filePath).absoluteFilePath());
rendered = fbo.toImage().convertToFormat(format);
#endif
+ } else if (engine == Pdf) {
+ QString tempStem(QDir::tempPath() + QLatin1String("/lancelot_XXXXXX_") + qpsFile.chopped(4));
+
+ QTemporaryFile pdfFile(tempStem + QLatin1String(".pdf"));
+ pdfFile.open();
+ QPdfWriter writer(&pdfFile);
+ writer.setPdfVersion(QPdfWriter::PdfVersion_1_6);
+ writer.setResolution(150);
+ paint(&writer, engine, format, script, QFileInfo(filePath).absoluteFilePath());
+ pdfFile.close();
+
+ // Convert pdf to something we can read into a QImage, using macOS' sips utility
+ QTemporaryFile pngFile(tempStem + QLatin1String(".png"));
+ pngFile.open(); // Just create the file name
+ pngFile.close();
+ QProcess proc;
+ const char *rawArgs = "-s format png --cropOffset 20 20 -c 800 800 -o";
+ QStringList argList = QString::fromLatin1(rawArgs).split(QLatin1Char(' '));
+ proc.start(QLatin1String("sips"), argList << pngFile.fileName() << pdfFile.fileName());
+ proc.waitForFinished(2 * 60 * 1000); // May need some time
+
+ rendered = QImage(pngFile.fileName());
}
QBASELINE_TEST(rendered);
@@ -384,6 +428,9 @@ void tst_Lancelot::paint(QPaintDevice *device, GraphicsEngine engine, QImage::Fo
case OpenGL:
pcmd.setType(OpenGLBufferType); // version/profile is communicated through the context's format()
break;
+ case Pdf:
+ pcmd.setType(PdfType);
+ break;
case Raster: // fallthrough
default:
pcmd.setType(ImageType);
diff --git a/tests/auto/other/networkselftest/BLACKLIST b/tests/auto/other/networkselftest/BLACKLIST
index 55ebad985d..8b59f391f3 100644
--- a/tests/auto/other/networkselftest/BLACKLIST
+++ b/tests/auto/other/networkselftest/BLACKLIST
@@ -2,4 +2,5 @@
[ftpProxyServer]
windows-7sp1
windows-10
-
+[smbServer]
+opensuse-leap-15.4 # QTBUG-89209
diff --git a/tests/auto/other/networkselftest/networkselftest.pro b/tests/auto/other/networkselftest/networkselftest.pro
index 7c307a097b..ea81b10f8c 100644
--- a/tests/auto/other/networkselftest/networkselftest.pro
+++ b/tests/auto/other/networkselftest/networkselftest.pro
@@ -3,3 +3,6 @@ TARGET = tst_networkselftest
SOURCES += tst_networkselftest.cpp
QT = core core-private network testlib
+
+CONFIG += unsupported/testserver
+QT_TEST_SERVER_LIST = cyrus vsftpd apache2 ftp-proxy danted squid echo
diff --git a/tests/auto/other/networkselftest/tst_networkselftest.cpp b/tests/auto/other/networkselftest/tst_networkselftest.cpp
index 396e23da0c..b875c7c5cf 100644
--- a/tests/auto/other/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/other/networkselftest/tst_networkselftest.cpp
@@ -35,18 +35,16 @@
#include <QtCore/QStandardPaths>
#include <QtCore/private/qiodevice_p.h>
-#ifndef QT_NO_BEARERMANAGEMENT
-#include <QtNetwork/qnetworkconfigmanager.h>
-#include <QtNetwork/qnetworkconfiguration.h>
-#include <QtNetwork/qnetworksession.h>
-#endif
-
#include "../../network-settings.h"
class tst_NetworkSelfTest: public QObject
{
Q_OBJECT
+ // This is either old server's address, or the new http
+ // server's address (different from ftp, for example):
QHostAddress cachedIpAddress;
+ // This is only for the new docker test server:
+ QHostAddress ftpServerIpAddress;
public:
tst_NetworkSelfTest();
virtual ~tst_NetworkSelfTest();
@@ -83,12 +81,6 @@ private slots:
// ssl supported test
void supportsSsl();
-private:
-#ifndef QT_NO_BEARERMANAGEMENT
- QNetworkConfigurationManager *netConfMan;
- QNetworkConfiguration networkConfiguration;
- QScopedPointer<QNetworkSession> networkSession;
-#endif
};
class Chat
@@ -223,8 +215,8 @@ static void netChat(int port, const QList<Chat> &chat)
#else
QTcpSocket socket;
#endif
-
- socket.connectToHost(QtNetworkSettings::serverName(), port);
+ const auto serverName = QtNetworkSettings::hostWithServiceOnPort(port);
+ socket.connectToHost(serverName, port);
qDebug() << 0 << "Connecting to server on port" << port;
QVERIFY2(socket.waitForConnected(10000),
QString("Failed to connect to server in step 0: %1").arg(socket.errorString()).toLocal8Bit());
@@ -236,7 +228,7 @@ static void netChat(int port, const QList<Chat> &chat)
case Chat::Expect: {
qDebug() << i << "Expecting" << prettyByteArray(it->data);
if (!doSocketRead(&socket, it->data.length(), 3 * defaultReadTimeoutMS))
- QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->data.length()));
+ QFAIL(msgDoSocketReadFailed(serverName, port, i, it->data.length()));
// pop that many bytes off the socket
QByteArray received = socket.read(it->data.length());
@@ -254,7 +246,7 @@ static void netChat(int port, const QList<Chat> &chat)
while (true) {
// scan the buffer until we have our string
if (!doSocketRead(&socket, it->data.length()))
- QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->data.length()));
+ QFAIL(msgDoSocketReadFailed(serverName, port, i, it->data.length()));
QByteArray buffer;
buffer.resize(socket.bytesAvailable());
@@ -275,7 +267,7 @@ static void netChat(int port, const QList<Chat> &chat)
case Chat::SkipBytes: {
qDebug() << i << "Skipping" << it->value << "bytes";
if (!doSocketRead(&socket, it->value))
- QFAIL(msgDoSocketReadFailed(QtNetworkSettings::serverName(), port, i, it->value));
+ QFAIL(msgDoSocketReadFailed(serverName, port, i, it->value));
// now discard the bytes
QByteArray buffer = socket.read(it->value);
@@ -324,7 +316,7 @@ static void netChat(int port, const QList<Chat> &chat)
case Chat::Reconnect:
qDebug() << i << "Reconnecting to server on port" << port;
- socket.connectToHost(QtNetworkSettings::serverName(), port);
+ socket.connectToHost(serverName, port);
QVERIFY2(socket.waitForConnected(10000),
QString("Failed to reconnect to server in step %1: %2").arg(i).arg(socket.errorString()).toLocal8Bit());
break;
@@ -357,7 +349,7 @@ QHostAddress tst_NetworkSelfTest::serverIpAddress()
{
if (cachedIpAddress.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol) {
// need resolving
- QHostInfo resolved = QHostInfo::fromName(QtNetworkSettings::serverName());
+ QHostInfo resolved = QHostInfo::fromName(QtNetworkSettings::httpServerName());
if(resolved.error() != QHostInfo::NoError ||
resolved.addresses().isEmpty()) {
qWarning("QHostInfo::fromName failed (%d).", resolved.error());
@@ -370,16 +362,27 @@ QHostAddress tst_NetworkSelfTest::serverIpAddress()
void tst_NetworkSelfTest::initTestCase()
{
+#if defined(QT_TEST_SERVER)
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::echoServerName(), 7));
+ // TODO: 'daytime' , port 13.
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpServerName(), 21));
+ const QHostInfo resolved = QHostInfo::fromName(QtNetworkSettings::ftpServerName());
+ if (resolved.error() == QHostInfo::NoError && !resolved.addresses().isEmpty())
+ ftpServerIpAddress = resolved.addresses().first();
+ // TODO: 'ssh', port 22.
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::ftpProxyServerName(), 2121));
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 80));
+ // TODO: 'smb', port 139.
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::imapServerName(), 143));
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpServerName(), 443));
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3128));
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3129));
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::httpProxyServerName(), 3130));
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1080));
+ QVERIFY(QtNetworkSettings::verifyConnection(QtNetworkSettings::socksProxyServerName(), 1081));
+#else
if (!QtNetworkSettings::verifyTestNetworkSettings())
QSKIP("No network test server available");
-#ifndef QT_NO_BEARERMANAGEMENT
- netConfMan = new QNetworkConfigurationManager(this);
- networkConfiguration = netConfMan->defaultConfiguration();
- networkSession.reset(new QNetworkSession(networkConfiguration));
- if (!networkSession->isOpen()) {
- networkSession->open();
- QVERIFY(networkSession->waitForOpened(30000));
- }
#endif
}
@@ -402,7 +405,7 @@ void tst_NetworkSelfTest::dnsResolution_data()
{
QTest::addColumn<QString>("hostName");
QTest::newRow("local-name") << QtNetworkSettings::serverLocalName();
- QTest::newRow("fqdn") << QtNetworkSettings::serverName();
+ QTest::newRow("fqdn") << QtNetworkSettings::httpServerName();
}
void tst_NetworkSelfTest::dnsResolution()
@@ -420,7 +423,7 @@ void tst_NetworkSelfTest::serverReachability()
{
// check that we get a proper error connecting to port 12346
QTcpSocket socket;
- socket.connectToHost(QtNetworkSettings::serverName(), 12346);
+ socket.connectToHost(QtNetworkSettings::httpServerName(), 12346);
QElapsedTimer timer;
timer.start();
@@ -434,7 +437,11 @@ void tst_NetworkSelfTest::serverReachability()
void tst_NetworkSelfTest::remotePortsOpen_data()
{
+#if defined(QT_TEST_SERVER)
+ QSKIP("Skipping, for the docker test server already tested by initTestCase()");
+#endif
QTest::addColumn<int>("portNumber");
+
QTest::newRow("echo") << 7;
QTest::newRow("daytime") << 13;
QTest::newRow("ftp") << 21;
@@ -453,9 +460,10 @@ void tst_NetworkSelfTest::remotePortsOpen_data()
void tst_NetworkSelfTest::remotePortsOpen()
{
- QFETCH(int, portNumber);
+ QFETCH(const int, portNumber);
+
QTcpSocket socket;
- socket.connectToHost(QtNetworkSettings::serverName(), portNumber);
+ socket.connectToHost(QtNetworkSettings::hostWithServiceOnPort(portNumber), quint16(portNumber));
if (!socket.waitForConnected(10000)) {
if (socket.error() == QAbstractSocket::SocketTimeoutError)
@@ -470,43 +478,43 @@ static QList<Chat> ftpChat(const QByteArray &userSuffix = QByteArray())
{
QList<Chat> rv;
rv << Chat::expect("220")
- << Chat::discardUntil("\r\n")
- << Chat::send("USER anonymous" + userSuffix + "\r\n")
- << Chat::expect("331")
- << Chat::discardUntil("\r\n")
- << Chat::send("PASS user@hostname\r\n")
- << Chat::expect("230")
- << Chat::discardUntil("\r\n")
-
- << Chat::send("CWD pub\r\n")
- << Chat::expect("250")
- << Chat::discardUntil("\r\n")
- << Chat::send("CWD dir-not-readable\r\n")
- << Chat::expect("550")
- << Chat::discardUntil("\r\n")
- << Chat::send("PWD\r\n")
- << Chat::expect("257 \"/pub\"\r\n")
- << Chat::send("SIZE file-not-readable.txt\r\n")
- << Chat::expect("213 41\r\n")
- << Chat::send("CWD qxmlquery\r\n")
- << Chat::expect("250")
- << Chat::discardUntil("\r\n")
-
- << Chat::send("CWD /qtest\r\n")
- << Chat::expect("250")
- << Chat::discardUntil("\r\n")
- << Chat::send("SIZE bigfile\r\n")
- << Chat::expect("213 519240\r\n")
- << Chat::send("SIZE rfc3252\r\n")
- << Chat::expect("213 25962\r\n")
- << Chat::send("SIZE rfc3252.txt\r\n")
- << Chat::expect("213 25962\r\n")
-// << Chat::send("SIZE nonASCII/german_\344\366\374\304\326\334\337\r\n")
-// << Chat::expect("213 40\r\n")
-
- << Chat::send("QUIT\r\n");
- rv << Chat::expect("221")
- << Chat::discardUntil("\r\n");
+ << Chat::discardUntil("\r\n")
+ << Chat::send("USER anonymous" + userSuffix + "\r\n")
+ << Chat::expect("331")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("PASS user@hostname\r\n")
+ << Chat::expect("230")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("CWD pub\r\n")
+ << Chat::expect("250")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("CWD dir-not-readable\r\n")
+ << Chat::expect("550")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("PWD\r\n")
+#if defined(QT_TEST_SERVER)
+ << Chat::expect("257 \"/pub\" is the current directory\r\n")
+#else
+ << Chat::expect("257 \"/pub\"\r\n")
+#endif
+ << Chat::send("SIZE file-not-readable.txt\r\n")
+ << Chat::expect("213 41\r\n")
+ << Chat::send("CWD qxmlquery\r\n")
+ << Chat::expect("250")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("CWD /qtest\r\n")
+ << Chat::expect("250")
+ << Chat::discardUntil("\r\n")
+ << Chat::send("SIZE bigfile\r\n")
+ << Chat::expect("213 519240\r\n")
+ << Chat::send("SIZE rfc3252\r\n")
+ << Chat::expect("213 25962\r\n")
+ << Chat::send("SIZE rfc3252.txt\r\n")
+ << Chat::expect("213 25962\r\n")
+ << Chat::send("QUIT\r\n");
+
+ rv << Chat::expect("221")
+ << Chat::discardUntil("\r\n");
rv << Chat::RemoteDisconnect;
return rv;
@@ -519,7 +527,7 @@ void tst_NetworkSelfTest::ftpServer()
void tst_NetworkSelfTest::ftpProxyServer()
{
- netChat(2121, ftpChat("@" + QtNetworkSettings::serverName().toLatin1()));
+ netChat(2121, ftpChat("@" + QtNetworkSettings::ftpServerName().toLatin1()));
}
void tst_NetworkSelfTest::imapServer()
@@ -551,7 +559,7 @@ void tst_NetworkSelfTest::httpServer()
// HTTP/1.0 chat:
<< Chat::Reconnect
<< Chat::send("GET / HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -563,7 +571,7 @@ void tst_NetworkSelfTest::httpServer()
<< Chat::Reconnect
<< Chat::send("POST / HTTP/1.0\r\n"
"Content-Length: 5\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"\r\n"
"Hello")
@@ -575,7 +583,7 @@ void tst_NetworkSelfTest::httpServer()
// HTTP protected area
<< Chat::Reconnect
<< Chat::send("GET /qtest/protected/rfc3252.txt HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -585,7 +593,7 @@ void tst_NetworkSelfTest::httpServer()
<< Chat::Reconnect
<< Chat::send("HEAD /qtest/protected/rfc3252.txt HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"Authorization: Basic cXNvY2tzdGVzdDpwYXNzd29yZA==\r\n"
"\r\n")
@@ -597,7 +605,7 @@ void tst_NetworkSelfTest::httpServer()
// DAV area
<< Chat::Reconnect
<< Chat::send("HEAD /dav/ HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -609,7 +617,7 @@ void tst_NetworkSelfTest::httpServer()
<< Chat::Reconnect
<< Chat::send("PUT /dav/networkselftest-" + uniqueExtension + ".txt HTTP/1.0\r\n"
"Content-Length: 5\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"\r\n"
"Hello")
@@ -621,7 +629,7 @@ void tst_NetworkSelfTest::httpServer()
// check that the file did get uploaded
<< Chat::Reconnect
<< Chat::send("HEAD /dav/networkselftest-" + uniqueExtension + ".txt HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -633,7 +641,7 @@ void tst_NetworkSelfTest::httpServer()
// HTTP/1.0 DELETE
<< Chat::Reconnect
<< Chat::send("DELETE /dav/networkselftest-" + uniqueExtension + ".txt HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -668,7 +676,7 @@ void tst_NetworkSelfTest::httpServerFiles()
QList<Chat> chat;
chat << Chat::send("HEAD " + url.toEncoded() + " HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"Authorization: Basic cXNvY2tzdGVzdDpwYXNzd29yZA==\r\n"
"\r\n")
@@ -757,7 +765,7 @@ void tst_NetworkSelfTest::httpsServer()
netChat(443, QList<Chat>()
<< Chat::StartEncryption
<< Chat::send("GET / HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -772,7 +780,7 @@ void tst_NetworkSelfTest::httpProxy()
netChat(3128, QList<Chat>()
// proxy GET by IP
<< Chat::send("GET http://" + serverIpAddress().toString().toLatin1() + "/ HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Proxy-connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -782,8 +790,8 @@ void tst_NetworkSelfTest::httpProxy()
// proxy GET by hostname
<< Chat::Reconnect
- << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ << Chat::send("GET http://" + QtNetworkSettings::httpServerName().toLatin1() + "/ HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Proxy-connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -793,8 +801,13 @@ void tst_NetworkSelfTest::httpProxy()
// proxy CONNECT by IP
<< Chat::Reconnect
+#if !defined(QT_TEST_SERVER)
<< Chat::send("CONNECT " + serverIpAddress().toString().toLatin1() + ":21 HTTP/1.0\r\n"
"\r\n")
+#else
+ << Chat::send("CONNECT " + ftpServerIpAddress.toString().toLatin1() + ":21 HTTP/1.0\r\n"
+ "\r\n")
+#endif
<< Chat::expect("HTTP/1.")
<< Chat::discardUntil(" ")
<< Chat::expect("200 ")
@@ -803,7 +816,7 @@ void tst_NetworkSelfTest::httpProxy()
// proxy CONNECT by hostname
<< Chat::Reconnect
- << Chat::send("CONNECT " + QtNetworkSettings::serverName().toLatin1() + ":21 HTTP/1.0\r\n"
+ << Chat::send("CONNECT " + QtNetworkSettings::ftpServerName().toLatin1() + ":21 HTTP/1.0\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
<< Chat::discardUntil(" ")
@@ -817,8 +830,8 @@ void tst_NetworkSelfTest::httpProxyBasicAuth()
{
netChat(3129, QList<Chat>()
// test auth required response
- << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ << Chat::send("GET http://" + QtNetworkSettings::httpServerName().toLatin1() + "/ HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Proxy-connection: close\r\n"
"\r\n")
<< Chat::expect("HTTP/1.")
@@ -829,8 +842,8 @@ void tst_NetworkSelfTest::httpProxyBasicAuth()
// now try sending our credentials
<< Chat::Reconnect
- << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ << Chat::send("GET http://" + QtNetworkSettings::httpServerName().toLatin1() + "/ HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
"Proxy-connection: close\r\n"
"Proxy-Authorization: Basic cXNvY2tzdGVzdDpwYXNzd29yZA==\r\n"
"\r\n")
@@ -844,9 +857,13 @@ void tst_NetworkSelfTest::httpProxyNtlmAuth()
{
netChat(3130, QList<Chat>()
// test auth required response
- << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n"
- "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n"
+ << Chat::send("GET http://" + QtNetworkSettings::httpServerName().toLatin1() + "/ HTTP/1.0\r\n"
+ "Host: " + QtNetworkSettings::httpServerName().toLatin1() + "\r\n"
+#if !defined(QT_TEST_SERVER)
"Proxy-connection: keep-alive\r\n" // NTLM auth will disconnect
+#else
+ "Proxy-connection: close\r\n" // Well, what do you know? It keeps it alive!
+#endif
"\r\n")
<< Chat::expect("HTTP/1.")
<< Chat::discardUntil(" ")
@@ -877,8 +894,12 @@ void tst_NetworkSelfTest::socks5Proxy()
char buf[4];
quint32 data;
} ip4Address;
- ip4Address.data = qToBigEndian(serverIpAddress().toIPv4Address());
-
+ ip4Address.data =
+#if !defined(QT_TEST_SERVER)
+ qToBigEndian(serverIpAddress().toIPv4Address());
+#else
+ qToBigEndian(ftpServerIpAddress.toIPv4Address());
+#endif
const QByteArray handshakeNoAuthData = QByteArray(handshakeNoAuth, int(sizeof handshakeNoAuth) - 1);
const QByteArray handshakeOkNoAuthData = QByteArray(handshakeOkNoAuth, int(sizeof handshakeOkNoAuth) - 1);
const QByteArray connect1Data = QByteArray(connect1, int(sizeof connect1) - 1);
@@ -887,6 +908,10 @@ void tst_NetworkSelfTest::socks5Proxy()
netChat(1080, QList<Chat>()
// IP address connection
+#if !defined(QT_TEST_SERVER)
+ // This test relies on the proxy and ftp servers
+ // running on the same machine, which is not the
+ // case for the docker test server.
<< Chat::send(handshakeNoAuthData)
<< Chat::expect(handshakeOkNoAuthData)
<< Chat::send(connect1Data)
@@ -897,6 +922,7 @@ void tst_NetworkSelfTest::socks5Proxy()
// connect by IP
<< Chat::Reconnect
+#endif
<< Chat::send(handshakeNoAuthData)
<< Chat::expect(handshakeOkNoAuthData)
<< Chat::send(QBA(connect1a) + QByteArray::fromRawData(ip4Address.buf, 4) + QBA(connect1b))
@@ -904,8 +930,9 @@ void tst_NetworkSelfTest::socks5Proxy()
<< Chat::expect("\1") // IPv4 address following
<< Chat::skipBytes(6) // the server's local address and port
<< ftpChat()
-
- // connect to "localhost" by hostname
+#if !defined(QT_TEST_SERVER)
+ // connect to "localhost" by hostname, the same as above:
+ // makes no sense with the docker test server.
<< Chat::Reconnect
<< Chat::send(handshakeNoAuthData)
<< Chat::expect(handshakeOkNoAuthData)
@@ -914,12 +941,12 @@ void tst_NetworkSelfTest::socks5Proxy()
<< Chat::expect("\1") // IPv4 address following
<< Chat::skipBytes(6) // the server's local address and port
<< ftpChat()
-
+#endif
// connect to server by its official name
<< Chat::Reconnect
<< Chat::send(handshakeNoAuthData)
<< Chat::expect(handshakeOkNoAuthData)
- << Chat::send(QBA(connect2a) + char(QtNetworkSettings::serverName().size()) + QtNetworkSettings::serverName().toLatin1() + QBA(connect1b))
+ << Chat::send(QBA(connect2a) + char(QtNetworkSettings::ftpServerName().size()) + QtNetworkSettings::ftpServerName().toLatin1() + QBA(connect1b))
<< Chat::expect(connectedData)
<< Chat::expect("\1") // IPv4 address following
<< Chat::skipBytes(6) // the server's local address and port
@@ -941,8 +968,10 @@ void tst_NetworkSelfTest::socks5ProxyAuth()
<< Chat::send(handshakeNoAuthData)
<< Chat::expect(handshakeAuthNotOkData)
<< Chat::RemoteDisconnect
-
- // now try to connect with authentication
+#if !defined(QT_TEST_SERVER)
+ // now try to connect with authentication,
+ // danted is just that, socks 5 proxy and
+ // does not have ftp running, skip!
<< Chat::Reconnect
<< Chat::send(handshakeAuthPasswordData)
<< Chat::expect(handshakeOkPasswdAuthData)
@@ -951,6 +980,16 @@ void tst_NetworkSelfTest::socks5ProxyAuth()
<< Chat::expect("\1") // IPv4 address following
<< Chat::skipBytes(6) // the server's local address and port
<< ftpChat()
+#else
+ << Chat::Reconnect
+ << Chat::send(handshakeAuthPasswordData)
+ << Chat::expect(handshakeOkPasswdAuthData)
+ << Chat::send(QBA(connect2a) + char(QtNetworkSettings::ftpServerName().size()) + QtNetworkSettings::ftpServerName().toLatin1() + QBA(connect1b))
+ << Chat::expect(connectedData)
+ << Chat::expect("\1") // IPv4 address following
+ << Chat::skipBytes(6) // the server's local address and port
+ << ftpChat()
+#endif
);
}
@@ -984,6 +1023,9 @@ static void ensureTermination(QProcess &process)
void tst_NetworkSelfTest::smbServer()
{
+#if defined(QT_TEST_SERVER)
+ QSKIP("Not supported by the docker test server");
+#endif // QT_TEST_SERVER
static const char contents[] = "This is 34 bytes. Do not change...";
#ifdef Q_OS_WIN
// use Windows's native UNC support to try and open a file on the server
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 2a2ccfbf8d..97ffafc9a5 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -38,6 +38,7 @@
# include <winuser.h>
#endif
#include <QtTest/QtTest>
+#include <QSignalSpy>
#include <QtGui>
#include <QtWidgets>
#include <math.h>
@@ -4079,6 +4080,124 @@ void tst_QAccessibility::focusChild()
delete tabBar;
QTestAccessibility::clearEvents();
}
+
+ {
+ QMainWindow mainWindow;
+ QTableWidget *tableView = new QTableWidget(3, 3);
+
+ QSignalSpy spy(tableView, SIGNAL(currentCellChanged(int,int,int,int)));
+
+ tableView->setColumnCount(3);
+ QStringList hHeader;
+ hHeader << "h1" << "h2" << "h3";
+ tableView->setHorizontalHeaderLabels(hHeader);
+
+ QStringList vHeader;
+ vHeader << "v1" << "v2" << "v3";
+ tableView->setVerticalHeaderLabels(vHeader);
+
+ for (int i = 0; i < 9; ++i) {
+ QTableWidgetItem *item = new QTableWidgetItem;
+ item->setText(QString::number(i/3) + QString(".") + QString::number(i%3));
+ tableView->setItem(i/3, i%3, item);
+ }
+
+ mainWindow.setCentralWidget(tableView);
+ mainWindow.resize(600, 600);
+ mainWindow.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(tableView));
+
+ tableView->setFocus();
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(tableView);
+ QVERIFY(iface);
+
+ spy.clear();
+ tableView->setCurrentCell(2, 1);
+ QTRY_COMPARE(spy.count(), 1);
+
+ QAccessibleInterface *child = iface->focusChild();
+ QVERIFY(child);
+ QCOMPARE(child->text(QAccessible::Name), QStringLiteral("2.1"));
+
+ spy.clear();
+ tableView->setCurrentCell(1, 2);
+ QTRY_COMPARE(spy.count(), 1);
+
+ child = iface->focusChild();
+ QVERIFY(child);
+ QCOMPARE(child->text(QAccessible::Name), QStringLiteral("1.2"));
+
+ delete tableView;
+ QTestAccessibility::clearEvents();
+ }
+
+ {
+ QMainWindow mainWindow;
+ QTreeWidget *treeView = new QTreeWidget();
+
+ QSignalSpy spy(treeView, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
+
+ treeView->setColumnCount(2);
+ QTreeWidgetItem *header = new QTreeWidgetItem;
+ header->setText(0, "Artist");
+ header->setText(1, "Work");
+ treeView->setHeaderItem(header);
+
+ QTreeWidgetItem *root1 = new QTreeWidgetItem;
+ root1->setText(0, "Spain");
+ treeView->addTopLevelItem(root1);
+
+ QTreeWidgetItem *item1 = new QTreeWidgetItem;
+ item1->setText(0, "Picasso");
+ item1->setText(1, "Guernica");
+ root1->addChild(item1);
+
+ QTreeWidgetItem *item2 = new QTreeWidgetItem;
+ item2->setText(0, "Tapies");
+ item2->setText(1, "Ambrosia");
+ root1->addChild(item2);
+
+ QTreeWidgetItem *root2 = new QTreeWidgetItem;
+ root2->setText(0, "Austria");
+ treeView->addTopLevelItem(root2);
+
+ QTreeWidgetItem *item3 = new QTreeWidgetItem;
+ item3->setText(0, "Klimt");
+ item3->setText(1, "The Kiss");
+ root2->addChild(item3);
+
+ mainWindow.setCentralWidget(treeView);
+ mainWindow.resize(600, 600);
+ mainWindow.show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(treeView));
+
+ treeView->setFocus();
+
+ QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(treeView);
+ QVERIFY(iface);
+
+ spy.clear();
+ treeView->setCurrentItem(item2);
+ QTRY_COMPARE(spy.count(), 1);
+
+ QAccessibleInterface *child = iface->focusChild();
+ QVERIFY(child);
+ QCOMPARE(child->text(QAccessible::Name), QStringLiteral("Tapies"));
+
+ spy.clear();
+ treeView->setCurrentItem(item3);
+ QTRY_COMPARE(spy.count(), 1);
+
+ child = iface->focusChild();
+ QVERIFY(child);
+ QCOMPARE(child->text(QAccessible::Name), QStringLiteral("Klimt"));
+
+ delete treeView;
+ QTestAccessibility::clearEvents();
+ }
}
diff --git a/tests/auto/other/qaccessibilitymac/BLACKLIST b/tests/auto/other/qaccessibilitymac/BLACKLIST
new file mode 100644
index 0000000000..916342e9fc
--- /dev/null
+++ b/tests/auto/other/qaccessibilitymac/BLACKLIST
@@ -0,0 +1,4 @@
+# See qtbase/src/testlib/qtestblacklist.cpp for format
+[notificationsTest]
+macos-10.15
+
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
index ba0562f049..e684c1ee34 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac.cpp
@@ -143,7 +143,7 @@ void tst_QAccessibilityMac::checkBoxTest()
QVERIFY(QTest::qWaitForWindowExposed(m_window));
QCoreApplication::processEvents();
- QVERIFY(testCheckBox());
+ QVERIFY(testCheckBox(cb));
}
QTEST_MAIN(tst_QAccessibilityMac)
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
index 75b2d39a00..58ea2d02b0 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.h
@@ -28,6 +28,7 @@
#include <QtCore/QString>
#include <QtCore/QPair>
#include <QtWidgets/QWidget>
+#include <QtWidgets/QCheckBox>
#pragma once // Yeah, it's deprecated in general, but it's standard practice for Mac OS X.
@@ -37,4 +38,4 @@ bool testLineEdit();
bool testHierarchy(QWidget *w);
bool singleWidget();
bool notifications(QWidget *w);
-bool testCheckBox();
+bool testCheckBox(QCheckBox *ckBox);
diff --git a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
index 4ebf7a37f9..174d86a941 100644
--- a/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
+++ b/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
@@ -86,6 +86,7 @@ QDebug operator<<(QDebug dbg, AXErrorTag err)
return false; \
} \
+#define TRY_EXPECT(cond) EXPECT(QTest::qWaitFor([&]{ return (cond); }))
@interface TestAXObject : NSObject
{
@@ -546,26 +547,22 @@ bool notifications(QWidget *w)
EXPECT(notificationList.length() == 0);
le2->setFocus();
- QCoreApplication::processEvents();
- EXPECT(notificationList.length() == 1);
- EXPECT(notificationList.at(0) == QAccessible::Focus);
+ TRY_EXPECT(notificationList.length() == 1);
+ TRY_EXPECT(notificationList.at(0) == QAccessible::Focus);
le1->setFocus();
- QCoreApplication::processEvents();
- EXPECT(notificationList.length() == 2);
- EXPECT(notificationList.at(1) == QAccessible::Focus);
+ TRY_EXPECT(notificationList.length() == 2);
+ TRY_EXPECT(notificationList.at(1) == QAccessible::Focus);
le1->setText("hello");
- QCoreApplication::processEvents();
- EXPECT(notificationList.length() == 3);
- EXPECT(notificationList.at(2) == QAccessible::ValueChanged);
+ TRY_EXPECT(notificationList.length() == 3);
+ TRY_EXPECT(notificationList.at(2) == QAccessible::ValueChanged);
le1->setText("foo");
- QCoreApplication::processEvents();
- EXPECT(notificationList.length() == 4);
- EXPECT(notificationList.at(3) == QAccessible::ValueChanged);
+ TRY_EXPECT(notificationList.length() == 4);
+ TRY_EXPECT(notificationList.at(3) == QAccessible::ValueChanged);
return true;
}
-bool testCheckBox()
+bool testCheckBox(QCheckBox *ckBox)
{
TestAXObject *appObject = [TestAXObject getApplicationAXObject];
EXPECT(appObject);
@@ -596,5 +593,8 @@ bool testCheckBox()
[cb performAction:kAXPressAction];
EXPECT([cb valueNumber] == 0);
+ ckBox->setCheckState(Qt::PartiallyChecked);
+ EXPECT([cb valueNumber] == 2);
+
return true;
}