summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-06-04 17:24:49 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-06-04 17:24:49 (GMT)
commit5c17f3abe1c43539db613da78414bc0b27928814 (patch)
treeaeda95c710a5dd597d4e45a94f57729f0dc1a6dc /tests
parentb70c535fb096652def0c4f6df6f9cd2827fa9c97 (diff)
parent398c022e8adefc6e71a6048da40c19f6169be831 (diff)
downloadQt-5c17f3abe1c43539db613da78414bc0b27928814.zip
Qt-5c17f3abe1c43539db613da78414bc0b27928814.tar.gz
Qt-5c17f3abe1c43539db613da78414bc0b27928814.tar.bz2
Merge commit 'origin/4.5'
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/_networkselftest/tst_networkselftest.cpp2
-rw-r--r--tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp25
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp14
-rw-r--r--tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp4
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp26
-rw-r--r--tests/auto/qprogressbar/tst_qprogressbar.cpp20
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp15
7 files changed, 93 insertions, 13 deletions
diff --git a/tests/auto/_networkselftest/tst_networkselftest.cpp b/tests/auto/_networkselftest/tst_networkselftest.cpp
index dab4433..0fa001a 100644
--- a/tests/auto/_networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/_networkselftest/tst_networkselftest.cpp
@@ -463,7 +463,7 @@ void tst_NetworkSelfTest::httpsServer()
<< Chat::expect("200 ")
<< Chat::DiscardUntilDisconnect);
#else
- QSKIP("SSL not enabled, cannot test");
+ QSKIP("SSL not enabled, cannot test", SkipAll);
#endif
}
diff --git a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
index ad1a1b8..58bfabc 100644
--- a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
+++ b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
@@ -84,6 +84,8 @@ private slots:
void sendArgument_data();
void sendArgument();
+ void sendErrors();
+
private:
QProcess proc;
};
@@ -782,5 +784,28 @@ void tst_QDBusMarshall::sendArgument()
QCOMPARE(extracted, value);
}
+void tst_QDBusMarshall::sendErrors()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+
+ QVERIFY(con.isConnected());
+ QDBusMessage msg = QDBusMessage::createSignal("/foo", "local.interfaceName",
+ "signalName");
+ msg << qVariantFromValue(QDBusObjectPath());
+
+ QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\"");
+ QVERIFY(!con.send(msg));
+
+ msg.setArguments(QVariantList());
+ QDBusObjectPath path;
+
+ QTest::ignoreMessage(QtWarningMsg, "QDBusObjectPath: invalid path \"abc\"");
+ path.setPath("abc");
+ msg << qVariantFromValue(path);
+
+ QTest::ignoreMessage(QtWarningMsg, "QDBusConnection: error: could not send signal path \"/foo\" interface \"local.interfaceName\" member \"signalName\"");
+ QVERIFY(!con.send(msg));
+}
+
QTEST_MAIN(tst_QDBusMarshall)
#include "tst_qdbusmarshall.moc"
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index 785eab0..ac26075 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -115,8 +115,6 @@ tst_QLocalSocket::tst_QLocalSocket()
#endif
))
qWarning() << "lackey executable doesn't exists!";
-
- QLocalServer::removeServer("tst_localsocket");
}
tst_QLocalSocket::~tst_QLocalSocket()
@@ -141,7 +139,13 @@ public:
LocalServer() : QLocalServer()
{
connect(this, SIGNAL(newConnection()), this, SLOT(slotNewConnection()));
- };
+ }
+
+ bool listen(const QString &name)
+ {
+ removeServer(name);
+ return QLocalServer::listen(name);
+ }
QList<int> hits;
@@ -530,7 +534,7 @@ void tst_QLocalSocket::sendData()
// QLocalSocket/Server can take a name or path, check that it works as expected
void tst_QLocalSocket::fullPath()
{
- QLocalServer server;
+ LocalServer server;
QString name = "qlocalsocket_pathtest";
#if defined(QT_LOCALSOCKET_TCP)
QString path = "QLocalServer";
@@ -824,7 +828,7 @@ void tst_QLocalSocket::removeServer()
void tst_QLocalSocket::recycleServer()
{
- QLocalServer server;
+ LocalServer server;
QLocalSocket client;
QVERIFY(server.listen("recycletest1"));
diff --git a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
index 2383767..2f6180f 100644
--- a/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
+++ b/tests/auto/qnetworkdiskcache/tst_qnetworkdiskcache.cpp
@@ -76,7 +76,7 @@ private slots:
void oldCacheVersionFile_data();
void oldCacheVersionFile();
-
+
void sync();
};
@@ -486,7 +486,7 @@ public:
void run()
{
QByteArray longString = "Hello World, this is some long string, well not really that long";
- for (int i = 0; i < 10; ++i)
+ for (int j = 0; j < 10; ++j)
longString += longString;
QByteArray longString2 = "Help, I am stuck in an autotest!";
QUrl url(EXAMPLE_URL);
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index af0f6cf..c0f9935 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -215,6 +215,7 @@ private slots:
void imageCoordinateLimit();
void imageBlending_data();
void imageBlending();
+ void imageBlending_clipped();
void paintOnNullPixmap();
void checkCompositionMode();
@@ -3793,6 +3794,31 @@ void tst_QPainter::imageBlending()
}
}
+void tst_QPainter::imageBlending_clipped()
+{
+ QImage src(20, 20, QImage::Format_RGB16);
+ QPainter p(&src);
+ p.fillRect(src.rect(), Qt::red);
+ p.end();
+
+ QImage dst(40, 20, QImage::Format_RGB16);
+ p.begin(&dst);
+ p.fillRect(dst.rect(), Qt::white);
+ p.end();
+
+ QImage expected = dst;
+
+ p.begin(&dst);
+ p.setClipRect(QRect(23, 0, 20, 20));
+
+ // should be completely clipped
+ p.drawImage(QRectF(3, 0, 20, 20), src);
+ p.end();
+
+ // dst should be left unchanged
+ QCOMPARE(dst, expected);
+}
+
void tst_QPainter::paintOnNullPixmap()
{
QPixmap pix(16, 16);
diff --git a/tests/auto/qprogressbar/tst_qprogressbar.cpp b/tests/auto/qprogressbar/tst_qprogressbar.cpp
index d6379d3..cb037e0 100644
--- a/tests/auto/qprogressbar/tst_qprogressbar.cpp
+++ b/tests/auto/qprogressbar/tst_qprogressbar.cpp
@@ -63,6 +63,7 @@ private slots:
void setValueRepaint();
void sizeHint();
+ void task245201_testChangeStyleAndDelete_data();
void task245201_testChangeStyleAndDelete();
};
@@ -224,15 +225,30 @@ void tst_QProgressBar::sizeHint()
QCOMPARE(barSize.height(), size.height());
}
+void tst_QProgressBar::task245201_testChangeStyleAndDelete_data()
+{
+ QTest::addColumn<QString>("style1_str");
+ QTest::addColumn<QString>("style2_str");
+
+ QTest::newRow("plastique-windows") << QString::fromLatin1("plastique") << QString::fromLatin1("windows");
+ QTest::newRow("mlotif-windows") << QString::fromLatin1("motif") << QString::fromLatin1("windows");
+ QTest::newRow("cleanlooks-cde") << QString::fromLatin1("cleanlooks") << QString::fromLatin1("cde");
+ QTest::newRow("gtk-plastique") << QString::fromLatin1("gtk") << QString::fromLatin1("plastique");
+}
+
void tst_QProgressBar::task245201_testChangeStyleAndDelete()
{
+ QFETCH(QString, style1_str);
+ QFETCH(QString, style2_str);
+
QProgressBar *bar = new QProgressBar;
- QStyle *style = QStyleFactory::create("plastique");
+ QStyle *style = QStyleFactory::create(style1_str);
bar->setStyle(style);
bar->show();
- QStyle *style2 = QStyleFactory::create("windows");
+ QStyle *style2 = QStyleFactory::create(style2_str);
bar->setStyle(style2);
+ QTest::qWait(10);
delete bar;
QTest::qWait(100); //should not crash
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index 22f9557..97c409b 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -1540,7 +1540,7 @@ void tst_QTextCodec::utfHeaders_data()
<< QByteArray("\xef\xbb\xbfhello")
<< (QString(QChar(0xfeff)) + QString::fromLatin1("hello"))
<< true;
- QTest::newRow("utf8 nobom")
+ QTest::newRow("utf8 nobom ignore header")
<< QByteArray("UTF-8")
<< (int)QTextCodec::IgnoreHeader
<< QByteArray("hello")
@@ -1721,14 +1721,23 @@ void tst_QTextCodec::utfHeaders()
QFETCH(bool, toUnicode);
+ QLatin1String ignoreReverseTestOn = (QSysInfo::ByteOrder == QSysInfo::BigEndian) ? QLatin1String(" le") : QLatin1String(" be");
+ QString rowName(QTest::currentDataTag());
+
for (int i = 0; i < encoded.length(); ++i)
qDebug() << hex << " " << (uint)(uchar)encoded.at(i);
if (toUnicode) {
QString result = codec->toUnicode(encoded.constData(), encoded.length(), &state);
- for (int i = 0; i < result.length(); ++i)
- qDebug() << hex << " " << (uint)result.at(i).unicode();
+ for (int i = 0; i < result.length(); ++i)
+ qDebug() << hex << " " << (uint)result.at(i).unicode();
QCOMPARE(result.length(), unicode.length());
QCOMPARE(result, unicode);
+
+ if (!rowName.endsWith("nobom") && !rowName.contains(ignoreReverseTestOn)) {
+ QTextCodec::ConverterState state2(cFlags);
+ QByteArray reencoded = codec->fromUnicode(unicode.unicode(), unicode.length(), &state2);
+ QCOMPARE(reencoded, encoded);
+ }
} else {
QByteArray result = codec->fromUnicode(unicode.unicode(), unicode.length(), &state);
QCOMPARE(result, encoded);