From 4455db6ad1a644124536135971825f1e88471522 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 14 Jun 2013 10:28:44 +0200 Subject: stabilize tst_touchmouse. The test relies on window activation, which means that it cannot be a parallel test. Change-Id: I15b1c1511c38345b160aa3d01d17667dffc58c87 Reviewed-by: Sergio Ahumada --- tests/auto/quick/touchmouse/touchmouse.pro | 2 -- 1 file changed, 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/quick/touchmouse/touchmouse.pro b/tests/auto/quick/touchmouse/touchmouse.pro index bba0abdc17..378e199bf5 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 -- cgit v1.2.3 From 9f661cf327bc638d7584ba3832adaaa3d7c8734e Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 13 Jun 2013 17:02:36 +0200 Subject: photosurface demo: behavior depends on initialization order The file dialog wasn't appearing on the mac. This way seems to work. We have a long-term bug here but this workaround will look better for the release. Change-Id: I8538ca5dc11a063591bc4557fd3779c5bb3768b5 Task-number: QTBUG-31699 Reviewed-by: Gunnar Sletta --- tests/auto/quick/examples/tst_examples.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') 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 -- cgit v1.2.3 From 544978388f5106cada4bc0a836293ab2063a8beb Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Mon, 3 Jun 2013 10:14:57 +0900 Subject: emit runningChanged when AnimatedSprite stops by loops settings Task-number: QTBUG-31522 Change-Id: I20718cda5f77f3a53176c8b1a4baacedd77375af Reviewed-by: Alan Alpert --- .../qquickanimatedsprite/data/runningChange.qml | 59 ++++++++++++++++++++++ .../tst_qquickanimatedsprite.cpp | 24 +++++++++ 2 files changed, 83 insertions(+) create mode 100644 tests/auto/quick/qquickanimatedsprite/data/runningChange.qml (limited to 'tests') 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 +** 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("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); -- cgit v1.2.3 From 2d065ddb53a31c1b717c88902bcdf4f6b24f320f Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 13 Jun 2013 15:41:33 +0200 Subject: Correctly parse Context2D font as per CSS shorthand font property Task-number: QTBUG-31721 Change-Id: I6a6ba99ed29392fa7ed67f6a3dba567947f9c46b Reviewed-by: Alan Alpert --- .../quick/qquickcanvasitem/data/tst_context.qml | 79 +++++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) (limited to 'tests') 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); + } } } } -- cgit v1.2.3 From 6ad5400c54302ee5e099e478e91de53386b62902 Mon Sep 17 00:00:00 2001 From: Alberto Mardegan Date: Wed, 26 Dec 2012 13:59:52 +0100 Subject: Add "showFiles" property to FolderListModel This property, if set to "false", causes the FolderListModel not to show regular files. This can be useful when someone wants to list only the directories; for instance, one can have a ListView showing only the directories (with "showDirs: true" and "showFiles: false") and another for showing the directory contents ("showFiles: true" and "showDirs: false"). Since by default this property is "true", the behavior of applications who don't use this property is unchanged. Change-Id: I6eaa9c4a6a582ea81fa07bad129a4c9b15fdcaea Reviewed-by: Alan Alpert --- .../tst_qquickfolderlistmodel.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') 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(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 -- cgit v1.2.3 From 101a5185138f4eb4d1ed0e69065d8e4c30a7fff7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 21 Jun 2013 15:08:43 +0200 Subject: Add Qt.application.organization/domain Change-Id: Ic4a161b59d51e621e13c960f104d1a3be2ee64f8 Reviewed-by: Alan Alpert Reviewed-by: Gabriel de Dietrich --- .../qml/qqmlapplicationengine/data/applicationTest.qml | 8 ++++++++ .../qqmlapplicationengine/tst_qqmlapplicationengine.cpp | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) (limited to 'tests') diff --git a/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml index 2a1b4fbf57..1957edaf56 100644 --- a/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml +++ b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml @@ -3,12 +3,20 @@ 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 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..c0c3f736b9 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -132,26 +132,42 @@ 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); coreApp->setApplicationName(originalName); coreApp->setApplicationVersion(originalVersion); + coreApp->setOrganizationName(originalOrganization); + coreApp->setOrganizationDomain(originalDomain); delete test; } -- cgit v1.2.3 From ea045d82a3a837f83fec82462feebf2bc262f9d9 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 30 May 2013 17:06:58 +0200 Subject: Add bool QQuickKeyEvent::matches(QKeySequence::StandardKey) Change-Id: Iaa8392c1b113856fa80cd2507f8640050eb9bec2 Reviewed-by: Caroline Chao --- tests/auto/quick/qquickitem2/data/standardkeys.qml | 57 ++++++++++++++++++++ tests/auto/quick/qquickitem2/tst_qquickitem.cpp | 60 ++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 tests/auto/quick/qquickitem2/data/standardkeys.qml (limited to 'tests') 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("standardKey"); + QTest::addColumn("contextProperty"); + QTest::addColumn("eventType"); + QTest::addColumn("pressed"); + QTest::addColumn("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(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(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); -- cgit v1.2.3 From fe015ea5ea33627586b7b4cd622f00c8753a7c49 Mon Sep 17 00:00:00 2001 From: Tony Sarajarvi Date: Fri, 28 Jun 2013 11:22:51 +0300 Subject: Mark tests tst_qquickloader as insignificant due to random failures Task-number: QTBUG-30721 Change-Id: I540848b1e7c9992e89b6df2417c37ce5e81423c8 Reviewed-by: Alan Alpert (Personal) <416365416c@gmail.com> Reviewed-by: Gunnar Sletta --- tests/auto/quick/qquickloader/qquickloader.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') 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 -- cgit v1.2.3 From 8cc60ac9cc33192d8a0bc8ce9412fe059830eabd Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 4 Jul 2013 17:36:14 +0200 Subject: Fix Qt.application.xxx notifier signals QCoreApplication now provides change notifications. Change-Id: Icd7e1247426f4b5ad124d6d9b72a2ba99225ee08 Reviewed-by: Robin Burchell --- .../auto/qml/qqmlapplicationengine/data/applicationTest.qml | 1 + .../qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp | 13 +++++++++++++ 2 files changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml index 1957edaf56..53a93621bb 100644 --- a/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml +++ b/tests/auto/qml/qqmlapplicationengine/data/applicationTest.qml @@ -9,6 +9,7 @@ QtObject { 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 diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp index c0c3f736b9..489972716d 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -164,10 +164,23 @@ void tst_qqmlapplicationengine::applicationProperties() QCOMPARE(coreApp->organizationName(), secondOrganization); QCOMPARE(coreApp->organizationDomain(), secondDomain); + QObject* application = root->property("applicationInstance").value(); + 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; } -- cgit v1.2.3 From cc2d34486360a1a65312f72ca4959228b9ab0c75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Mon, 8 Jul 2013 10:44:34 +0300 Subject: QtDeclarative: Removing parallel_test from config tst_qquickvisualdatamodel and tst_qquickpositioners have been failing recently on CI. One can't reproduce the failures locally unless running the tests parallel, like CI does. Task-number: QTQAINFRA-705 Change-Id: I09a9123d045f2213af915518917ce622b33b27ba Reviewed-by: J-P Nurmi --- tests/auto/quick/qquickpositioners/qquickpositioners.pro | 1 - tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro | 2 -- 2 files changed, 3 deletions(-) (limited to 'tests') 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 60ae065910..fd80c66475 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 v8-private qml-private quick-private testlib qtHaveModule(widgets): QT += widgets DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 -- cgit v1.2.3 From ddcf9fc80e074c5a9d1ecbbf3c60ca27f250ce98 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Thu, 4 Jul 2013 12:14:44 +0200 Subject: Don't assume that the last step of the XPath is an element name In order to find the number of items in the model, the model did a second query on the document representing the result set. So, suppose the user queried for //a/b/c, the result set would contain all the 'c' elements from the input document. In order to find the number of items in the result set, it did a second query with the expression "count(/dummy:items/c)", where 'c' was extracted from the last step in the original XPath expression For simple expressions, this worked fine. However, if the last step had a predicate such as "//c/parent::b" it didn't work. The solution is to not filter *again* the last step when we query for the count, since we know that all result items are direct children of "dummy:items", and instead just execute the query "count(dummy::items/*)". This should also potentially improve performance. Task-number: QTBUG-17588 Change-Id: Ib2fdf1ec8b91022df0597e089ad34d34b04428b0 Reviewed-by: Alan Alpert --- tests/auto/quick/qquickxmllistmodel/data/groups.qml | 10 ++++++++++ tests/auto/quick/qquickxmllistmodel/data/groups.xml | 18 ++++++++++++++++++ .../quick/qquickxmllistmodel/qquickxmllistmodel.pro | 3 +++ .../qquickxmllistmodel/tst_qquickxmllistmodel.cpp | 13 +++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 tests/auto/quick/qquickxmllistmodel/data/groups.qml create mode 100644 tests/auto/quick/qquickxmllistmodel/data/groups.xml (limited to 'tests') 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 @@ + + + + + + + + + + + + + + + + + + diff --git a/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro b/tests/auto/quick/qquickxmllistmodel/qquickxmllistmodel.pro index 047d8ca560..9172a224f7 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 v8-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(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 -- cgit v1.2.3 From 2fac1d95f7094f6ff086e2f8de9c51f6ef1270c4 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 3 Jul 2013 00:13:38 +0200 Subject: Add a unit test for testing Qt in its install location. Change-Id: Ide70affa28f0ec37535b5a4ce1bcafac8ac58351 Reviewed-by: Stephen Kelly --- tests/auto/auto.pro | 5 ++++- tests/auto/installed_cmake/installed_cmake.pro | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/auto/installed_cmake/installed_cmake.pro (limited to 'tests') 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 -- cgit v1.2.3 From d9751bc29d2f80b86eb237226ce832bf2e372f1d Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 15 Jul 2013 10:51:00 +0200 Subject: Disable dialogs to allow changes in qtbase (use urls internally) Change-Id: I9ae09416acdbe437acbe9672d0ecfc42059695ae Reviewed-by: David Faure --- tests/auto/quick/quick.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') 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 -- cgit v1.2.3