aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-08-26 09:51:49 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-08-26 11:21:16 +0200
commite525c551394ba2827e4494bfb72ff43171e9b7e1 (patch)
treea7223403990a45bbaf8037600f282c1d01a6e811 /tests
parent1075dca1b50926f52daddf099b5f5a9fbb5da6c7 (diff)
parente9e6f70d355499d551a26960d236644f92ea38af (diff)
Merge "Merge remote-tracking branch 'origin/5.3' into 5.4" into refs/staging/5.4
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmllanguage/data/earlyIdObjectAccess.qml23
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp10
-rw-r--r--tests/auto/qmltest/stability/tst_unloadrepeater.qml103
-rw-r--r--tests/auto/quick/dialogs/tst_dialogs.cpp5
4 files changed, 140 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmllanguage/data/earlyIdObjectAccess.qml b/tests/auto/qml/qqmllanguage/data/earlyIdObjectAccess.qml
new file mode 100644
index 0000000000..22c335b1a7
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/earlyIdObjectAccess.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.0
+
+Item {
+ visible: false
+ property bool success: false
+ property bool loading: true
+
+ Item {
+ visible: someOtherItem.someProperty
+ onVisibleChanged: {
+ if (!visible) {
+ success = loading
+ }
+ }
+ }
+
+ Item {
+ id: someOtherItem
+ property bool someProperty: true
+ }
+
+ Component.onCompleted: loading = false
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 05cdccfb51..d6d2911285 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -235,6 +235,8 @@ private slots:
void noChildEvents();
+ void earlyIdObjectAccess();
+
private:
QQmlEngine engine;
QStringList defaultImportPathList;
@@ -3970,6 +3972,14 @@ void tst_qqmllanguage::noChildEvents()
QCOMPARE(object->childAddedEventCount(), 0);
}
+void tst_qqmllanguage::earlyIdObjectAccess()
+{
+ QQmlComponent component(&engine, testFileUrl("earlyIdObjectAccess.qml"));
+ QScopedPointer<QObject> o(component.create());
+ QVERIFY(!o.isNull());
+ QVERIFY(o->property("success").toBool());
+}
+
QTEST_MAIN(tst_qqmllanguage)
#include "tst_qqmllanguage.moc"
diff --git a/tests/auto/qmltest/stability/tst_unloadrepeater.qml b/tests/auto/qmltest/stability/tst_unloadrepeater.qml
new file mode 100644
index 0000000000..dfb631493b
--- /dev/null
+++ b/tests/auto/qmltest/stability/tst_unloadrepeater.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Jolla Ltd, author: <gunnar.sletta@jollamobile.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.2
+import QtTest 1.0
+
+Item {
+ width : 800
+ height : 600
+
+ Timer {
+ id: probablyOkNow
+ interval: 2000
+ running: true
+ repeat: false
+ onTriggered: testCase.when = true;
+ }
+
+ TestCase {
+ id: testCase
+ name: "unloaded-repeater"
+ when: false
+ function test_endresult()
+ {
+ havocTimer.running = false;
+ verify(true, "If we didn't crash by now, all is good")
+ }
+ }
+
+ Timer {
+ id: havocTimer
+ interval: 1
+ running: true
+ repeat: true
+
+ onTriggered: {
+ loader.sourceComponent = null
+ loader.sourceComponent = component1
+ }
+
+ }
+
+ Loader {
+ id : loader
+ asynchronous : true
+ }
+
+ Component {
+ id : component1
+ Grid {
+ columns: 70
+ spacing: 2
+
+ Repeater {
+ model : 2000
+
+ Rectangle {
+ width : 3
+ height : 3
+ color : "blue"
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp
index 7dd360c9b0..01fe6c3722 100644
--- a/tests/auto/quick/dialogs/tst_dialogs.cpp
+++ b/tests/auto/quick/dialogs/tst_dialogs.cpp
@@ -65,6 +65,7 @@ void tst_dialogs::fileDialogDefaultModality()
window->setGeometry(240,240,1024,320);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject());
// Click to show
QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
@@ -110,14 +111,15 @@ void tst_dialogs::fileDialogNonModal()
window->setGeometry(240,240,1024,320);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject());
// Click to toggle visibility
QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
dlg->setProperty("modality", QVariant((int)Qt::NonModal));
QSignalSpy spyVisibilityChanged(dlg, SIGNAL(visibilityChanged()));
QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100)); // show
+ QTRY_VERIFY(spyVisibilityChanged.count() > 0);
int visibilityChangedCount = spyVisibilityChanged.count();
- QTRY_VERIFY(visibilityChangedCount > 0);
QCOMPARE(dlg->property("visible").toBool(), true);
QTest::mouseClick(window, Qt::LeftButton, 0, QPoint(1000, 100)); // hide
QTRY_VERIFY(spyVisibilityChanged.count() > visibilityChangedCount);
@@ -134,6 +136,7 @@ void tst_dialogs::fileDialogNameFilters()
window->setGeometry(240,240,1024,320);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->rootObject());
QObject *dlg = qvariant_cast<QObject *>(window->rootObject()->property("fileDialog"));
QStringList filters;