summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-02-24 00:32:26 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-02-24 00:32:26 (GMT)
commitf95e0d4dee769363a9c84b27f854055b0425e6ec (patch)
treeba3f5902e9f53b116989904b1766187444c6c0f1 /tests
parent6bd74e08ea2d29086ad2a16fef8e9b02c5e5ae5d (diff)
parent56fe1454fe08ec7cc258cbbd38486e721d088c99 (diff)
downloadQt-f95e0d4dee769363a9c84b27f854055b0425e6ec.zip
Qt-f95e0d4dee769363a9c84b27f854055b0425e6ec.tar.gz
Qt-f95e0d4dee769363a9c84b27f854055b0425e6ec.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro4
-rw-r--r--tests/auto/declarative/declarative.pro1
-rw-r--r--tests/auto/declarative/qmlstyledtext/qmlstyledtext.pro9
-rw-r--r--tests/auto/declarative/qmlstyledtext/tst_qmlstyledtext.cpp96
-rw-r--r--tests/auto/qbytearray/tst_qbytearray.cpp13
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp3
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp25
-rw-r--r--tests/auto/symbols/tst_symbols.cpp12
8 files changed, 161 insertions, 2 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 7ba6243..791d23c 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -11,7 +11,6 @@ TEMPLATE = subdirs
maketestselftest \
moc \
uic \
- uic3 \
guiapplauncher \
#atwrapper \ # These tests need significant updating,
#uiloader \ # they have hardcoded machine names etc.
@@ -69,6 +68,9 @@ Q3SUBDIRS += \
q3uridrag \
q3widgetstack
+!cross_compile:Q3SUBDIRS += \
+ uic3
+
SUBDIRS += \
# exceptionsafety_objects \ shouldn't enable it
languagechange \
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index 870c92b..c9b1052 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -58,6 +58,7 @@ SUBDIRS += \
qmlvaluetypes \ # Cover
qmlxmlhttprequest \ # Cover
qmlimageprovider \ # Cover
+ qmlstyledtext \ # Cover
sql # Cover
contains(QT_CONFIG, webkit) {
diff --git a/tests/auto/declarative/qmlstyledtext/qmlstyledtext.pro b/tests/auto/declarative/qmlstyledtext/qmlstyledtext.pro
new file mode 100644
index 0000000..d535835
--- /dev/null
+++ b/tests/auto/declarative/qmlstyledtext/qmlstyledtext.pro
@@ -0,0 +1,9 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+QT += network
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qmlstyledtext.cpp
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
diff --git a/tests/auto/declarative/qmlstyledtext/tst_qmlstyledtext.cpp b/tests/auto/declarative/qmlstyledtext/tst_qmlstyledtext.cpp
new file mode 100644
index 0000000..5e675b1
--- /dev/null
+++ b/tests/auto/declarative/qmlstyledtext/tst_qmlstyledtext.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtGui/QTextLayout>
+#include <private/qmlstyledtext_p.h>
+
+class tst_qmlstyledtext : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlstyledtext()
+ {
+ }
+
+private slots:
+ void textOutput();
+ void textOutput_data();
+};
+
+// For malformed input all we test is that we get the expected text out.
+//
+void tst_qmlstyledtext::textOutput_data()
+{
+ QTest::addColumn<QString>("input");
+ QTest::addColumn<QString>("output");
+
+ QTest::newRow("bold") << "<b>bold</b>" << "bold";
+ QTest::newRow("italic") << "<b>italic</b>" << "italic";
+ QTest::newRow("missing >") << "<b>text</b" << "text";
+ QTest::newRow("missing b>") << "<b>text</" << "text";
+ QTest::newRow("missing /b>") << "<b>text<" << "text";
+ QTest::newRow("missing </b>") << "<b>text" << "text";
+ QTest::newRow("bad nest") << "<b>text <i>italic</b></i>" << "text italic";
+ QTest::newRow("font color") << "<font color=\"red\">red text</font>" << "red text";
+ QTest::newRow("font size") << "<font size=\"1\">text</font>" << "text";
+ QTest::newRow("font empty") << "<font>text</font>" << "text";
+ QTest::newRow("font bad 1") << "<font ezis=\"blah\">text</font>" << "text";
+ QTest::newRow("font bad 2") << "<font size=\"1>text</font>" << "";
+ QTest::newRow("extra close") << "<b>text</b></b>" << "text";
+ QTest::newRow("empty") << "" << "";
+}
+
+void tst_qmlstyledtext::textOutput()
+{
+ QFETCH(QString, input);
+ QFETCH(QString, output);
+
+ QTextLayout layout;
+ QmlStyledText::parse(input, layout);
+
+ QCOMPARE(layout.text(), output);
+}
+
+
+QTEST_MAIN(tst_qmlstyledtext)
+
+#include "tst_qmlstyledtext.moc"
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp
index 5c72c7a..07fdbc3 100644
--- a/tests/auto/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/qbytearray/tst_qbytearray.cpp
@@ -111,6 +111,7 @@ private slots:
void remove();
void replace_data();
void replace();
+ void replaceWithSpecifiedLength();
void indexOf_data();
void indexOf();
void lastIndexOf_data();
@@ -840,6 +841,18 @@ void tst_QByteArray::replace()
QCOMPARE(str2.replace(pos, len, after.data()), expected);
}
+void tst_QByteArray::replaceWithSpecifiedLength()
+{
+ const char after[] = "zxc\0vbnmqwert";
+ int lenAfter = 6;
+ QByteArray ba("abcdefghjk");
+ ba.replace(0,2,after,lenAfter);
+
+ const char _expected[] = "zxc\0vbcdefghjk";
+ QByteArray expected(_expected,sizeof(_expected)-1);
+ QCOMPARE(ba,expected);
+}
+
void tst_QByteArray::indexOf_data()
{
QTest::addColumn<QByteArray>("haystack");
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index d020d8f..66cfeb7 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -44,6 +44,7 @@
#include <QtCore/qpropertyanimation.h>
#include <QtCore/qvariantanimation.h>
#include <QtGui/qwidget.h>
+#include "../../shared/util.h"
//TESTED_CLASS=QPropertyAnimation
//TESTED_FILES=
@@ -1095,7 +1096,7 @@ void tst_QPropertyAnimation::valueChanged()
QTest::qWait(anim.duration() + 100);
- QCOMPARE(anim.state(), QAbstractAnimation::Stopped);
+ QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped);
QCOMPARE(anim.currentTime(), anim.duration());
//let's check that the values go forward
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index e638e287..12686bb 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -191,6 +191,7 @@ private slots:
void increaseReadBufferSize();
void taskQtBug5799ConnectionErrorWaitForConnected();
void taskQtBug5799ConnectionErrorEventLoop();
+ void taskQtBug7054TimeoutErrorResetting();
void invalidProxy_data();
void invalidProxy();
@@ -2236,6 +2237,30 @@ void tst_QTcpSocket::taskQtBug5799ConnectionErrorEventLoop()
QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit());
}
+void tst_QTcpSocket::taskQtBug7054TimeoutErrorResetting()
+{
+ QTcpSocket *socket = newSocket();
+
+ socket->connectToHost(QtNetworkSettings::serverName(), 443);
+ QVERIFY(socket->waitForConnected(5*1000));
+ QVERIFY(socket->error() == QAbstractSocket::UnknownSocketError);
+
+ // We connected to the HTTPS port. Wait two seconds to receive data. We will receive
+ // nothing because we would need to start the SSL handshake
+ QVERIFY(!socket->waitForReadyRead(2*1000));
+ QVERIFY(socket->error() == QAbstractSocket::SocketTimeoutError);
+
+ // Now write some crap to make the server disconnect us. 4 lines are enough.
+ socket->write("a\r\nb\r\nc\r\nd\r\n");
+ socket->waitForBytesWritten(2*1000);
+
+ // we try to waitForReadyRead another time, but this time instead of a timeout we
+ // should get a better error since the server disconnected us
+ QVERIFY(!socket->waitForReadyRead(2*1000));
+ // It must NOT be the SocketTimeoutError that had been set before
+ QVERIFY(socket->error() == QAbstractSocket::RemoteHostClosedError);
+}
+
void tst_QTcpSocket::invalidProxy_data()
{
QTest::addColumn<int>("type");
diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp
index 70abc43..28970eb 100644
--- a/tests/auto/symbols/tst_symbols.cpp
+++ b/tests/auto/symbols/tst_symbols.cpp
@@ -211,6 +211,10 @@ void tst_Symbols::prefix()
<< "winfnt_driver_class"
<< "pshinter_module_class"
<< "psnames_module_class"
+ // C symbols from Qt
+ << "qt_addObject"
+ << "qt_removeObject"
+ << "qt_startup_hook"
;
QHash<QString,QStringList> excusedPrefixes;
@@ -278,6 +282,10 @@ void tst_Symbols::prefix()
<< "cti" // ctiTrampoline and ctiVMThrowTrampoline from the JIT
#ifdef QT_NAMESPACE
<< "QWeb" // Webkit is only 'namespace aware'
+ << "qWeb"
+ << "qt"
+ << "QGraphicsWebView"
+ << "operator"
#endif
;
@@ -330,6 +338,8 @@ void tst_Symbols::prefix()
symbol = symbol.mid(symbol.indexOf(' ') + 1);
}
+ if (symbol.mid(symbol.indexOf(' ')+1).startsWith("std::"))
+ continue;
if (symbol.startsWith("_") || symbol.startsWith("std::"))
continue;
if (symbol.startsWith("vtable ") || symbol.startsWith("VTT for ") ||
@@ -341,6 +351,8 @@ void tst_Symbols::prefix()
continue;
if (symbol.startsWith(ns + "operator"))
continue;
+ if (symbol.startsWith("operator new") || symbol.startsWith("operator delete"))
+ continue;
if (symbol.startsWith("guard variable for "))
continue;
if (symbol.contains("(" + ns + "QTextStream"))