summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/other.pro2
-rw-r--r--tests/auto/qbuffer/tst_qbuffer.cpp50
-rw-r--r--tests/auto/qfontdialog/qfontdialog.pro2
-rw-r--r--tests/auto/qhostaddress/tst_qhostaddress.cpp60
-rw-r--r--tests/auto/qlayout/tst_qlayout.cpp4
-rw-r--r--tests/auto/qmacstyle/tst_qmacstyle.cpp2
-rw-r--r--tests/auto/qprocess/tst_qprocess.cpp28
-rw-r--r--tests/auto/qsettings/qsettings.pro2
-rw-r--r--tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.0.9.842
-rw-r--r--tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.042
-rw-r--r--tests/auto/qsslcertificate/tst_qsslcertificate.cpp21
-rw-r--r--tests/auto/qtcpserver/tst_qtcpserver.cpp40
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp2
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp26
-rw-r--r--tests/auto/qudpsocket/tst_qudpsocket.cpp81
-rw-r--r--tests/auto/qwidget/qwidget.pro2
16 files changed, 357 insertions, 49 deletions
diff --git a/tests/auto/other.pro b/tests/auto/other.pro
index b50e1697b3..c4ddc83cdf 100644
--- a/tests/auto/other.pro
+++ b/tests/auto/other.pro
@@ -38,7 +38,7 @@ SUBDIRS=\
contains(QT_CONFIG, accessibility):SUBDIRS += qaccessibility
contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter
-mac: {
+mac:!qpa {
SUBDIRS += macgui \
macnativeevents \
macplist \
diff --git a/tests/auto/qbuffer/tst_qbuffer.cpp b/tests/auto/qbuffer/tst_qbuffer.cpp
index 776935d6e0..bf4842ff94 100644
--- a/tests/auto/qbuffer/tst_qbuffer.cpp
+++ b/tests/auto/qbuffer/tst_qbuffer.cpp
@@ -56,6 +56,7 @@ public:
tst_QBuffer();
private slots:
+ void open();
void getSetCheck();
void readBlock();
void readBlockPastEnd();
@@ -104,6 +105,55 @@ tst_QBuffer::tst_QBuffer()
{
}
+void tst_QBuffer::open()
+{
+ QByteArray data(10, 'f');
+
+ QBuffer b;
+
+ QTest::ignoreMessage(QtWarningMsg, "QBuffer::open: Buffer access not specified");
+ QVERIFY(!b.open(QIODevice::NotOpen));
+ QVERIFY(!b.isOpen());
+ b.close();
+
+ QTest::ignoreMessage(QtWarningMsg, "QBuffer::open: Buffer access not specified");
+ QVERIFY(!b.open(QIODevice::Text));
+ QVERIFY(!b.isOpen());
+ b.close();
+
+ QTest::ignoreMessage(QtWarningMsg, "QBuffer::open: Buffer access not specified");
+ QVERIFY(!b.open(QIODevice::Unbuffered));
+ QVERIFY(!b.isOpen());
+ b.close();
+
+ QVERIFY(b.open(QIODevice::ReadOnly));
+ QVERIFY(b.isReadable());
+ b.close();
+
+ QVERIFY(b.open(QIODevice::WriteOnly));
+ QVERIFY(b.isWritable());
+ b.close();
+
+ b.setData(data);
+ QVERIFY(b.open(QIODevice::Append));
+ QVERIFY(b.isWritable());
+ QCOMPARE(b.size(), qint64(10));
+ QCOMPARE(b.pos(), b.size());
+ b.close();
+
+ b.setData(data);
+ QVERIFY(b.open(QIODevice::Truncate));
+ QVERIFY(b.isWritable());
+ QCOMPARE(b.size(), qint64(0));
+ QCOMPARE(b.pos(), qint64(0));
+ b.close();
+
+ QVERIFY(b.open(QIODevice::ReadWrite));
+ QVERIFY(b.isReadable());
+ QVERIFY(b.isWritable());
+ b.close();
+}
+
// some status() tests, too
void tst_QBuffer::readBlock()
{
diff --git a/tests/auto/qfontdialog/qfontdialog.pro b/tests/auto/qfontdialog/qfontdialog.pro
index 80444ed494..60320476e2 100644
--- a/tests/auto/qfontdialog/qfontdialog.pro
+++ b/tests/auto/qfontdialog/qfontdialog.pro
@@ -5,7 +5,7 @@ QT += core-private gui-private
SOURCES += tst_qfontdialog.cpp
-mac {
+mac:!qpa {
OBJECTIVE_SOURCES += tst_qfontdialog_mac_helpers.mm
LIBS += -framework Cocoa
}
diff --git a/tests/auto/qhostaddress/tst_qhostaddress.cpp b/tests/auto/qhostaddress/tst_qhostaddress.cpp
index 08eb63cff8..b20e07be03 100644
--- a/tests/auto/qhostaddress/tst_qhostaddress.cpp
+++ b/tests/auto/qhostaddress/tst_qhostaddress.cpp
@@ -269,7 +269,10 @@ void tst_QHostAddress::specialAddresses_data()
QTest::newRow("broadcast_2") << QString("255.255.255.255") << (int)QHostAddress::Broadcast << true;
QTest::newRow("any_ipv6") << QString("::") << (int)QHostAddress::AnyIPv6 << true;
- QTest::newRow("any_ipv4") << QString("0.0.0.0") << (int)QHostAddress::Any << true;
+ QTest::newRow("any_ipv4") << QString("0.0.0.0") << (int)QHostAddress::AnyIPv4 << true;
+
+ QTest::newRow("dual_not_ipv6") << QString("::") << (int)QHostAddress::Any << false;
+ QTest::newRow("dual_not_ipv4") << QString("0.0.0.0") << (int)QHostAddress::Any << false;
}
@@ -366,8 +369,9 @@ void tst_QHostAddress::streaming_data()
QTest::newRow("8") << QHostAddress(QHostAddress::LocalHostIPv6);
QTest::newRow("9") << QHostAddress(QHostAddress::Broadcast);
QTest::newRow("10") << QHostAddress(QHostAddress::Any);
- QTest::newRow("11") << QHostAddress(QHostAddress::AnyIPv6);
- QTest::newRow("12") << QHostAddress("foo.bar.com");
+ QTest::newRow("11") << QHostAddress(QHostAddress::AnyIPv4);
+ QTest::newRow("12") << QHostAddress(QHostAddress::AnyIPv6);
+ QTest::newRow("13") << QHostAddress("foo.bar.com");
}
void tst_QHostAddress::streaming()
@@ -409,26 +413,26 @@ void tst_QHostAddress::parseSubnet_data()
QTest::newRow("invalid_23") << "ffff::/ff00::" << QHostAddress() << -1;
// correct IPv4 with netmask
- QTest::newRow("netmask_0") << "0.0.0.0/0.0.0.0" << QHostAddress(QHostAddress::Any) << 0;
- QTest::newRow("netmask_1") << "0.0.0.0/255.128.0.0" << QHostAddress(QHostAddress::Any) << 9;
- QTest::newRow("netmask_2") << "0.0.0.0/255.192.0.0" << QHostAddress(QHostAddress::Any) << 10;
- QTest::newRow("netmask_3") << "0.0.0.0/255.224.0.0" << QHostAddress(QHostAddress::Any) << 11;
- QTest::newRow("netmask_4") << "0.0.0.0/255.240.0.0" << QHostAddress(QHostAddress::Any) << 12;
- QTest::newRow("netmask_5") << "0.0.0.0/255.248.0.0" << QHostAddress(QHostAddress::Any) << 13;
- QTest::newRow("netmask_6") << "0.0.0.0/255.252.0.0" << QHostAddress(QHostAddress::Any) << 14;
- QTest::newRow("netmask_7") << "0.0.0.0/255.254.0.0" << QHostAddress(QHostAddress::Any) << 15;
- QTest::newRow("netmask_8") << "0.0.0.0/255.255.0.0" << QHostAddress(QHostAddress::Any) << 16;
- QTest::newRow("netmask_16") << "0.0.0.0/255.255.0.0" << QHostAddress(QHostAddress::Any) << 16;
- QTest::newRow("netmask_24") << "0.0.0.0/255.255.255.0" << QHostAddress(QHostAddress::Any) << 24;
- QTest::newRow("netmask_31") << "0.0.0.0/255.255.255.254" << QHostAddress(QHostAddress::Any) << 31;
- QTest::newRow("netmask_32") << "0.0.0.0/255.255.255.255" << QHostAddress(QHostAddress::Any) << 32;
+ QTest::newRow("netmask_0") << "0.0.0.0/0.0.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 0;
+ QTest::newRow("netmask_1") << "0.0.0.0/255.128.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 9;
+ QTest::newRow("netmask_2") << "0.0.0.0/255.192.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 10;
+ QTest::newRow("netmask_3") << "0.0.0.0/255.224.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 11;
+ QTest::newRow("netmask_4") << "0.0.0.0/255.240.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 12;
+ QTest::newRow("netmask_5") << "0.0.0.0/255.248.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 13;
+ QTest::newRow("netmask_6") << "0.0.0.0/255.252.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 14;
+ QTest::newRow("netmask_7") << "0.0.0.0/255.254.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 15;
+ QTest::newRow("netmask_8") << "0.0.0.0/255.255.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 16;
+ QTest::newRow("netmask_16") << "0.0.0.0/255.255.0.0" << QHostAddress(QHostAddress::AnyIPv4) << 16;
+ QTest::newRow("netmask_24") << "0.0.0.0/255.255.255.0" << QHostAddress(QHostAddress::AnyIPv4) << 24;
+ QTest::newRow("netmask_31") << "0.0.0.0/255.255.255.254" << QHostAddress(QHostAddress::AnyIPv4) << 31;
+ QTest::newRow("netmask_32") << "0.0.0.0/255.255.255.255" << QHostAddress(QHostAddress::AnyIPv4) << 32;
// correct IPv4 with prefix
- QTest::newRow("prefix_0") << "0.0.0.0/0" << QHostAddress(QHostAddress::Any) << 0;
- QTest::newRow("prefix_1") << "0.0.0.0/1" << QHostAddress(QHostAddress::Any) << 1;
- QTest::newRow("prefix_9") << "0.0.0.0/9" << QHostAddress(QHostAddress::Any) << 9;
- QTest::newRow("prefix_31") << "0.0.0.0/31" << QHostAddress(QHostAddress::Any) << 31;
- QTest::newRow("prefix_32") << "0.0.0.0/32" << QHostAddress(QHostAddress::Any) << 32;
+ QTest::newRow("prefix_0") << "0.0.0.0/0" << QHostAddress(QHostAddress::AnyIPv4) << 0;
+ QTest::newRow("prefix_1") << "0.0.0.0/1" << QHostAddress(QHostAddress::AnyIPv4) << 1;
+ QTest::newRow("prefix_9") << "0.0.0.0/9" << QHostAddress(QHostAddress::AnyIPv4) << 9;
+ QTest::newRow("prefix_31") << "0.0.0.0/31" << QHostAddress(QHostAddress::AnyIPv4) << 31;
+ QTest::newRow("prefix_32") << "0.0.0.0/32" << QHostAddress(QHostAddress::AnyIPv4) << 32;
// correct IPv4 without prefix or netmask
QTest::newRow("classA") << "10" << QHostAddress("10.0.0.0") << 8;
@@ -533,22 +537,22 @@ void tst_QHostAddress::isInSubnet_data()
// invalid QHostAddresses are never in any subnets
QTest::newRow("invalid_01") << QHostAddress() << QHostAddress() << 32 << false;
- QTest::newRow("invalid_02") << QHostAddress() << QHostAddress(QHostAddress::Any) << 32 << false;
- QTest::newRow("invalid_03") << QHostAddress() << QHostAddress(QHostAddress::Any) << 8 << false;
- QTest::newRow("invalid_04") << QHostAddress() << QHostAddress(QHostAddress::Any) << 0 << false;
+ QTest::newRow("invalid_02") << QHostAddress() << QHostAddress(QHostAddress::AnyIPv4) << 32 << false;
+ QTest::newRow("invalid_03") << QHostAddress() << QHostAddress(QHostAddress::AnyIPv4) << 8 << false;
+ QTest::newRow("invalid_04") << QHostAddress() << QHostAddress(QHostAddress::AnyIPv4) << 0 << false;
QTest::newRow("invalid_05") << QHostAddress() << QHostAddress("255.255.255.0") << 24 << false;
QTest::newRow("invalid_06") << QHostAddress() << QHostAddress(QHostAddress::AnyIPv6) << 0 << false;
QTest::newRow("invalid_07") << QHostAddress() << QHostAddress(QHostAddress::AnyIPv6) << 32 << false;
QTest::newRow("invalid_08") << QHostAddress() << QHostAddress(QHostAddress::AnyIPv6) << 128<< false;
// and no host address can be in a subnet whose prefix is invalid
- QTest::newRow("invalid_20") << QHostAddress(QHostAddress::Any) << QHostAddress() << 16 << false;
+ QTest::newRow("invalid_20") << QHostAddress(QHostAddress::AnyIPv4) << QHostAddress() << 16 << false;
QTest::newRow("invalid_21") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress() << 16 << false;
QTest::newRow("invalid_22") << QHostAddress(QHostAddress::LocalHost) << QHostAddress() << 16 << false;
QTest::newRow("invalid_23") << QHostAddress(QHostAddress::LocalHostIPv6) << QHostAddress() << 16 << false;
// negative netmasks don't make sense:
- QTest::newRow("invalid_30") << QHostAddress(QHostAddress::Any) << QHostAddress(QHostAddress::Any) << -1 << false;
+ QTest::newRow("invalid_30") << QHostAddress(QHostAddress::AnyIPv4) << QHostAddress(QHostAddress::Any) << -1 << false;
QTest::newRow("invalid_31") << QHostAddress(QHostAddress::AnyIPv6) << QHostAddress(QHostAddress::AnyIPv6) << -1 << false;
// we don't support IPv4 belonging in an IPv6 netmask and vice-versa
@@ -558,10 +562,10 @@ void tst_QHostAddress::isInSubnet_data()
QTest::newRow("v4-in-v6mapped2") << QHostAddress(QHostAddress::LocalHost) << QHostAddress("::ffff:255.0.0.0") << 113 << false;
// IPv4 correct ones
- QTest::newRow("netmask_0") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::Any) << 0 << true;
+ QTest::newRow("netmask_0") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::AnyIPv4) << 0 << true;
QTest::newRow("netmask_0bis") << QHostAddress(QHostAddress::LocalHost) << QHostAddress("255.255.0.0") << 0 << true;
QTest::newRow("netmask_0ter") << QHostAddress(QHostAddress::LocalHost) << QHostAddress("1.2.3.4") << 0 << true;
- QTest::newRow("netmask_1") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::Any) << 1 << true;
+ QTest::newRow("netmask_1") << QHostAddress(QHostAddress::LocalHost) << QHostAddress(QHostAddress::AnyIPv4) << 1 << true;
QTest::newRow("~netmask_1") << QHostAddress(QHostAddress::LocalHost) << QHostAddress("128.0.0.0") << 1 << false;
QTest::newRow("netmask_1bis") << QHostAddress("224.0.0.1") << QHostAddress("128.0.0.0") << 1 << true;
QTest::newRow("~netmask_1bis") << QHostAddress("224.0.0.1") << QHostAddress("0.0.0.0") << 1 << false;
diff --git a/tests/auto/qlayout/tst_qlayout.cpp b/tests/auto/qlayout/tst_qlayout.cpp
index cfb895ba32..ea25700568 100644
--- a/tests/auto/qlayout/tst_qlayout.cpp
+++ b/tests/auto/qlayout/tst_qlayout.cpp
@@ -56,7 +56,7 @@
#include <QRadioButton>
#include <private/qlayoutengine_p.h>
-#ifdef Q_OS_MAC
+#ifdef Q_WS_MAC
# include <QtGui/QMacStyle>
#endif
@@ -280,7 +280,7 @@ public:
void tst_QLayout::layoutItemRect()
{
-#ifdef Q_OS_MAC
+#ifdef Q_WS_MAC
if (qobject_cast<QMacStyle*>(QApplication::style())) {
QWidget *window = new QWidget;
QRadioButton *radio = new QRadioButton(window);
diff --git a/tests/auto/qmacstyle/tst_qmacstyle.cpp b/tests/auto/qmacstyle/tst_qmacstyle.cpp
index 6e40bdf362..3c2f71184d 100644
--- a/tests/auto/qmacstyle/tst_qmacstyle.cpp
+++ b/tests/auto/qmacstyle/tst_qmacstyle.cpp
@@ -45,7 +45,7 @@
#include <qmacstyle_mac.h>
-#ifdef Q_OS_MAC
+#ifdef Q_WS_MAC
const int N = 1;
diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp
index 91e0abe677..f54dfa3f68 100644
--- a/tests/auto/qprocess/tst_qprocess.cpp
+++ b/tests/auto/qprocess/tst_qprocess.cpp
@@ -73,7 +73,7 @@ Q_DECLARE_METATYPE(QProcess::ProcessState);
{ \
const bool ret = Process.Fn; \
if (ret == false) \
- qWarning("QProcess error: %d: %s", Process.error(), qPrintable(Process.errorString())); \
+ qWarning("QProcess error: %d: %s", Process.error(), qPrintable(Process.errorString())); \
QVERIFY(ret); \
}
@@ -157,6 +157,7 @@ private slots:
void startFinishStartFinish();
void invalidProgramString_data();
void invalidProgramString();
+ void onlyOneStartedSignal();
// keep these at the end, since they use lots of processes and sometimes
// caused obscure failures to occur in tests that followed them (esp. on the Mac)
@@ -2089,7 +2090,7 @@ void tst_QProcess::setStandardInputFile()
#endif
QPROCESS_VERIFY(process, waitForFinished());
- QByteArray all = process.readAll();
+ QByteArray all = process.readAll();
QCOMPARE(all.size(), int(sizeof data) - 1); // testProcessEcho drops the ending \0
QVERIFY(all == data);
}
@@ -2442,6 +2443,29 @@ void tst_QProcess::invalidProgramString()
QVERIFY(!QProcess::startDetached(programString));
}
+//-----------------------------------------------------------------------------
+void tst_QProcess::onlyOneStartedSignal()
+{
+ QProcess process;
+
+ QSignalSpy spyStarted(&process, SIGNAL(started()));
+ QSignalSpy spyFinished(&process, SIGNAL(finished(int, QProcess::ExitStatus)));
+
+ process.start("testProcessNormal/testProcessNormal");
+ QVERIFY(process.waitForStarted(5000));
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(spyStarted.count(), 1);
+ QCOMPARE(spyFinished.count(), 1);
+
+ spyStarted.clear();
+ spyFinished.clear();
+
+ process.start("testProcessNormal/testProcessNormal");
+ QVERIFY(process.waitForFinished(5000));
+ QCOMPARE(spyStarted.count(), 1);
+ QCOMPARE(spyFinished.count(), 1);
+}
+
QTEST_MAIN(tst_QProcess)
#include "tst_qprocess.moc"
#endif
diff --git a/tests/auto/qsettings/qsettings.pro b/tests/auto/qsettings/qsettings.pro
index 35bb56cc98..f15e40b267 100644
--- a/tests/auto/qsettings/qsettings.pro
+++ b/tests/auto/qsettings/qsettings.pro
@@ -5,8 +5,6 @@ QT += core-private
SOURCES += tst_qsettings.cpp
RESOURCES += qsettings.qrc
-CONFIG -= debug
-CONFIG += release
win32-msvc*:LIBS += advapi32.lib
CONFIG += parallel_test
diff --git a/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.0.9.8 b/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.0.9.8
new file mode 100644
index 0000000000..20500b221f
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.0.9.8
@@ -0,0 +1,42 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ ce:db:31:28:45:c4:05:40
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
+ Validity
+ Not Before: Aug 4 09:53:41 2010 GMT
+ Not After : Aug 29 09:53:41 2051 GMT
+ Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public Key: (1024 bit)
+ Modulus (1024 bit):
+ 00:cd:aa:db:6f:d6:34:c9:a7:f1:c0:be:e4:41:18:
+ 19:e2:02:c9:22:e6:a7:d5:ba:03:2e:9e:28:7a:f4:
+ 5f:1a:77:5f:77:a9:11:3b:8f:7e:f0:2e:c6:9e:eb:
+ 3a:d9:12:d7:c1:0c:51:e8:24:52:3f:23:c3:42:0c:
+ 11:c6:f2:1c:a1:42:fe:b4:c2:69:83:ad:f7:70:b1:
+ 18:15:cc:20:28:62:30:f0:2c:15:e6:33:19:af:c3:
+ eb:1c:c0:91:f7:11:68:94:50:f8:49:37:08:32:d7:
+ 3e:75:df:a3:bc:69:00:15:de:cd:87:0f:5c:02:6b:
+ 82:c8:01:7d:6a:f0:1d:dc:73
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ 8A:6E:19:E7:97:9B:8F:D9:7F:B3:BB:01:4F:E8:6A:2F:52:95:0D:D9
+ X509v3 Authority Key Identifier:
+ keyid:8A:6E:19:E7:97:9B:8F:D9:7F:B3:BB:01:4F:E8:6A:2F:52:95:0D:D9
+
+ X509v3 Basic Constraints:
+ CA:TRUE
+ Signature Algorithm: sha1WithRSAEncryption
+ a1:74:8e:5d:36:96:2c:05:7e:ea:66:cc:2e:68:c7:3d:93:dc:
+ 8c:a3:11:ad:b5:7e:6e:d0:04:c4:09:bd:0a:f9:39:3b:97:d7:
+ f0:bb:0c:09:7b:83:fe:bf:87:b0:47:e8:94:b7:aa:9c:79:ad:
+ 71:9e:b7:c4:99:98:6f:1d:38:32:f8:a3:75:38:c4:e5:e7:37:
+ 37:21:ec:7b:50:8b:15:b0:97:1e:17:9c:50:17:3c:c1:df:94:
+ 55:fb:60:2e:50:40:d1:ea:23:c6:3c:21:6f:97:8c:06:16:a5:
+ 82:72:c1:63:14:64:86:eb:d7:ff:72:f6:09:f5:6d:e6:04:13:
+ 7a:6a
diff --git a/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.0 b/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.0
new file mode 100644
index 0000000000..b2ccb2751e
--- /dev/null
+++ b/tests/auto/qsslcertificate/more-certificates/cert-large-expiration-date.txt.1.0.0
@@ -0,0 +1,42 @@
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ ce:db:31:28:45:c4:05:40
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
+ Validity
+ Not Before: Aug 4 09:53:41 2010 GMT
+ Not After : Aug 29 09:53:41 2051 GMT
+ Subject: C=AU, ST=Some-State, O=Internet Widgits Pty Ltd
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ Public-Key: (1024 bit)
+ Modulus:
+ 00:cd:aa:db:6f:d6:34:c9:a7:f1:c0:be:e4:41:18:
+ 19:e2:02:c9:22:e6:a7:d5:ba:03:2e:9e:28:7a:f4:
+ 5f:1a:77:5f:77:a9:11:3b:8f:7e:f0:2e:c6:9e:eb:
+ 3a:d9:12:d7:c1:0c:51:e8:24:52:3f:23:c3:42:0c:
+ 11:c6:f2:1c:a1:42:fe:b4:c2:69:83:ad:f7:70:b1:
+ 18:15:cc:20:28:62:30:f0:2c:15:e6:33:19:af:c3:
+ eb:1c:c0:91:f7:11:68:94:50:f8:49:37:08:32:d7:
+ 3e:75:df:a3:bc:69:00:15:de:cd:87:0f:5c:02:6b:
+ 82:c8:01:7d:6a:f0:1d:dc:73
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ 8A:6E:19:E7:97:9B:8F:D9:7F:B3:BB:01:4F:E8:6A:2F:52:95:0D:D9
+ X509v3 Authority Key Identifier:
+ keyid:8A:6E:19:E7:97:9B:8F:D9:7F:B3:BB:01:4F:E8:6A:2F:52:95:0D:D9
+
+ X509v3 Basic Constraints:
+ CA:TRUE
+ Signature Algorithm: sha1WithRSAEncryption
+ a1:74:8e:5d:36:96:2c:05:7e:ea:66:cc:2e:68:c7:3d:93:dc:
+ 8c:a3:11:ad:b5:7e:6e:d0:04:c4:09:bd:0a:f9:39:3b:97:d7:
+ f0:bb:0c:09:7b:83:fe:bf:87:b0:47:e8:94:b7:aa:9c:79:ad:
+ 71:9e:b7:c4:99:98:6f:1d:38:32:f8:a3:75:38:c4:e5:e7:37:
+ 37:21:ec:7b:50:8b:15:b0:97:1e:17:9c:50:17:3c:c1:df:94:
+ 55:fb:60:2e:50:40:d1:ea:23:c6:3c:21:6f:97:8c:06:16:a5:
+ 82:72:c1:63:14:64:86:eb:d7:ff:72:f6:09:f5:6d:e6:04:13:
+ 7a:6a
diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
index 9276685928..6e29072d8f 100644
--- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp
@@ -113,6 +113,7 @@ private slots:
void largeSerialNumber();
void largeExpirationDate();
void blacklistedCertificates();
+ void toText();
// ### add tests for certificate bundles (multiple certificates concatenated into a single
// structure); both PEM and DER formatted
@@ -850,6 +851,26 @@ void tst_QSslCertificate::blacklistedCertificates()
}
}
+void tst_QSslCertificate::toText()
+{
+ QList<QSslCertificate> certList =
+ QSslCertificate::fromPath(SRCDIR "more-certificates/cert-large-expiration-date.pem");
+
+ QCOMPARE(certList.size(), 1);
+ const QSslCertificate &cert = certList.at(0);
+
+ // Openssl's cert dump method changed slightly between 0.9.8 and 1.0.0 versions, so we want it to match any output
+
+ QFile fOld(SRCDIR "more-certificates/cert-large-expiration-date.txt.0.9.8");
+ QVERIFY(fOld.open(QIODevice::ReadOnly));
+ QByteArray txtOld = fOld.readAll();
+
+ QFile fNew(SRCDIR "more-certificates/cert-large-expiration-date.txt.1.0.0");
+ QVERIFY(fNew.open(QIODevice::ReadOnly));
+ QByteArray txtNew = fNew.readAll();
+ QVERIFY(txtOld == cert.toText() || txtNew == cert.toText());
+}
+
#endif // QT_NO_OPENSSL
QTEST_MAIN(tst_QSslCertificate)
diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp
index 3416a7cb23..beeb6c7655 100644
--- a/tests/auto/qtcpserver/tst_qtcpserver.cpp
+++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp
@@ -97,6 +97,8 @@ private slots:
void constructing();
void clientServerLoop();
void ipv6Server();
+ void dualStack_data();
+ void dualStack();
void ipv6ServerMapped();
void crashTests();
void maxPendingConnections();
@@ -265,6 +267,44 @@ void tst_QTcpServer::ipv6Server()
delete serverSocket;
}
+Q_DECLARE_METATYPE(QHostAddress);
+
+void tst_QTcpServer::dualStack_data()
+{
+ QTest::addColumn<QHostAddress>("bindAddress");
+ QTest::addColumn<bool>("v4ok");
+ QTest::addColumn<bool>("v6ok");
+ QTest::newRow("any") << QHostAddress(QHostAddress::Any) << true << true;
+ QTest::newRow("anyIPv4") << QHostAddress(QHostAddress::AnyIPv4) << true << false;
+ QTest::newRow("anyIPv6") << QHostAddress(QHostAddress::AnyIPv6) << false << true;
+}
+
+void tst_QTcpServer::dualStack()
+{
+#ifdef QT_NO_IPV6
+ QSKIP("test requires IPv6 support", SkipAll);
+#else
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ QSKIP("test server proxy doesn't support ipv6", SkipSingle);
+ QFETCH(QHostAddress, bindAddress);
+ QFETCH(bool, v4ok);
+ QFETCH(bool, v6ok);
+
+ QTcpServer server;
+ QVERIFY(server.listen(bindAddress));
+
+ QTcpSocket v4client;
+ v4client.connectToHost(QHostAddress::LocalHost, server.serverPort());
+
+ QTcpSocket v6client;
+ v6client.connectToHost(QHostAddress::LocalHostIPv6, server.serverPort());
+
+ QCOMPARE(v4client.waitForConnected(5000), v4ok);
+ QCOMPARE(v6client.waitForConnected(5000), v6ok);
+#endif
+}
+
//----------------------------------------------------------------------------------
void tst_QTcpServer::ipv6ServerMapped()
{
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index a2f8bac517..39a64ab0dc 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -1506,7 +1506,7 @@ void tst_QTcpSocket::dontCloseOnTimeout()
QVERIFY(server.listen());
QHostAddress serverAddress = QHostAddress::LocalHost;
- if (!(server.serverAddress() == QHostAddress::Any) && !(server.serverAddress() == QHostAddress::AnyIPv6))
+ if (!(server.serverAddress() == QHostAddress::AnyIPv4) && !(server.serverAddress() == QHostAddress::AnyIPv6))
serverAddress = server.serverAddress();
QTcpSocket *socket = newSocket();
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index 1129219b1f..c98a703acc 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -182,6 +182,8 @@ private slots:
void copiedFontSize();
+ void htmlExportImportBlockCount();
+
private:
void backgroundImage_checkExpectedHtml(const QTextDocument &doc);
@@ -1582,7 +1584,7 @@ void tst_QTextDocument::toHtml()
expectedOutput.replace("OPENDEFAULTBLOCKSTYLE", "style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;");
expectedOutput.replace("DEFAULTBLOCKSTYLE", "style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"");
- expectedOutput.replace("EMPTYBLOCK", "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"></p>\n");
+ expectedOutput.replace("EMPTYBLOCK", "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n");
if (expectedOutput.endsWith(QLatin1Char('\n')))
expectedOutput.chop(1);
expectedOutput.append(htmlTail);
@@ -2760,5 +2762,27 @@ void tst_QTextDocument::copiedFontSize()
QCOMPARE(cursorOutput.charFormat().font().pixelSize(), 24);
}
+void tst_QTextDocument::htmlExportImportBlockCount()
+{
+ QTextDocument document;
+ {
+ QTextCursor cursor(&document);
+ cursor.insertText("Foo");
+ cursor.insertBlock();
+ cursor.insertBlock();
+ cursor.insertBlock();
+ cursor.insertBlock();
+ cursor.insertText("Bar");
+ }
+
+ QCOMPARE(document.blockCount(), 5);
+ QString html = document.toHtml();
+
+ document.clear();
+ document.setHtml(html);
+
+ QCOMPARE(document.blockCount(), 5);
+}
+
QTEST_MAIN(tst_QTextDocument)
#include "tst_qtextdocument.moc"
diff --git a/tests/auto/qudpsocket/tst_qudpsocket.cpp b/tests/auto/qudpsocket/tst_qudpsocket.cpp
index 9ca049bccf..03e224682f 100644
--- a/tests/auto/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/qudpsocket/tst_qudpsocket.cpp
@@ -90,6 +90,7 @@ private slots:
void loop();
void ipv6Loop_data();
void ipv6Loop();
+ void dualStack();
void readLine();
void pendingDatagramSize();
void writeDatagram();
@@ -212,7 +213,7 @@ void tst_QUdpSocket::unconnectedServerAndClientTest()
const char *message[] = {"Yo mista", "Yo", "Wassap"};
QHostAddress serverAddress = QHostAddress::LocalHost;
- if (!(serverSocket.localAddress() == QHostAddress::Any || serverSocket.localAddress() == QHostAddress::AnyIPv6))
+ if (!(serverSocket.localAddress() == QHostAddress::AnyIPv4 || serverSocket.localAddress() == QHostAddress::AnyIPv6))
serverAddress = serverSocket.localAddress();
for (int i = 0; i < 3; ++i) {
@@ -343,10 +344,10 @@ void tst_QUdpSocket::loop()
QVERIFY2(paul.bind(), paul.errorString().toLatin1().constData());
QHostAddress peterAddress = QHostAddress::LocalHost;
- if (!(peter.localAddress() == QHostAddress::Any || peter.localAddress() == QHostAddress::AnyIPv6))
+ if (!(peter.localAddress() == QHostAddress::AnyIPv4 || peter.localAddress() == QHostAddress::AnyIPv6))
peterAddress = peter.localAddress();
QHostAddress pualAddress = QHostAddress::LocalHost;
- if (!(paul.localAddress() == QHostAddress::Any || paul.localAddress() == QHostAddress::AnyIPv6))
+ if (!(paul.localAddress() == QHostAddress::AnyIPv4 || paul.localAddress() == QHostAddress::AnyIPv6))
pualAddress = paul.localAddress();
QCOMPARE(peter.writeDatagram(peterMessage.data(), peterMessage.length(),
@@ -428,6 +429,64 @@ void tst_QUdpSocket::ipv6Loop()
}
}
+void tst_QUdpSocket::dualStack()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ QSKIP("test server SOCKS proxy doesn't support IPv6", SkipSingle);
+ QUdpSocket dualSock;
+ QByteArray dualData("dual");
+ QVERIFY(dualSock.bind(QHostAddress(QHostAddress::Any), 0));
+
+ QUdpSocket v4Sock;
+ QByteArray v4Data("v4");
+ QVERIFY(v4Sock.bind(QHostAddress(QHostAddress::AnyIPv4), 0));
+
+ QUdpSocket v6Sock;
+ QByteArray v6Data("v6");
+ QVERIFY(v6Sock.bind(QHostAddress(QHostAddress::AnyIPv6), 0));
+
+ QHostAddress from;
+ quint16 port;
+ QByteArray buffer;
+ //test v4 -> dual
+ QCOMPARE((int)v4Sock.writeDatagram(v4Data.constData(), v4Data.length(), QHostAddress(QHostAddress::LocalHost), dualSock.localPort()), v4Data.length());
+ QVERIFY(dualSock.waitForReadyRead(5000));
+ buffer.reserve(100);
+ qint64 size = dualSock.readDatagram(buffer.data(), 100, &from, &port);
+ QCOMPARE((int)size, v4Data.length());
+ buffer.resize(size);
+ QCOMPARE(buffer, v4Data);
+
+ //test v6 -> dual
+ QCOMPARE((int)v6Sock.writeDatagram(v6Data.constData(), v6Data.length(), QHostAddress(QHostAddress::LocalHostIPv6), dualSock.localPort()), v6Data.length());
+ QVERIFY(dualSock.waitForReadyRead(5000));
+ buffer.reserve(100);
+ size = dualSock.readDatagram(buffer.data(), 100, &from, &port);
+ QCOMPARE((int)size, v6Data.length());
+ buffer.resize(size);
+ QCOMPARE(buffer, v6Data);
+
+ //test dual -> v4
+ QCOMPARE((int)dualSock.writeDatagram(dualData.constData(), dualData.length(), QHostAddress(QHostAddress::LocalHost), v4Sock.localPort()), dualData.length());
+ QVERIFY(v4Sock.waitForReadyRead(5000));
+ buffer.reserve(100);
+ size = v4Sock.readDatagram(buffer.data(), 100, &from, &port);
+ QCOMPARE((int)size, dualData.length());
+ buffer.resize(size);
+ QCOMPARE(buffer, dualData);
+
+ //test dual -> v6
+ QCOMPARE((int)dualSock.writeDatagram(dualData.constData(), dualData.length(), QHostAddress(QHostAddress::LocalHostIPv6), v6Sock.localPort()), dualData.length());
+ QVERIFY(v6Sock.waitForReadyRead(5000));
+ buffer.reserve(100);
+ size = v6Sock.readDatagram(buffer.data(), 100, &from, &port);
+ QCOMPARE((int)size, dualData.length());
+ buffer.resize(size);
+ QCOMPARE(buffer, dualData);
+
+}
+
void tst_QUdpSocket::empty_readyReadSlot()
{
QTestEventLoop::instance().exitLoop();
@@ -465,7 +524,7 @@ void tst_QUdpSocket::pendingDatagramSize()
QVERIFY2(server.bind(), server.errorString().toLatin1().constData());
QHostAddress serverAddress = QHostAddress::LocalHost;
- if (!(server.localAddress() == QHostAddress::Any || server.localAddress() == QHostAddress::AnyIPv6))
+ if (!(server.localAddress() == QHostAddress::AnyIPv4 || server.localAddress() == QHostAddress::AnyIPv6))
serverAddress = server.localAddress();
QUdpSocket client;
@@ -519,7 +578,7 @@ void tst_QUdpSocket::writeDatagram()
QVERIFY2(server.bind(), server.errorString().toLatin1().constData());
QHostAddress serverAddress = QHostAddress::LocalHost;
- if (!(server.localAddress() == QHostAddress::Any || server.localAddress() == QHostAddress::AnyIPv6))
+ if (!(server.localAddress() == QHostAddress::AnyIPv4 || server.localAddress() == QHostAddress::AnyIPv6))
serverAddress = server.localAddress();
QUdpSocket client;
@@ -592,7 +651,7 @@ void tst_QUdpSocket::performance()
QVERIFY2(server.bind(), server.errorString().toLatin1().constData());
QHostAddress serverAddress = QHostAddress::LocalHost;
- if (!(server.localAddress() == QHostAddress::Any || server.localAddress() == QHostAddress::AnyIPv6))
+ if (!(server.localAddress() == QHostAddress::AnyIPv4 || server.localAddress() == QHostAddress::AnyIPv6))
serverAddress = server.localAddress();
QUdpSocket client;
@@ -1147,7 +1206,7 @@ void tst_QUdpSocket::setMulticastInterface()
void tst_QUdpSocket::multicast_data()
{
- QHostAddress anyAddress = QHostAddress(QHostAddress::Any);
+ QHostAddress anyAddress = QHostAddress(QHostAddress::AnyIPv4);
QHostAddress groupAddress = QHostAddress("239.255.118.62");
QHostAddress any6Address = QHostAddress(QHostAddress::AnyIPv6);
QHostAddress group6Address = QHostAddress("FF01::114");
@@ -1173,8 +1232,12 @@ void tst_QUdpSocket::multicast()
QFETCH(bool, joinResult);
if (setProxy) {
// UDP multicast does not work with proxies
- if ((bindAddress.protocol() == QAbstractSocket::IPv4Protocol && (bindAddress.toIPv4Address() & 0xffff0000) == 0xefff0000)
- || bindAddress.protocol() == QAbstractSocket::IPv6Protocol) {
+ if (
+#ifndef Q_OS_WIN
+ //windows native socket engine binds 0.0.0.0 instead of the requested multicast address
+ (bindAddress.protocol() == QAbstractSocket::IPv4Protocol && (bindAddress.toIPv4Address() & 0xffff0000) == 0xefff0000) ||
+#endif
+ bindAddress.protocol() == QAbstractSocket::IPv6Protocol) {
// proxy cannot bind to IPv6 or multicast addresses
bindResult = false;
}
diff --git a/tests/auto/qwidget/qwidget.pro b/tests/auto/qwidget/qwidget.pro
index dfc35a0157..0024782fff 100644
--- a/tests/auto/qwidget/qwidget.pro
+++ b/tests/auto/qwidget/qwidget.pro
@@ -9,7 +9,7 @@ aix-g++*:QMAKE_CXXFLAGS+=-fpermissive
CONFIG += x11inc
-mac {
+mac:!qpa {
LIBS += -framework Security -framework AppKit -framework Carbon
OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm
}