diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-07-22 13:43:43 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-07-22 13:43:43 +0200 |
commit | 3a6f5735ee723ff998114314c5ccdf6609667f6f (patch) | |
tree | 9c877dd1e35972fa336cea8a61986594f168b49c /tests/auto | |
parent | 000b6330d4ca7165ff241b21ee728ed28d82fba1 (diff) | |
parent | 17ded06804576dfde1b19f82f168f7ceb09ec92c (diff) |
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
src/quick/items/context2d/qquickcontext2d.cpp
tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro
Change-Id: I36a4fd28b3156839aecd70039a3ba566bf19a0bc
Diffstat (limited to 'tests/auto')
20 files changed, 391 insertions, 10 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 7f9281c70f..b64fc073ba 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -6,6 +6,9 @@ SUBDIRS=\ particles \ qmltest \ qmldevtools \ - cmake + cmake \ + installed_cmake + +installed_cmake.depends = cmake testcocoon: SUBDIRS -= headersclean diff --git a/tests/auto/installed_cmake/installed_cmake.pro b/tests/auto/installed_cmake/installed_cmake.pro new file mode 100644 index 0000000000..14d0b283d6 --- /dev/null +++ b/tests/auto/installed_cmake/installed_cmake.pro @@ -0,0 +1,4 @@ +include(../cmake/cmake.pro) + +CONFIG -= ctest_testcase +CONFIG += ctest_testcase_installed diff --git a/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml index 2a1b4fbf57..53a93621bb 100644 --- a/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml +++ b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml @@ -3,12 +3,21 @@ import QtQml 2.0 QtObject { property string originalName property string originalVersion + property string originalOrganization + property string originalDomain property string currentName: Qt.application.name property string currentVersion: Qt.application.version + property string currentOrganization: Qt.application.organization + property string currentDomain: Qt.application.domain + property QtObject applicationInstance: Qt.application Component.onCompleted: { originalName = Qt.application.name originalVersion = Qt.application.version + originalOrganization = Qt.application.organization + originalDomain = Qt.application.domain Qt.application.name = "Test B" Qt.application.version = "0.0B" + Qt.application.organization = "Org B" + Qt.application.domain = "b.org" } } diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp index 4780ee0310..489972716d 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -132,26 +132,55 @@ void tst_qqmlapplicationengine::applicationProperties() QCoreApplication* coreApp = QCoreApplication::instance(); QString originalName = coreApp->applicationName(); QString originalVersion = coreApp->applicationVersion(); + QString originalOrganization = coreApp->organizationName(); + QString originalDomain = coreApp->organizationDomain(); QString firstName = QLatin1String("Test A"); QString firstVersion = QLatin1String("0.0A"); + QString firstOrganization = QLatin1String("Org A"); + QString firstDomain = QLatin1String("a.org"); QString secondName = QLatin1String("Test B"); QString secondVersion = QLatin1String("0.0B"); + QString secondOrganization = QLatin1String("Org B"); + QString secondDomain = QLatin1String("b.org"); coreApp->setApplicationName(firstName); coreApp->setApplicationVersion(firstVersion); + coreApp->setOrganizationName(firstOrganization); + coreApp->setOrganizationDomain(firstDomain); QQmlApplicationEngine *test = new QQmlApplicationEngine(testFileUrl("applicationTest.qml")); QObject* root = test->rootObjects().at(0); QVERIFY(root); QCOMPARE(root->property("originalName").toString(), firstName); QCOMPARE(root->property("originalVersion").toString(), firstVersion); + QCOMPARE(root->property("originalOrganization").toString(), firstOrganization); + QCOMPARE(root->property("originalDomain").toString(), firstDomain); QCOMPARE(root->property("currentName").toString(), secondName); QCOMPARE(root->property("currentVersion").toString(), secondVersion); + QCOMPARE(root->property("currentOrganization").toString(), secondOrganization); + QCOMPARE(root->property("currentDomain").toString(), secondDomain); QCOMPARE(coreApp->applicationName(), secondName); QCOMPARE(coreApp->applicationVersion(), secondVersion); + QCOMPARE(coreApp->organizationName(), secondOrganization); + QCOMPARE(coreApp->organizationDomain(), secondDomain); + + QObject* application = root->property("applicationInstance").value<QObject*>(); + QVERIFY(application); + QSignalSpy nameChanged(application, SIGNAL(nameChanged())); + QSignalSpy versionChanged(application, SIGNAL(versionChanged())); + QSignalSpy organizationChanged(application, SIGNAL(organizationChanged())); + QSignalSpy domainChanged(application, SIGNAL(domainChanged())); coreApp->setApplicationName(originalName); coreApp->setApplicationVersion(originalVersion); + coreApp->setOrganizationName(originalOrganization); + coreApp->setOrganizationDomain(originalDomain); + + QCOMPARE(nameChanged.count(), 1); + QCOMPARE(versionChanged.count(), 1); + QCOMPARE(organizationChanged.count(), 1); + QCOMPARE(domainChanged.count(), 1); + delete test; } diff --git a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp index b845faca7d..9308bc6f40 100644 --- a/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp +++ b/tests/auto/qml/qquickfolderlistmodel/tst_qquickfolderlistmodel.cpp @@ -71,6 +71,7 @@ public slots: private slots: void basicProperties(); + void showFiles(); void resetFiltering(); void refresh(); #if defined (Q_OS_WIN) && !defined (Q_OS_WINCE) @@ -121,6 +122,7 @@ void tst_qquickfolderlistmodel::basicProperties() QCOMPARE(flm->property("sortField").toInt(), int(Name)); QCOMPARE(flm->property("nameFilters").toStringList(), QStringList() << "*.qml"); QCOMPARE(flm->property("sortReversed").toBool(), false); + QCOMPARE(flm->property("showFiles").toBool(), true); QCOMPARE(flm->property("showDirs").toBool(), true); QCOMPARE(flm->property("showDotAndDotDot").toBool(), false); QCOMPARE(flm->property("showOnlyReadable").toBool(), false); @@ -131,6 +133,23 @@ void tst_qquickfolderlistmodel::basicProperties() QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile("")); } +void tst_qquickfolderlistmodel::showFiles() +{ + QQmlComponent component(&engine, testFileUrl("basic.qml")); + checkNoErrors(component); + + QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create()); + QVERIFY(flm != 0); + + flm->setProperty("folder", dataDirectoryUrl()); + QTRY_COMPARE(flm->property("count").toInt(), 5); // wait for refresh + QCOMPARE(flm->property("showFiles").toBool(), true); + + flm->setProperty("showFiles", false); + QCOMPARE(flm->property("showFiles").toBool(), false); + QTRY_COMPARE(flm->property("count").toInt(), 1); // wait for refresh +} + void tst_qquickfolderlistmodel::resetFiltering() { // see QTBUG-17837 diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 9c5fb88af2..7ef07e4896 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -89,6 +89,7 @@ tst_examples::tst_examples() // Add files to exclude here excludedFiles << "examples/quick/canvas/tiger/tiger.qml"; // QTBUG-26528 excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem + excludedFiles << "examples/quick/demos/photosurface/photosurface.qml"; // root item is Window rather than Item // Add directories you want excluded here (don't add examples/, because they install to examples/qtdeclarative/) excludedDirs << "shared"; //Not an example diff --git a/tests/auto/quick/qquickanimatedsprite/data/runningChange.qml b/tests/auto/quick/qquickanimatedsprite/data/runningChange.qml new file mode 100644 index 0000000000..9994ff6d9b --- /dev/null +++ b/tests/auto/quick/qquickanimatedsprite/data/runningChange.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Tasuku Suzuki <stasuku@gmail.com> +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + color: "black" + width: 320 + height: 320 + + AnimatedSprite { + objectName: "sprite" + source: "squarefacesprite.png" + frameCount: 6 + loops: 3 + frameSync: true + running: false + width: 160 + height: 160 + } +} diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index bf46b6eca8..6422e0b656 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -53,6 +53,7 @@ public: private slots: void initTestCase(); void test_properties(); + void test_runningChangedSignal(); void test_frameChangedSignal(); }; @@ -87,6 +88,29 @@ void tst_qquickanimatedsprite::test_properties() delete window; } +void tst_qquickanimatedsprite::test_runningChangedSignal() +{ + QQuickView *window = new QQuickView(0); + + window->setSource(testFileUrl("runningChange.qml")); + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QVERIFY(window->rootObject()); + QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); + QVERIFY(sprite); + + QVERIFY(!sprite->running()); + + QSignalSpy runningChangedSpy(sprite, SIGNAL(runningChanged(bool))); + sprite->setRunning(true); + QTRY_COMPARE(runningChangedSpy.count(), 1); + QTRY_VERIFY(!sprite->running()); + QTRY_COMPARE(runningChangedSpy.count(), 2); + + delete window; +} + void tst_qquickanimatedsprite::test_frameChangedSignal() { QQuickView *window = new QQuickView(0); diff --git a/tests/auto/quick/qquickcanvasitem/data/tst_context.qml b/tests/auto/quick/qquickcanvasitem/data/tst_context.qml index ad44f6d28e..ab351f0de8 100644 --- a/tests/auto/quick/qquickcanvasitem/data/tst_context.qml +++ b/tests/auto/quick/qquickcanvasitem/data/tst_context.qml @@ -71,6 +71,7 @@ Canvas { } } + // See: http://www.w3.org/TR/css3-fonts/#font-prop TestCase { name: "ContextFontValidation" when: canvas.available @@ -82,8 +83,82 @@ Canvas { var ctx = canvas.getContext("2d"); compare(ctx.font, "sans-serif,-1,10,5,50,0,0,0,0,0"); - ctx.font = "80.1px sans-serif"; - compare(ctx.font, "sans-serif,-1,80,5,50,0,0,0,0,0"); + ctx.font = "80.1px cursive"; + // Can't verify the chosen font family since it's different for each platform. + compare(ctx.font.substr(ctx.font.indexOf(",") + 1), "-1,80,5,50,0,0,0,0,0"); + } + + function test_valid() { + wait(100); + compare(contextSpy.count, 1); + + var ctx = canvas.getContext("2d"); + + var validFonts = [ + { string: "12px sans-serif", expected: "sans-serif,-1,12,5,50,0,0,0,0,0" }, + { string: "12px serif", expected: "serif,-1,12,5,50,0,0,0,0,0" }, + { string: "12pt sans-serif", expected: "sans-serif,12,-1,5,50,0,0,0,0,0" }, + { string: "12pt serif", expected: "serif,12,-1,5,50,0,0,0,0,0" }, + { string: "normal 12px sans-serif", expected: "sans-serif,-1,12,5,50,0,0,0,0,0" }, + { string: "normal normal 12px sans-serif", expected: "sans-serif,-1,12,5,50,0,0,0,0,0" }, + { string: "normal normal normal 12px sans-serif", expected: "sans-serif,-1,12,5,50,0,0,0,0,0" }, + { string: "italic 12px sans-serif", expected: "sans-serif,-1,12,5,50,1,0,0,0,0" }, + { string: "italic normal 12px sans-serif", expected: "sans-serif,-1,12,5,50,1,0,0,0,0" }, + { string: "italic normal normal 12px sans-serif", expected: "sans-serif,-1,12,5,50,1,0,0,0,0" }, + { string: "oblique 12px sans-serif", expected: "sans-serif,-1,12,5,50,2,0,0,0,0" }, + { string: "oblique normal 12px sans-serif", expected: "sans-serif,-1,12,5,50,2,0,0,0,0" }, + { string: "oblique normal normal 12px sans-serif", expected: "sans-serif,-1,12,5,50,2,0,0,0,0" }, + { string: "bold 12px sans-serif", expected: "sans-serif,-1,12,5,75,0,0,0,0,0" }, + { string: "0 12px sans-serif", expected: "sans-serif,-1,12,5,0,0,0,0,0,0" }, + { string: "small-caps 12px sans-serif", expected: "sans-serif,-1,12,5,50,0,0,0,0,0" }, + ]; + for (var i = 0; i < validFonts.length; ++i) { + ctx.font = validFonts[i].string; + compare(ctx.font.substr(ctx.font.indexOf(",") + 1), + validFonts[i].expected.substr(validFonts[i].expected.indexOf(",") + 1)); + } + } + + function test_invalid() { + wait(100); + compare(contextSpy.count, 1); + + var ctx = canvas.getContext("2d"); + var originalFont = ctx.font; + var i = 0; + + var insufficientQtyTokens = ["", "12px", "sans-serif"]; + for (i = 0; i < insufficientQtyTokens.length; ++i) { + ignoreWarning("Context2D: Insufficent amount of tokens in font string."); + ctx.font = insufficientQtyTokens[i]; + compare(ctx.font, originalFont); + } + + var invalidFontSizes = ["z12px sans-serif", "1z2px sans-serif", "12zpx sans-serif", + "12pzx sans-serif", "12pxz sans-serif", "sans-serif 12px"]; + for (i = 0; i < invalidFontSizes.length; ++i) { + ignoreWarning("Context2D: A font size of \"" + invalidFontSizes[i].split(" ")[0] + "\" is invalid."); + ctx.font = invalidFontSizes[i]; + compare(ctx.font, originalFont); + } + + var invalidFontFamilies = ["12px !@weeeeeeee!@!@Don'tNameYourFontThis", "12px )(&*^^^%#$@*!!@#$JSPOR)"]; + for (i = 0; i < invalidFontFamilies.length; ++i) { + ignoreWarning("Context2D: The font family \"" + invalidFontFamilies[i].split(" ")[1] + "\" is invalid."); + ctx.font = invalidFontFamilies[i]; + compare(ctx.font, originalFont); + } + + var duplicates = [ + { duplicate: "normal", string: "normal normal normal normal 12px sans-serif" }, + { duplicate: "bold", string: "normal normal bold bold 12px sans-serif" }, + { duplicate: "bold", string: "bold bold 12px sans-serif" } + ]; + for (i = 0; i < duplicates.length; ++i) { + ignoreWarning("Context2D: Duplicate token \"" + duplicates[i].duplicate + "\" found in font string."); + ctx.font = duplicates[i].string; + compare(ctx.font, originalFont); + } } } } diff --git a/tests/auto/quick/qquickitem2/data/standardkeys.qml b/tests/auto/quick/qquickitem2/data/standardkeys.qml new file mode 100644 index 0000000000..c29a143c28 --- /dev/null +++ b/tests/auto/quick/qquickitem2/data/standardkeys.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.2 + +Item { + focus: true + + property bool pressed: false + property bool released: false + + Keys.onPressed: { + pressed = event.matches(standardKey) + } + + Keys.onReleased: { + released = event.matches(standardKey) + } +} diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index 992e81aa64..d15a46feca 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -78,6 +78,8 @@ private slots: void nextItemInFocusChain2(); void keys(); + void standardKeys_data(); + void standardKeys(); void keysProcessingOrder(); void keysim(); void keyNavigation(); @@ -1089,6 +1091,64 @@ void tst_QQuickItem::keys() delete testObject; } +Q_DECLARE_METATYPE(QEvent::Type); +Q_DECLARE_METATYPE(QKeySequence::StandardKey); + +void tst_QQuickItem::standardKeys_data() +{ + QTest::addColumn<QKeySequence::StandardKey>("standardKey"); + QTest::addColumn<QKeySequence::StandardKey>("contextProperty"); + QTest::addColumn<QEvent::Type>("eventType"); + QTest::addColumn<bool>("pressed"); + QTest::addColumn<bool>("released"); + + QTest::newRow("Press: Open") << QKeySequence::Open << QKeySequence::Open << QEvent::KeyPress << true << false; + QTest::newRow("Press: Close") << QKeySequence::Close << QKeySequence::Close << QEvent::KeyPress << true << false; + QTest::newRow("Press: Save") << QKeySequence::Save << QKeySequence::Save << QEvent::KeyPress << true << false; + QTest::newRow("Press: Quit") << QKeySequence::Quit << QKeySequence::Quit << QEvent::KeyPress << true << false; + + QTest::newRow("Release: New") << QKeySequence::New << QKeySequence::New << QEvent::KeyRelease << false << true; + QTest::newRow("Release: Delete") << QKeySequence::Delete << QKeySequence::Delete << QEvent::KeyRelease << false << true; + QTest::newRow("Release: Undo") << QKeySequence::Undo << QKeySequence::Undo << QEvent::KeyRelease << false << true; + QTest::newRow("Release: Redo") << QKeySequence::Redo << QKeySequence::Redo << QEvent::KeyRelease << false << true; + + QTest::newRow("Mismatch: Cut") << QKeySequence::Cut << QKeySequence::Copy << QEvent::KeyPress << false << false; + QTest::newRow("Mismatch: Copy") << QKeySequence::Copy << QKeySequence::Paste << QEvent::KeyPress << false << false; + QTest::newRow("Mismatch: Paste") << QKeySequence::Paste << QKeySequence::Cut << QEvent::KeyRelease << false << false; + QTest::newRow("Mismatch: Quit") << QKeySequence::Quit << QKeySequence::New << QEvent::KeyRelease << false << false; +} + +void tst_QQuickItem::standardKeys() +{ + QFETCH(QKeySequence::StandardKey, standardKey); + QFETCH(QKeySequence::StandardKey, contextProperty); + QFETCH(QEvent::Type, eventType); + QFETCH(bool, pressed); + QFETCH(bool, released); + + QKeySequence keySequence(standardKey); + if (keySequence.isEmpty()) + QSKIP("Undefined key sequence."); + + QQuickView view; + view.rootContext()->setContextProperty("standardKey", contextProperty); + view.setSource(testFileUrl("standardkeys.qml")); + view.show(); + view.requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(&view)); + + QQuickItem *item = qobject_cast<QQuickItem*>(view.rootObject()); + QVERIFY(item); + + const int key = keySequence[0] & Qt::Key_unknown; + const int modifiers = keySequence[0] & Qt::KeyboardModifierMask; + QKeyEvent keyEvent(eventType, key, static_cast<Qt::KeyboardModifiers>(modifiers)); + QGuiApplication::sendEvent(&view, &keyEvent); + + QCOMPARE(item->property("pressed").toBool(), pressed); + QCOMPARE(item->property("released").toBool(), released); +} + void tst_QQuickItem::keysProcessingOrder() { QQuickView *window = new QQuickView(0); diff --git a/tests/auto/quick/qquickloader/qquickloader.pro b/tests/auto/quick/qquickloader/qquickloader.pro index 567917877c..88de3c4c60 100644 --- a/tests/auto/quick/qquickloader/qquickloader.pro +++ b/tests/auto/quick/qquickloader/qquickloader.pro @@ -14,3 +14,4 @@ TESTDATA = data/* QT += core-private gui-private qml-private quick-private network testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 +CONFIG+=insignificant_test # QTBUG-30721 diff --git a/tests/auto/quick/qquickpositioners/qquickpositioners.pro b/tests/auto/quick/qquickpositioners/qquickpositioners.pro index c625080d7c..f6a046e622 100644 --- a/tests/auto/quick/qquickpositioners/qquickpositioners.pro +++ b/tests/auto/quick/qquickpositioners/qquickpositioners.pro @@ -9,6 +9,5 @@ macx:CONFIG -= app_bundle TESTDATA = data/* -CONFIG += parallel_test QT += testlib DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro index 7b0e0c2878..d9aff688ab 100644 --- a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro +++ b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro @@ -9,8 +9,6 @@ include (../shared/util.pri) TESTDATA = data/* -CONFIG += parallel_test - -QT += core-private gui-private qml-private quick-private testlib +QT += core-private gui-private qml-private quick-private testlib qtHaveModule(widgets): QT += widgets DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/quick/qquickxmllistmodel/data/groups.qml b/tests/auto/quick/qquickxmllistmodel/data/groups.qml new file mode 100644 index 0000000000..c1b574a822 --- /dev/null +++ b/tests/auto/quick/qquickxmllistmodel/data/groups.qml @@ -0,0 +1,10 @@ +import QtQuick 2.0 +import QtQuick.XmlListModel 2.0 + +XmlListModel { + source: "groups.xml" + query: "//animal[@name='Garfield']/parent::group" + + XmlRole { name: "id"; query: "@id/string()" } + XmlRole { name: "name"; query: "@name/string()" } +} diff --git a/tests/auto/quick/qquickxmllistmodel/data/groups.xml b/tests/auto/quick/qquickxmllistmodel/data/groups.xml new file mode 100644 index 0000000000..5de4d2ec71 --- /dev/null +++ b/tests/auto/quick/qquickxmllistmodel/data/groups.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<groups version="2.0"> + <group id="1" name="Animals" type="root"> + <group id="11" name="dogs"> + <animal id="111" name="Lassie"/> + <animal id="112" name="Laika"/> + <animal id="113" name="Wile E. Coyote" type="fictional"/> + </group> + <group id="12" name="cats"> + <animal id="121" name="Garfield" type="fictional"/> + <animal id="122" name="Sylvester" type="fictional"/> + </group> + <group id="13" name="birds"> + <animal id="131" name="Donald Duck" type="fictional"/> + <animal id="132" name="Phoenix" type="fictional"/> + </group> + </group> +</groups> diff --git a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro index da899a12ec..574481c456 100644 --- a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro +++ b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro @@ -12,3 +12,6 @@ CONFIG += parallel_test QT += core-private gui-private qml-private network testlib xmlpatterns DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +OTHER_FILES += \ + data/groups.qml diff --git a/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp b/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp index 847cc5078d..1f7a8029dc 100644 --- a/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp +++ b/tests/auto/quick/qquickxmllistmodel/tst_qquickxmllistmodel.cpp @@ -101,6 +101,7 @@ private slots: void threading(); void threading_data(); void propertyChanges(); + void selectAncestor(); void roleCrash(); @@ -964,6 +965,18 @@ void tst_qquickxmllistmodel::propertyChanges() delete model; } +void tst_qquickxmllistmodel::selectAncestor() +{ + QQmlComponent component(&engine, testFileUrl("groups.qml")); + QAbstractItemModel *model = qobject_cast<QAbstractItemModel *>(component.create()); + QVERIFY(model != 0); + QTRY_COMPARE(model->rowCount(), 1); + + QModelIndex index = model->index(0, 0); + QCOMPARE(model->data(index, Qt::UserRole).toInt(), 12); + QCOMPARE(model->data(index, Qt::UserRole+1).toString(), QLatin1String("cats")); +} + void tst_qquickxmllistmodel::roleCrash() { // don't crash diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro index 81d4fd3348..d0f8c401d6 100644 --- a/tests/auto/quick/quick.pro +++ b/tests/auto/quick/quick.pro @@ -69,7 +69,8 @@ QUICKTESTS = \ qquickcanvasitem \ qquickscreen \ touchmouse \ - dialogs \ +# disabled to allow file dialog changes to use urls internally (qtbase) +# dialogs \ SUBDIRS += $$PUBLICTESTS diff --git a/tests/auto/quick/touchmouse/touchmouse.pro b/tests/auto/quick/touchmouse/touchmouse.pro index e21695904e..e7c50e6f54 100644 --- a/tests/auto/quick/touchmouse/touchmouse.pro +++ b/tests/auto/quick/touchmouse/touchmouse.pro @@ -13,8 +13,6 @@ TESTDATA = data/* # OTHER_FILES += data/foo.qml -CONFIG += parallel_test - DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 mac:CONFIG+=insignificant_test # QTBUG-27890 |