summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp18
-rw-r--r--tests/auto/corelib/json/tst_qtjson.cpp6
-rw-r--r--tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp17
-rw-r--r--tests/auto/network/access/qnetworkreply/BLACKLIST9
-rw-r--r--tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp53
-rw-r--r--tests/auto/other/macplist/BLACKLIST2
-rw-r--r--tests/auto/other/qaccessibility/BLACKLIST2
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST2
-rw-r--r--tests/auto/widgets/itemviews/qcolumnview/BLACKLIST2
-rw-r--r--tests/auto/widgets/itemviews/qtableview/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qfontcombobox/BLACKLIST6
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/BLACKLIST2
-rw-r--r--tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp32
-rw-r--r--tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp38
14 files changed, 188 insertions, 3 deletions
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index ebfab643bd..0e35b28fda 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -242,6 +242,19 @@ public:
int &operator--() { ADD("TestClass1::operator--"); return x; }
int operator--(int) { ADD("TestClass1::operator--"); return 0; }
+ int nested_struct()
+ {
+ struct Nested { void nested() { ADD("TestClass1::nested_struct"); } };
+ Nested().nested();
+ return 0;
+ }
+ int nested_struct_const() const
+ {
+ struct Nested { void nested() { ADD("TestClass1::nested_struct_const"); } };
+ Nested().nested();
+ return 0;
+ }
+
#ifdef Q_COMPILER_REF_QUALIFIERS
int lvalue() & { ADD("TestClass1::lvalue"); return 0; }
int const_lvalue() const & { ADD("TestClass1::const_lvalue"); return 0; }
@@ -308,6 +321,9 @@ public:
operator--();
operator--(0);
+ nested_struct();
+ nested_struct_const();
+
#ifdef Q_COMPILER_REF_QUALIFIERS
lvalue();
const_lvalue();
@@ -678,6 +694,8 @@ void tst_qmessagehandler::cleanupFuncinfo()
// qDebug() << funcinfo.toLatin1();
QByteArray result = qCleanupFuncinfo(funcinfo.toLatin1());
+ QEXPECT_FAIL("TestClass1::nested_struct", "Nested function processing is broken", Continue);
+ QEXPECT_FAIL("TestClass1::nested_struct_const", "Nested function processing is broken", Continue);
QTEST(QString::fromLatin1(result), "expected");
}
#endif
diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp
index ce272cde03..4f73e93177 100644
--- a/tests/auto/corelib/json/tst_qtjson.cpp
+++ b/tests/auto/corelib/json/tst_qtjson.cpp
@@ -2708,9 +2708,9 @@ void tst_QtJson::objectInitializerList()
void tst_QtJson::unicodeKeys()
{
QByteArray json = "{"
- "\"x\u2090_1\": \"hello_1\","
- "\"y\u2090_2\": \"hello_2\","
- "\"T\u2090_3\": \"hello_3\","
+ "\"x\\u2090_1\": \"hello_1\","
+ "\"y\\u2090_2\": \"hello_2\","
+ "\"T\\u2090_3\": \"hello_3\","
"\"xyz_4\": \"hello_4\","
"\"abc_5\": \"hello_5\""
"}";
diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
index a43bb3ee68..f2df2271d9 100644
--- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
+++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp
@@ -435,6 +435,23 @@ void tst_QVersionNumber::assignment()
void tst_QVersionNumber::fromString_data()
{
singleInstanceData();
+
+ const quint64 largerThanIntCanHold = quint64(std::numeric_limits<int>::max()) + 1;
+ const QString largerThanIntCanHoldString0 = QString::number(largerThanIntCanHold) + ".0";
+ const QString largerThanIntCanHoldString1 = "0." + QString::number(largerThanIntCanHold);
+
+ QTest::newRow(qPrintable(largerThanIntCanHoldString0))
+ << QVector<int>() << QVersionNumber() << QString() << largerThanIntCanHoldString0 << 0 << true;
+ QTest::newRow(qPrintable(largerThanIntCanHoldString1))
+ << QVector<int>(0) << QVersionNumber(0) << QStringLiteral("0") << largerThanIntCanHoldString1 << 1 << true;
+
+ const QString largerThanULongLongCanHoldString0 = QString::number(std::numeric_limits<qulonglong>::max()) + "0.0"; // 10x ULLONG_MAX
+ const QString largerThanULongLongCanHoldString1 = "0." + QString::number(std::numeric_limits<qulonglong>::max()) + '0'; // 10x ULLONG_MAX
+
+ QTest::newRow(qPrintable(largerThanULongLongCanHoldString0))
+ << QVector<int>() << QVersionNumber() << QString() << largerThanULongLongCanHoldString0 << 0 << true;
+ QTest::newRow(qPrintable(largerThanULongLongCanHoldString1))
+ << QVector<int>(0) << QVersionNumber(0) << QStringLiteral("0") << largerThanULongLongCanHoldString1 << 1 << true;
}
void tst_QVersionNumber::fromString()
diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST
new file mode 100644
index 0000000000..fbd72492d8
--- /dev/null
+++ b/tests/auto/network/access/qnetworkreply/BLACKLIST
@@ -0,0 +1,9 @@
+[ioGetFromBuiltinHttp:http+limited]
+osx
+[ioGetFromBuiltinHttp:https+limited]
+osx
+[synchronousRequest:https]
+osx
+[SslHandshakeFailedError]
+osx
+[httpAbort]
diff --git a/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp b/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp
index 28e7c30544..5b314e4e77 100644
--- a/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp
+++ b/tests/auto/network/socket/qabstractsocket/tst_qabstractsocket.cpp
@@ -45,6 +45,11 @@
#include <qcoreapplication.h>
#include <qdebug.h>
#include <qabstractsocket.h>
+#include <qtcpserver.h>
+#include <qtcpsocket.h>
+#ifndef QT_NO_SSL
+#include <qsslsocket.h>
+#endif
class tst_QAbstractSocket : public QObject
{
@@ -55,7 +60,9 @@ public:
virtual ~tst_QAbstractSocket();
private slots:
+ void initTestCase();
void getSetCheck();
+ void serverDisconnectWithBuffered();
};
tst_QAbstractSocket::tst_QAbstractSocket()
@@ -74,6 +81,11 @@ public:
void setPeerPort(quint16 port) { QAbstractSocket::setPeerPort(port); }
};
+void tst_QAbstractSocket::initTestCase()
+{
+ qRegisterMetaType<QAbstractSocket::SocketState>("QAbstractSocket::SocketState");
+}
+
// Testing get/set functions
void tst_QAbstractSocket::getSetCheck()
{
@@ -102,5 +114,46 @@ void tst_QAbstractSocket::getSetCheck()
QCOMPARE(quint16(0xffff), obj1.peerPort());
}
+// Test buffered socket being properly closed on remote disconnect
+void tst_QAbstractSocket::serverDisconnectWithBuffered()
+{
+ QTcpServer tcpServer;
+#ifndef QT_NO_SSL
+ QSslSocket testSocket;
+#else
+ QTcpSocket testSocket;
+#endif
+
+ QVERIFY(tcpServer.listen(QHostAddress::LocalHost));
+ testSocket.connectToHost(tcpServer.serverAddress(), tcpServer.serverPort());
+ // Accept connection on server side
+ QVERIFY(tcpServer.waitForNewConnection(5000));
+ QTcpSocket *newConnection = tcpServer.nextPendingConnection();
+ // Send one char and drop link
+ QVERIFY(newConnection != NULL);
+ QVERIFY(newConnection->putChar(0));
+ QVERIFY(newConnection->flush());
+ delete newConnection;
+
+ QVERIFY(testSocket.waitForConnected(5000)); // ready for write
+ QVERIFY(testSocket.state() == QAbstractSocket::ConnectedState);
+
+ QSignalSpy spyStateChanged(&testSocket, SIGNAL(stateChanged(QAbstractSocket::SocketState)));
+ QSignalSpy spyDisconnected(&testSocket, SIGNAL(disconnected()));
+
+ QVERIFY(testSocket.waitForReadyRead(5000)); // have one char already in internal buffer
+ char buf[128];
+ QCOMPARE(testSocket.read(buf, sizeof(buf)), Q_INT64_C(1));
+ if (testSocket.state() != QAbstractSocket::UnconnectedState) {
+ QVERIFY(testSocket.waitForDisconnected(5000));
+ QVERIFY(testSocket.state() == QAbstractSocket::UnconnectedState);
+ }
+ // Test signal emitting
+ QVERIFY(spyDisconnected.count() == 1);
+ QVERIFY(spyStateChanged.count() > 0);
+ QVERIFY(qvariant_cast<QAbstractSocket::SocketState>(spyStateChanged.last().first())
+ == QAbstractSocket::UnconnectedState);
+}
+
QTEST_MAIN(tst_QAbstractSocket)
#include "tst_qabstractsocket.moc"
diff --git a/tests/auto/other/macplist/BLACKLIST b/tests/auto/other/macplist/BLACKLIST
new file mode 100644
index 0000000000..83ed55936e
--- /dev/null
+++ b/tests/auto/other/macplist/BLACKLIST
@@ -0,0 +1,2 @@
+[test_plist:LSUIElement-as-garbage]
+osx
diff --git a/tests/auto/other/qaccessibility/BLACKLIST b/tests/auto/other/qaccessibility/BLACKLIST
new file mode 100644
index 0000000000..11598aece6
--- /dev/null
+++ b/tests/auto/other/qaccessibility/BLACKLIST
@@ -0,0 +1,2 @@
+[abstractScrollAreaTest]
+osx
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST b/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST
new file mode 100644
index 0000000000..edaa450731
--- /dev/null
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/BLACKLIST
@@ -0,0 +1,2 @@
+[sorting]
+osx
diff --git a/tests/auto/widgets/itemviews/qcolumnview/BLACKLIST b/tests/auto/widgets/itemviews/qcolumnview/BLACKLIST
new file mode 100644
index 0000000000..bda01c700c
--- /dev/null
+++ b/tests/auto/widgets/itemviews/qcolumnview/BLACKLIST
@@ -0,0 +1,2 @@
+[scrollTo:reverse]
+osx
diff --git a/tests/auto/widgets/itemviews/qtableview/BLACKLIST b/tests/auto/widgets/itemviews/qtableview/BLACKLIST
new file mode 100644
index 0000000000..fc231a4e30
--- /dev/null
+++ b/tests/auto/widgets/itemviews/qtableview/BLACKLIST
@@ -0,0 +1,2 @@
+[moveCursorBiggerJump]
+osx
diff --git a/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST b/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST
new file mode 100644
index 0000000000..8bd4caad31
--- /dev/null
+++ b/tests/auto/widgets/widgets/qfontcombobox/BLACKLIST
@@ -0,0 +1,6 @@
+[currentFont]
+osx
+[fontFilters]
+osx
+[writingSystem]
+osx
diff --git a/tests/auto/widgets/widgets/qmdiarea/BLACKLIST b/tests/auto/widgets/widgets/qmdiarea/BLACKLIST
new file mode 100644
index 0000000000..b8640e9ac3
--- /dev/null
+++ b/tests/auto/widgets/widgets/qmdiarea/BLACKLIST
@@ -0,0 +1,2 @@
+[updateScrollBars]
+osx
diff --git a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
index 350ae23d8a..ac76c44b9b 100644
--- a/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
+++ b/tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
@@ -82,6 +82,12 @@ public:
{
return QSpinBox::valueFromText(text);
}
+#ifndef QT_NO_WHEELEVENT
+ void wheelEvent(QWheelEvent *event)
+ {
+ QSpinBox::wheelEvent(event);
+ }
+#endif
QLineEdit *lineEdit() const { return QSpinBox::lineEdit(); }
};
@@ -148,6 +154,8 @@ private slots:
void setGroupSeparatorShown_data();
void setGroupSeparatorShown();
+ void wheelEvents();
+
public slots:
void valueChangedHelper(const QString &);
void valueChangedHelper(int);
@@ -1190,5 +1198,29 @@ void tst_QSpinBox::setGroupSeparatorShown()
QCOMPARE(spinBox.value()+1000, 33000);
}
+void tst_QSpinBox::wheelEvents()
+{
+#ifndef QT_NO_WHEELEVENT
+ SpinBox spinBox;
+ spinBox.setRange(-20, 20);
+ spinBox.setValue(0);
+
+ QWheelEvent wheelUp(QPointF(), QPointF(), QPoint(), QPoint(0, 120), 120, Qt::Vertical, Qt::NoButton, Qt::NoModifier);
+ spinBox.wheelEvent(&wheelUp);
+ QCOMPARE(spinBox.value(), 1);
+
+ QWheelEvent wheelDown(QPointF(), QPointF(), QPoint(), QPoint(0, -120), -120, Qt::Vertical, Qt::NoButton, Qt::NoModifier);
+ spinBox.wheelEvent(&wheelDown);
+ spinBox.wheelEvent(&wheelDown);
+ QCOMPARE(spinBox.value(), -1);
+
+ QWheelEvent wheelHalfUp(QPointF(), QPointF(), QPoint(), QPoint(0, 60), 60, Qt::Vertical, Qt::NoButton, Qt::NoModifier);
+ spinBox.wheelEvent(&wheelHalfUp);
+ QCOMPARE(spinBox.value(), -1);
+ spinBox.wheelEvent(&wheelHalfUp);
+ QCOMPARE(spinBox.value(), 0);
+#endif
+}
+
QTEST_MAIN(tst_QSpinBox)
#include "tst_qspinbox.moc"
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
index fbd8b46466..ea27405fb3 100644
--- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp
@@ -211,6 +211,10 @@ private slots:
void findWithRegExpReturnsFalseIfNoMoreResults();
#endif
+#ifndef QT_NO_WHEELEVENT
+ void wheelEvent();
+#endif
+
private:
void createSelection();
int blockCount() const;
@@ -2564,5 +2568,39 @@ void tst_QTextEdit::findWithRegExpReturnsFalseIfNoMoreResults()
}
#endif
+#ifndef QT_NO_WHEELEVENT
+
+class TextEdit : public QTextEdit
+{
+public:
+ TextEdit(QWidget *parent = 0)
+ : QTextEdit(parent)
+ {}
+ void wheelEvent(QWheelEvent *event)
+ {
+ QTextEdit::wheelEvent(event);
+ }
+};
+
+void tst_QTextEdit::wheelEvent()
+{
+ TextEdit ed(0);
+ ed.setPlainText(QStringLiteral("Line\nLine\nLine\n"));
+ ed.setReadOnly(true);
+
+ float defaultFontSize = ed.font().pointSizeF();
+ QWheelEvent wheelUp(QPointF(), QPointF(), QPoint(), QPoint(0, 120), 120, Qt::Vertical, Qt::NoButton, Qt::ControlModifier);
+ ed.wheelEvent(&wheelUp);
+
+ QCOMPARE(defaultFontSize + 1, ed.font().pointSizeF());
+
+ QWheelEvent wheelHalfDown(QPointF(), QPointF(), QPoint(), QPoint(0, -60), -60, Qt::Vertical, Qt::NoButton, Qt::ControlModifier);
+ ed.wheelEvent(&wheelHalfDown);
+
+ QCOMPARE(defaultFontSize + 0.5, ed.font().pointSizeF());
+}
+
+#endif
+
QTEST_MAIN(tst_QTextEdit)
#include "tst_qtextedit.moc"