diff options
author | Water-Team <water@pad.test.qt.nokia.com> | 2011-10-17 23:00:33 (GMT) |
---|---|---|
committer | Water-Team <water@pad.test.qt.nokia.com> | 2011-10-17 23:00:33 (GMT) |
commit | 923693d4919f22eabd5cec8fb6e855514bb64fb7 (patch) | |
tree | ce5c6ec3f89b9bef3684c748bc4bc39af0d53a9a /tests | |
parent | ec9a31abf003880a60d1120738a3bee7075b8ca8 (diff) | |
parent | 09e7218a1c30ca33a5d82280f89f07ba54b96555 (diff) | |
download | Qt-923693d4919f22eabd5cec8fb6e855514bb64fb7.zip Qt-923693d4919f22eabd5cec8fb6e855514bb64fb7.tar.gz Qt-923693d4919f22eabd5cec8fb6e855514bb64fb7.tar.bz2 |
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro | 2 | ||||
-rw-r--r-- | tests/auto/qobjectrace/tst_qobjectrace.cpp | 12 | ||||
-rw-r--r-- | tests/auto/qpluginloader/tst_qpluginloader.cpp | 29 | ||||
-rw-r--r-- | tests/auto/qtextbrowser/tst_qtextbrowser.cpp | 24 | ||||
-rw-r--r-- | tests/auto/qxmlquery/tst_qxmlquery.cpp | 20 | ||||
-rw-r--r-- | tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd | 37 | ||||
-rw-r--r-- | tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp | 5 | ||||
-rw-r--r-- | tests/benchmarks/corelib/tools/qline/main.cpp | 157 | ||||
-rw-r--r-- | tests/benchmarks/corelib/tools/qline/qline.pro | 12 | ||||
-rw-r--r-- | tests/benchmarks/corelib/tools/tools.pro | 1 |
10 files changed, 265 insertions, 34 deletions
diff --git a/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro b/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro index b8f509d..90a99c0 100644 --- a/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro +++ b/tests/auto/qabstractxmlnodemodel/qabstractxmlnodemodel.pro @@ -6,7 +6,7 @@ HEADERS += TestNodeModel.h LoadingModel.h include (../xmlpatterns.pri) -wince*: { +wince*|symbian: { addFiles.files = tree.xml addFiles.path = . diff --git a/tests/auto/qobjectrace/tst_qobjectrace.cpp b/tests/auto/qobjectrace/tst_qobjectrace.cpp index 1f52aec..f9ec6ce 100644 --- a/tests/auto/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/qobjectrace/tst_qobjectrace.cpp @@ -139,11 +139,6 @@ private slots: void tst_QObjectRace::moveToThreadRace() { -#if defined(Q_OS_SYMBIAN) - // ### FIXME: task 257411 - remove xfail once this is fixed - QEXPECT_FAIL("", "Symbian event dispatcher can't handle this kind of race, see task: 257411", Abort); - QVERIFY(false); -#endif RaceObject *object = new RaceObject; enum { ThreadCount = 6 }; @@ -229,13 +224,6 @@ public: void tst_QObjectRace::destroyRace() { -#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) - // ### FIXME: task 257411 - remove xfail once this is fixed. - // Oddly enough, this seems to work properly in HW, if given enough time and memory. - QEXPECT_FAIL("", "Symbian event dispatcher can't handle this kind of race on emulator, see task: 257411", Abort); - QVERIFY(false); -#endif - enum { ThreadCount = 10, ObjectCountPerThread = 733, ObjectCount = ThreadCount * ObjectCountPerThread }; diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp index d2d92a5..152d1f4 100644 --- a/tests/auto/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp @@ -272,10 +272,10 @@ void tst_QPluginLoader::loadHints() void tst_QPluginLoader::deleteinstanceOnUnload() { - for (int pass = 0; pass < 2; ++pass) { + for (int pass = 0; pass < 4; ++pass) { QPluginLoader loader1; loader1.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin - if (pass == 0) + if (pass < 2) loader1.load(); // not recommended, instance() should do the job. PluginInterface *instance1 = qobject_cast<PluginInterface*>(loader1.instance()); QVERIFY(instance1); @@ -283,21 +283,32 @@ void tst_QPluginLoader::deleteinstanceOnUnload() QPluginLoader loader2; loader2.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin - if (pass == 0) + if (pass < 2) loader2.load(); // not recommended, instance() should do the job. PluginInterface *instance2 = qobject_cast<PluginInterface*>(loader2.instance()); QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok")); QSignalSpy spy1(loader1.instance(), SIGNAL(destroyed())); QSignalSpy spy2(loader2.instance(), SIGNAL(destroyed())); - if (pass == 0) { - QCOMPARE(loader2.unload(), false); // refcount not reached 0, not really unloaded - QCOMPARE(spy1.count(), 0); - QCOMPARE(spy2.count(), 0); - } + + // refcount not reached 0, not really unloaded + if (pass % 2) + QCOMPARE(loader1.unload(), false); + else + QCOMPARE(loader2.unload(), false); + + QCOMPARE(spy1.count(), 0); + QCOMPARE(spy2.count(), 0); + QCOMPARE(instance1->pluginName(), QLatin1String("Plugin ok")); QCOMPARE(instance2->pluginName(), QLatin1String("Plugin ok")); - QVERIFY(loader1.unload()); // refcount reached 0, did really unload + + // refcount reached 0, did really unload + if (pass % 2) + QVERIFY(loader2.unload()); + else + QVERIFY(loader1.unload()); + QCOMPARE(spy1.count(), 1); QCOMPARE(spy2.count(), 1); } diff --git a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp index f36b335..4489daa 100644 --- a/tests/auto/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/qtextbrowser/tst_qtextbrowser.cpp @@ -146,7 +146,7 @@ void tst_QTextBrowser::cleanup() void tst_QTextBrowser::noReloadOnAnchorJump() { - QUrl url("anchor.html"); + QUrl url("file:anchor.html"); browser->htmlLoadAttempts = 0; browser->setSource(url); @@ -162,7 +162,7 @@ void tst_QTextBrowser::noReloadOnAnchorJump() void tst_QTextBrowser::bgColorOnSourceChange() { - browser->setSource(QUrl("pagewithbg.html")); + browser->setSource(QUrl("file:pagewithbg.html")); QVERIFY(browser->document()->rootFrame()->frameFormat().hasProperty(QTextFormat::BackgroundBrush)); QVERIFY(browser->document()->rootFrame()->frameFormat().background().color() == Qt::blue); @@ -179,7 +179,7 @@ void tst_QTextBrowser::forwardButton() QVERIFY(browser->historyTitle(0).isEmpty()); QVERIFY(browser->historyTitle(1).isEmpty()); - browser->setSource(QUrl("pagewithbg.html")); + browser->setSource(QUrl("file:pagewithbg.html")); QVERIFY(!forwardEmissions.isEmpty()); QVariant val = forwardEmissions.takeLast()[0]; @@ -192,7 +192,7 @@ void tst_QTextBrowser::forwardButton() QVERIFY(val.toBool() == false); QVERIFY(browser->historyTitle(-1).isEmpty()); - QCOMPARE(browser->historyUrl(0), QUrl("pagewithbg.html")); + QCOMPARE(browser->historyUrl(0), QUrl("file:pagewithbg.html")); QCOMPARE(browser->documentTitle(), QString("Page With BG")); QCOMPARE(browser->historyTitle(0), QString("Page With BG")); QVERIFY(browser->historyTitle(1).isEmpty()); @@ -244,7 +244,7 @@ void tst_QTextBrowser::forwardButton() void tst_QTextBrowser::viewportPositionInHistory() { - browser->setSource(QUrl("bigpage.html")); + browser->setSource(QUrl("file:bigpage.html")); browser->scrollToAnchor("bottom"); QVERIFY(browser->verticalScrollBar()->value() > 0); @@ -283,7 +283,7 @@ void tst_QTextBrowser::relativeLinks() void tst_QTextBrowser::anchors() { - browser->setSource(QUrl("bigpage.html")); + browser->setSource(QUrl("file:bigpage.html")); browser->setSource(QUrl("#bottom")); QVERIFY(browser->verticalScrollBar()->value() > 0); @@ -306,7 +306,7 @@ void tst_QTextBrowser::forwardBackwardAvailable() QVERIFY(!browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); - browser->setSource(QUrl("anchor.html")); + browser->setSource(QUrl("file:anchor.html")); QVERIFY(!browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); QCOMPARE(backwardSpy.count(), 1); @@ -406,7 +406,7 @@ void tst_QTextBrowser::clearHistory() backwardSpy.clear(); forwardSpy.clear(); - browser->setSource(QUrl("anchor.html")); + browser->setSource(QUrl("file:anchor.html")); QVERIFY(!browser->isBackwardAvailable()); QVERIFY(!browser->isForwardAvailable()); QCOMPARE(backwardSpy.count(), 1); @@ -447,7 +447,7 @@ void tst_QTextBrowser::clearHistory() void tst_QTextBrowser::sourceInsideLoadResource() { - QUrl url("pagewithimage.html"); + QUrl url("file:pagewithimage.html"); browser->setSource(url); QCOMPARE(browser->lastResource.toString(), QUrl::fromLocalFile(QDir::current().filePath("foobar.png")).toString()); QEXPECT_FAIL("", "This is currently not supported", Continue); @@ -532,7 +532,7 @@ void tst_QTextBrowser::adjacentAnchors() void tst_QTextBrowser::loadResourceOnRelativeLocalFiles() { - browser->setSource(QUrl("subdir/index.html")); + browser->setSource(QUrl("file:subdir/index.html")); QVERIFY(!browser->toPlainText().isEmpty()); QVariant v = browser->loadResource(QTextDocument::HtmlResource, QUrl("../anchor.html")); QVERIFY(v.isValid()); @@ -543,7 +543,7 @@ void tst_QTextBrowser::loadResourceOnRelativeLocalFiles() void tst_QTextBrowser::focusIndicator() { HackBrowser *browser = new HackBrowser; - browser->setSource(QUrl("firstpage.html")); + browser->setSource(QUrl("file:firstpage.html")); QVERIFY(!browser->textCursor().hasSelection()); browser->focusTheNextChild(); @@ -595,7 +595,7 @@ void tst_QTextBrowser::focusIndicator() void tst_QTextBrowser::focusHistory() { HackBrowser *browser = new HackBrowser; - browser->setSource(QUrl("firstpage.html")); + browser->setSource(QUrl("file:firstpage.html")); QVERIFY(!browser->textCursor().hasSelection()); browser->focusTheNextChild(); diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index e443720..51bb88e 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -167,6 +167,7 @@ private Q_SLOTS: void setFocusQString() const; void setFocusQStringFailure() const; void setFocusQStringSignature() const; + void setFocusQStringFailureAfterSucces() const; void recompilationWithEvaluateToResultFailing() const; void secondEvaluationWithEvaluateToResultFailing() const; void recompilationWithEvaluateToReceiver() const; @@ -1976,6 +1977,25 @@ void tst_QXmlQuery::setFocusQStringSignature() const static_cast<bool>(query.setFocus(QString())); } +void tst_QXmlQuery::setFocusQStringFailureAfterSucces() const +{ + /* Test for QTBUG-18050. First call setFocus with a valid string, + * and then with an invalid string. evaluateTo should not crash. */ + QXmlQuery query; + MessageSilencer silencer; + query.setMessageHandler(&silencer); + + QVERIFY(query.setFocus(QLatin1String("<test>valid-input</test>"))); + QVERIFY(!query.setFocus(QLatin1String("invalid-input"))); + + query.setQuery("/query"); + + QString output; + /* Last setFocus was with an invalid string, so evaluateTo should return + * false */ + QVERIFY(!query.evaluateTo(&output)); +} + void tst_QXmlQuery::setFocusQIODeviceTriggerWarnings() const { /* A null pointer. */ diff --git a/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd b/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd new file mode 100644 index 0000000..532efcb --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/schema-with-restrictions.xsd @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <xsd:annotation> + <xsd:documentation xml:lang="en"> + Test for QTBUG-21375: xmlpatternsvalidator does not allow for non-numeric literals in xsd:double attributes + </xsd:documentation> + </xsd:annotation> + + <xsd:element name="test1" type="TestType1" /> + <xsd:element name="test2" type="TestType2" /> + <xsd:element name="test3" type="TestType3" /> + + <xsd:complexType name="TestType1"> + <xsd:attribute name="attribute1" type="DoubleWithRestrictions" default="INF" /> + </xsd:complexType> + + <xsd:complexType name="TestType2"> + <xsd:attribute name="attribute2" type="DoubleWithRestrictions" default="-INF" /> + </xsd:complexType> + + <xsd:complexType name="TestType3"> + <xsd:attribute name="attribute3" type="DoubleWithRestrictions" default="NaN" /> + </xsd:complexType> + + <xsd:simpleType name="DoubleWithRestrictions"> + <xsd:union> + <xsd:simpleType> + <xsd:restriction base="xsd:double"> + <xsd:enumeration value="-INF" /> + <xsd:enumeration value="INF" /> + <xsd:enumeration value="NaN" /> + </xsd:restriction> + </xsd:simpleType> + </xsd:union> + </xsd:simpleType> + +</xsd:schema> diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp index 817ea1a..60c1fe8 100644 --- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -222,6 +222,11 @@ void tst_XmlPatternsValidator::xsdSupport_data() const << (QStringList() << QLatin1String("files/dateTime-with-microseconds.xml") << QLatin1String("files/dateTime-with-microseconds.xsd")) << QString(); + + QTest::newRow("QTBUG-21375 A schema with a xs:double based simple type with non-numeric restrictions") + << 0 + << (QStringList() << QLatin1String("files/schema-with-restrictions.xsd")) + << QString(); } QTEST_MAIN(tst_XmlPatternsValidator) diff --git a/tests/benchmarks/corelib/tools/qline/main.cpp b/tests/benchmarks/corelib/tools/qline/main.cpp new file mode 100644 index 0000000..d7f93ba --- /dev/null +++ b/tests/benchmarks/corelib/tools/qline/main.cpp @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** Copyright (C) 2011 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$ +** GNU Lesser General Public License Usage +** 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. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ +// This file contains benchmarks for QLineF functions. + +#include <QDebug> +#include <qtest.h> +#include <QLine> + +class tst_qline : public QObject +{ + Q_OBJECT +private slots: + void fromPolar(); + void intersect_data(); + void intersect(); + void length(); + void setLength(); + void angle(); + void setAngle(); + void angleTo(); + void unitVector(); + void normalVector(); + void angle2(); +}; + +void tst_qline::fromPolar() +{ + QBENCHMARK { + QLineF::fromPolar(10, 2); + } +} + +void tst_qline::intersect_data() +{ + QTest::addColumn<QLineF>("l1"); + QTest::addColumn<QLineF>("l2"); + QTest::newRow("cross") << QLineF(-1,-1,1,1) << QLineF(-1,1,1,-1); + QTest::newRow("miss") << QLineF(1,1,2,2) << QLineF(1,11,2,12); +} + +void tst_qline::intersect() +{ + QFETCH(QLineF, l1); + QFETCH(QLineF, l2); + QPointF intersection; + QBENCHMARK { + l1.intersect(l2, &intersection); + } +} + +void tst_qline::length() +{ + QLineF line(1,2,3,4); + QBENCHMARK { + line.length(); + } +} + +void tst_qline::setLength() +{ + QLineF line(1,2,3,4); + QBENCHMARK { + line.setLength(5); + } +} + +void tst_qline::angle() +{ + QLineF line(1,2,3,4); + QBENCHMARK { + line.angle(); + } +} + +void tst_qline::setAngle() +{ + QLineF line(1,2,3,4); + QBENCHMARK { + line.setAngle(1); + } +} + +void tst_qline::angleTo() +{ + QLineF line1(1,2,3,4); + QLineF line2(8,7,6,5); + QBENCHMARK { + line1.angleTo(line2); + } +} + +void tst_qline::unitVector() +{ + QLineF line(1,2,3,4); + QBENCHMARK { + line.unitVector(); + } +} + +void tst_qline::normalVector() +{ + QLineF line(1,2,3,4); + QBENCHMARK { + line.normalVector(); + } +} + +void tst_qline::angle2() +{ + QLineF line1(1,2,3,4); + QLineF line2(8,7,6,5); + QBENCHMARK { + line1.angle(line2); + } +} + +QTEST_MAIN(tst_qline) + +#include "main.moc" diff --git a/tests/benchmarks/corelib/tools/qline/qline.pro b/tests/benchmarks/corelib/tools/qline/qline.pro new file mode 100644 index 0000000..ae6bf5e --- /dev/null +++ b/tests/benchmarks/corelib/tools/qline/qline.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_bench_qline +DEPENDPATH += . +INCLUDEPATH += . + +QT -= gui + +CONFIG += release + +# Input +SOURCES += main.cpp diff --git a/tests/benchmarks/corelib/tools/tools.pro b/tests/benchmarks/corelib/tools/tools.pro index 44e8973..83a9411 100644 --- a/tests/benchmarks/corelib/tools/tools.pro +++ b/tests/benchmarks/corelib/tools/tools.pro @@ -3,6 +3,7 @@ SUBDIRS = \ containers-associative \ containers-sequential \ qbytearray \ + qline \ qlist \ qrect \ qregexp \ |