aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-06-10 10:06:39 +0200
committerLiang Qi <liang.qi@qt.io>2016-06-10 10:06:39 +0200
commit0932a59971f606f07b41da19f3974d51b7008180 (patch)
tree191aab5e88e7b4ddf3724dcbf3b8229512e433f2 /tests
parentaca40a8361996e22ec4f020b803404031a0f0d76 (diff)
parentcd0efef04bd45eca6cc72b5a000e4e5586153290 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Part of 0e053528 was reverted in the merge, about lastTimestamp. It will be applied later in separate commit. qmltest::shadersource-dynamic-sourceobject::test_endresult() was blacklisted on linux. Conflicts: .qmake.conf tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp tests/auto/qmltest/BLACKLIST tests/auto/qmltest/qmltest.pro Task-number: QTBUG-53590 Task-number: QTBUG-53971 Change-Id: I48af90b49a3c7b29de16f4178a04807f8bc05130
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qjsengine/tst_qjsengine.cpp9
-rw-r--r--tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp16
-rw-r--r--tests/auto/qml/qqmlsqldatabase/data/nullvalues.js24
-rw-r--r--tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp3
-rw-r--r--tests/auto/qmltest-blacklist/animators/Box.qml (renamed from tests/auto/qmltest/animators/Box.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_behavior.qml (renamed from tests/auto/qmltest/animators/tst_behavior.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_mixed.qml (renamed from tests/auto/qmltest/animators/tst_mixed.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_mixedparallel.qml (renamed from tests/auto/qmltest/animators/tst_mixedparallel.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_mixedsequential.qml (renamed from tests/auto/qmltest/animators/tst_mixedsequential.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_multiwindow.qml (renamed from tests/auto/qmltest/animators/tst_multiwindow.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_nested.qml (renamed from tests/auto/qmltest/animators/tst_nested.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_on.qml (renamed from tests/auto/qmltest/animators/tst_on.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_opacity.qml (renamed from tests/auto/qmltest/animators/tst_opacity.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_parallel.qml (renamed from tests/auto/qmltest/animators/tst_parallel.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_restart.qml (renamed from tests/auto/qmltest/animators/tst_restart.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_rotation.qml (renamed from tests/auto/qmltest/animators/tst_rotation.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_scale.qml (renamed from tests/auto/qmltest/animators/tst_scale.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_sequential.qml (renamed from tests/auto/qmltest/animators/tst_sequential.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_targetdestroyed.qml (renamed from tests/auto/qmltest/animators/tst_targetdestroyed.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_transformorigin.qml (renamed from tests/auto/qmltest/animators/tst_transformorigin.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_transition.qml (renamed from tests/auto/qmltest/animators/tst_transition.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_x.qml (renamed from tests/auto/qmltest/animators/tst_x.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_y.qml (renamed from tests/auto/qmltest/animators/tst_y.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/animators/tst_zeroduration.qml (renamed from tests/auto/qmltest/animators/tst_zeroduration.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/item/tst_layerInPositioner.qml (renamed from tests/auto/qmltest/item/tst_layerInPositioner.qml)0
-rw-r--r--tests/auto/qmltest-blacklist/itemgrabber/tst_itemgrabber.qml (renamed from tests/auto/qmltest/itemgrabber/tst_itemgrabber.qml)0
-rw-r--r--tests/auto/qmltest/BLACKLIST9
-rw-r--r--tests/auto/qmltest/listview/tst_listview.qml2
-rw-r--r--tests/auto/qmltest/qmltest.pro4
-rw-r--r--tests/auto/qmltest/statemachine/tst_signaltransition.qml76
-rw-r--r--tests/auto/qmltest/window/tst_clickwindow.qml2
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp11
-rw-r--r--tests/auto/quick/qquicktext/tst_qquicktext.cpp11
-rw-r--r--tests/auto/quick/qquicktextinput/data/focusOnlyOneOnPress.qml32
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp41
35 files changed, 232 insertions, 8 deletions
diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
index 8a8147ea6f..b1d19b5796 100644
--- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp
+++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp
@@ -188,6 +188,8 @@ private slots:
void v4FunctionWithoutQML();
+ void withNoContext();
+
signals:
void testSignal();
};
@@ -3835,6 +3837,13 @@ void tst_QJSEngine::v4FunctionWithoutQML()
QVERIFY(obj.called);
}
+void tst_QJSEngine::withNoContext()
+{
+ // Don't crash (QTBUG-53794)
+ QJSEngine engine;
+ engine.evaluate("with (noContext) true");
+}
+
QTEST_MAIN(tst_QJSEngine)
#include "tst_qjsengine.moc"
diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
index b3d199f80f..cd497cbd79 100644
--- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
+++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp
@@ -105,6 +105,7 @@ private slots:
void get_nested();
void get_nested_data();
void crash_model_with_multiple_roles();
+ void crash_model_with_unknown_roles();
void set_model_cache();
void property_changes();
void property_changes_data();
@@ -963,6 +964,21 @@ void tst_qqmllistmodel::crash_model_with_multiple_roles()
delete rootItem;
}
+void tst_qqmllistmodel::crash_model_with_unknown_roles()
+{
+ QQmlEngine eng;
+ QQmlComponent component(&eng, testFileUrl("multipleroles.qml"));
+ QScopedPointer<QObject> rootItem(component.create());
+ QVERIFY(component.errorString().isEmpty());
+ QVERIFY(rootItem != 0);
+ QQmlListModel *model = rootItem->findChild<QQmlListModel*>("listModel");
+ QVERIFY(model != 0);
+
+ // used to cause a crash in debug builds
+ model->index(0, 0, QModelIndex()).data(Qt::DisplayRole);
+ model->index(0, 0, QModelIndex()).data(Qt::UserRole);
+}
+
//QTBUG-15190
void tst_qqmllistmodel::set_model_cache()
{
diff --git a/tests/auto/qml/qqmlsqldatabase/data/nullvalues.js b/tests/auto/qml/qqmlsqldatabase/data/nullvalues.js
new file mode 100644
index 0000000000..322a7aea03
--- /dev/null
+++ b/tests/auto/qml/qqmlsqldatabase/data/nullvalues.js
@@ -0,0 +1,24 @@
+.import QtQuick.LocalStorage 2.0 as Sql
+
+function test() {
+ var db = Sql.LocalStorage.openDatabaseSync("QmlTestDB-nullvalues", "", "Test database from Qt autotests", 1000000);
+ var r="transaction_not_finished";
+
+ db.transaction(
+ function(tx) {
+ tx.executeSql('CREATE TABLE IF NOT EXISTS NullValues(salutation TEXT, salutee TEXT)');
+ tx.executeSql('INSERT INTO NullValues VALUES(?, ?)', [ 'hello', null ]);
+ var firstRow = tx.executeSql("SELECT * FROM NullValues").rows.item(0);
+ if (firstRow.salutation !== "hello")
+ return
+ if (firstRow.salutee === "") {
+ r = "wrong_data_type"
+ return
+ }
+ if (firstRow.salutee === null)
+ r = "passed";
+ }
+ );
+
+ return r;
+}
diff --git a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
index b1e5cc4e7a..e16bfb08a2 100644
--- a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
+++ b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp
@@ -122,7 +122,7 @@ void tst_qqmlsqldatabase::checkDatabasePath()
QVERIFY(engine->offlineStoragePath().contains("OfflineStorage"));
}
-static const int total_databases_created_by_tests = 12;
+static const int total_databases_created_by_tests = 13;
void tst_qqmlsqldatabase::testQml_data()
{
QTest::addColumn<QString>("jsfile"); // The input file
@@ -144,6 +144,7 @@ void tst_qqmlsqldatabase::testQml_data()
QTest::newRow("error-outsidetransaction") << "error-outsidetransaction.js"; // reuse above
QTest::newRow("reopen1") << "reopen1.js";
QTest::newRow("reopen2") << "reopen2.js"; // re-uses above DB
+ QTest::newRow("null-values") << "nullvalues.js";
// If you add a test, you should usually use a new database in the
// test - in which case increment total_databases_created_by_tests above.
diff --git a/tests/auto/qmltest/animators/Box.qml b/tests/auto/qmltest-blacklist/animators/Box.qml
index 88a74e8a54..88a74e8a54 100644
--- a/tests/auto/qmltest/animators/Box.qml
+++ b/tests/auto/qmltest-blacklist/animators/Box.qml
diff --git a/tests/auto/qmltest/animators/tst_behavior.qml b/tests/auto/qmltest-blacklist/animators/tst_behavior.qml
index 1a17c0528e..1a17c0528e 100644
--- a/tests/auto/qmltest/animators/tst_behavior.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_behavior.qml
diff --git a/tests/auto/qmltest/animators/tst_mixed.qml b/tests/auto/qmltest-blacklist/animators/tst_mixed.qml
index 5ad698254f..5ad698254f 100644
--- a/tests/auto/qmltest/animators/tst_mixed.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_mixed.qml
diff --git a/tests/auto/qmltest/animators/tst_mixedparallel.qml b/tests/auto/qmltest-blacklist/animators/tst_mixedparallel.qml
index 236f250306..236f250306 100644
--- a/tests/auto/qmltest/animators/tst_mixedparallel.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_mixedparallel.qml
diff --git a/tests/auto/qmltest/animators/tst_mixedsequential.qml b/tests/auto/qmltest-blacklist/animators/tst_mixedsequential.qml
index 771c5f33ce..771c5f33ce 100644
--- a/tests/auto/qmltest/animators/tst_mixedsequential.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_mixedsequential.qml
diff --git a/tests/auto/qmltest/animators/tst_multiwindow.qml b/tests/auto/qmltest-blacklist/animators/tst_multiwindow.qml
index 8ea6aab9a7..8ea6aab9a7 100644
--- a/tests/auto/qmltest/animators/tst_multiwindow.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_multiwindow.qml
diff --git a/tests/auto/qmltest/animators/tst_nested.qml b/tests/auto/qmltest-blacklist/animators/tst_nested.qml
index 7f35118dda..7f35118dda 100644
--- a/tests/auto/qmltest/animators/tst_nested.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_nested.qml
diff --git a/tests/auto/qmltest/animators/tst_on.qml b/tests/auto/qmltest-blacklist/animators/tst_on.qml
index 5bcbfa2a2e..5bcbfa2a2e 100644
--- a/tests/auto/qmltest/animators/tst_on.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_on.qml
diff --git a/tests/auto/qmltest/animators/tst_opacity.qml b/tests/auto/qmltest-blacklist/animators/tst_opacity.qml
index 41d09b18c6..41d09b18c6 100644
--- a/tests/auto/qmltest/animators/tst_opacity.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_opacity.qml
diff --git a/tests/auto/qmltest/animators/tst_parallel.qml b/tests/auto/qmltest-blacklist/animators/tst_parallel.qml
index ac7acf2536..ac7acf2536 100644
--- a/tests/auto/qmltest/animators/tst_parallel.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_parallel.qml
diff --git a/tests/auto/qmltest/animators/tst_restart.qml b/tests/auto/qmltest-blacklist/animators/tst_restart.qml
index 66f395c938..66f395c938 100644
--- a/tests/auto/qmltest/animators/tst_restart.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_restart.qml
diff --git a/tests/auto/qmltest/animators/tst_rotation.qml b/tests/auto/qmltest-blacklist/animators/tst_rotation.qml
index b181912299..b181912299 100644
--- a/tests/auto/qmltest/animators/tst_rotation.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_rotation.qml
diff --git a/tests/auto/qmltest/animators/tst_scale.qml b/tests/auto/qmltest-blacklist/animators/tst_scale.qml
index 0e1abcf729..0e1abcf729 100644
--- a/tests/auto/qmltest/animators/tst_scale.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_scale.qml
diff --git a/tests/auto/qmltest/animators/tst_sequential.qml b/tests/auto/qmltest-blacklist/animators/tst_sequential.qml
index e8b4e98917..e8b4e98917 100644
--- a/tests/auto/qmltest/animators/tst_sequential.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_sequential.qml
diff --git a/tests/auto/qmltest/animators/tst_targetdestroyed.qml b/tests/auto/qmltest-blacklist/animators/tst_targetdestroyed.qml
index 588777ce1c..588777ce1c 100644
--- a/tests/auto/qmltest/animators/tst_targetdestroyed.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_targetdestroyed.qml
diff --git a/tests/auto/qmltest/animators/tst_transformorigin.qml b/tests/auto/qmltest-blacklist/animators/tst_transformorigin.qml
index e9c8a16598..e9c8a16598 100644
--- a/tests/auto/qmltest/animators/tst_transformorigin.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_transformorigin.qml
diff --git a/tests/auto/qmltest/animators/tst_transition.qml b/tests/auto/qmltest-blacklist/animators/tst_transition.qml
index 1e95ed56c0..1e95ed56c0 100644
--- a/tests/auto/qmltest/animators/tst_transition.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_transition.qml
diff --git a/tests/auto/qmltest/animators/tst_x.qml b/tests/auto/qmltest-blacklist/animators/tst_x.qml
index 7a89bf564c..7a89bf564c 100644
--- a/tests/auto/qmltest/animators/tst_x.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_x.qml
diff --git a/tests/auto/qmltest/animators/tst_y.qml b/tests/auto/qmltest-blacklist/animators/tst_y.qml
index abb73db7c1..abb73db7c1 100644
--- a/tests/auto/qmltest/animators/tst_y.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_y.qml
diff --git a/tests/auto/qmltest/animators/tst_zeroduration.qml b/tests/auto/qmltest-blacklist/animators/tst_zeroduration.qml
index 83ce235f42..83ce235f42 100644
--- a/tests/auto/qmltest/animators/tst_zeroduration.qml
+++ b/tests/auto/qmltest-blacklist/animators/tst_zeroduration.qml
diff --git a/tests/auto/qmltest/item/tst_layerInPositioner.qml b/tests/auto/qmltest-blacklist/item/tst_layerInPositioner.qml
index da081fb5fe..da081fb5fe 100644
--- a/tests/auto/qmltest/item/tst_layerInPositioner.qml
+++ b/tests/auto/qmltest-blacklist/item/tst_layerInPositioner.qml
diff --git a/tests/auto/qmltest/itemgrabber/tst_itemgrabber.qml b/tests/auto/qmltest-blacklist/itemgrabber/tst_itemgrabber.qml
index 743dad70eb..743dad70eb 100644
--- a/tests/auto/qmltest/itemgrabber/tst_itemgrabber.qml
+++ b/tests/auto/qmltest-blacklist/itemgrabber/tst_itemgrabber.qml
diff --git a/tests/auto/qmltest/BLACKLIST b/tests/auto/qmltest/BLACKLIST
index cd8b1181e0..86a98a2c9c 100644
--- a/tests/auto/qmltest/BLACKLIST
+++ b/tests/auto/qmltest/BLACKLIST
@@ -3,3 +3,12 @@
*
[SelfTests::test_blacklistWithData:test2]
*
+[shadersource-dynamic-sourceobject::test_endresult]
+linux
+[tst_grabImage::test_equals]
+linux
+[Text::test_linecount]
+osx
+windows
+[TextInput::test_doublevalidators]
+osx
diff --git a/tests/auto/qmltest/listview/tst_listview.qml b/tests/auto/qmltest/listview/tst_listview.qml
index 75429c43e1..98d7ea4cb7 100644
--- a/tests/auto/qmltest/listview/tst_listview.qml
+++ b/tests/auto/qmltest/listview/tst_listview.qml
@@ -288,6 +288,7 @@ Item {
}
function test_asyncLoaderCurrentIndexChange() {
+ skip("more details in QTBUG-53780")
for (var i = 0; i < 500; i++) {
asyncLoaderCurrentIndexListView.currentIndex = 0;
asyncLoaderCurrentIndexListView.currentIndex = 1;
@@ -300,6 +301,7 @@ Item {
}
function test_asyncListViewLoader() {
+ skip("more details in QTBUG-53780")
for (var i = 0; i < 50; i++) {
wait(10);
asyncListViewLoaderView.currentIndex = 0;
diff --git a/tests/auto/qmltest/qmltest.pro b/tests/auto/qmltest/qmltest.pro
index 54db7a78ab..52fd6bf9de 100644
--- a/tests/auto/qmltest/qmltest.pro
+++ b/tests/auto/qmltest/qmltest.pro
@@ -10,5 +10,5 @@ importFiles.files = borderimage buttonclick createbenchmark events qqmlbindi
importFiles.path = .
DEPLOYMENT += importFiles
-CONFIG+=insignificant_test # QTBUG-33723
-
+# Please do not make this test insignificant again, thanks.
+# Just skip those unstable ones. See also QTBUG-33723.
diff --git a/tests/auto/qmltest/statemachine/tst_signaltransition.qml b/tests/auto/qmltest/statemachine/tst_signaltransition.qml
new file mode 100644
index 0000000000..0e35207670
--- /dev/null
+++ b/tests/auto/qmltest/statemachine/tst_signaltransition.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Ford Motor Company
+** Copyright (C) 2016 The Qt Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtTest 1.1
+import QtQml.StateMachine 1.0
+
+TestCase {
+ id: testCase
+ StateMachine {
+ id: machine
+ initialState: startState
+ State {
+ id: startState
+ SignalTransition {
+ id: signalTrans
+ signal: testCase.onMysignal
+ targetState: finalState
+ }
+ }
+ FinalState {
+ id: finalState
+ }
+ }
+
+ SignalSpy {
+ id: finalStateActive
+ target: finalState
+ signalName: "activeChanged"
+ }
+
+ signal mysignal()
+
+ name: "testSignalTransition"
+ function test_signalTransition()
+ {
+ // Start statemachine, should not have reached finalState yet.
+ machine.start()
+ tryCompare(finalStateActive, "count", 0)
+ tryCompare(machine, "running", true)
+
+ testCase.mysignal()
+ tryCompare(finalStateActive, "count", 1)
+ tryCompare(machine, "running", false)
+ }
+}
diff --git a/tests/auto/qmltest/window/tst_clickwindow.qml b/tests/auto/qmltest/window/tst_clickwindow.qml
index bbe091990c..c3577be4dc 100644
--- a/tests/auto/qmltest/window/tst_clickwindow.qml
+++ b/tests/auto/qmltest/window/tst_clickwindow.qml
@@ -75,6 +75,8 @@ Item {
when: windowShown
function test_clickBothWindows() {
+ if (Qt.platform.os === "linux" || Qt.platform.os === "windows")
+ skip("more details in QTBUG-53785")
mouseClick(ma, 20, 20);
verify(ma.everClicked);
mouseClick(ma2, 20, 20);
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 3f78bcf1eb..aa1474df91 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -82,6 +82,7 @@ private slots:
void dragging_data() { acceptedButton_data(); }
void dragging();
void dragSmoothed();
+ void dragThreshold_data();
void dragThreshold();
void invalidDrag_data() { rejectedButton_data(); }
void invalidDrag();
@@ -390,8 +391,17 @@ void tst_QQuickMouseArea::dragSmoothed()
QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 122));
}
+void tst_QQuickMouseArea::dragThreshold_data()
+{
+ QTest::addColumn<bool>("preventStealing");
+ QTest::newRow("without preventStealing") << false;
+ QTest::newRow("with preventStealing") << true;
+}
+
void tst_QQuickMouseArea::dragThreshold()
{
+ QFETCH(bool, preventStealing);
+
QQuickView window;
QByteArray errorMessage;
QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData());
@@ -401,6 +411,7 @@ void tst_QQuickMouseArea::dragThreshold()
QVERIFY(window.rootObject() != 0);
QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion");
+ mouseRegion->setPreventStealing(preventStealing);
QQuickDrag *drag = mouseRegion->drag();
drag->setThreshold(5);
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
index d0fc36936a..5ee811fd37 100644
--- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp
+++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp
@@ -2770,18 +2770,19 @@ void tst_qquicktext::lineLaidOutRelayout()
QVERIFY(!textPrivate->extra.isAllocated());
- qreal maxH = 0;
+ qreal y = 0.0;
for (int i = 0; i < textPrivate->layout.lineCount(); ++i) {
QTextLine line = textPrivate->layout.lineAt(i);
const QRectF r = line.rect();
- const qreal h = line.height();
if (r.x() == 0) {
- QCOMPARE(r.y(), i * h);
- maxH = qMax(maxH, r.y() + h);
+ QCOMPARE(r.y(), y);
} else {
+ if (qFuzzyIsNull(r.y()))
+ y = 0.0;
QCOMPARE(r.x(), myText->width() / 2);
- QCOMPARE(r.y(), i * h - maxH);
+ QCOMPARE(r.y(), y);
}
+ y += line.height();
}
}
diff --git a/tests/auto/quick/qquicktextinput/data/focusOnlyOneOnPress.qml b/tests/auto/quick/qquicktextinput/data/focusOnlyOneOnPress.qml
new file mode 100644
index 0000000000..037b36c8ff
--- /dev/null
+++ b/tests/auto/quick/qquicktextinput/data/focusOnlyOneOnPress.qml
@@ -0,0 +1,32 @@
+import QtQuick 2.2
+
+Rectangle {
+ width: 400
+ height: 400
+
+ Column {
+ spacing: 5
+ TextInput {
+ objectName: "first"
+ onEditingFinished: second.focus = true
+ width: 100
+ Rectangle { anchors.fill: parent; color: parent.activeFocus ? "red" : "blue"; opacity: 0.3 }
+ }
+ TextInput {
+ id: second
+ objectName: "second"
+ onEditingFinished: third.focus = true
+ width: 100
+ Rectangle { anchors.fill: parent; color: parent.activeFocus ? "red" : "blue"; opacity: 0.3 }
+ }
+ TextInput {
+ objectName: "third"
+ id: third
+ width: 100
+ Rectangle { anchors.fill: parent; color: parent.activeFocus ? "red" : "blue"; opacity: 0.3 }
+ }
+ Component.onCompleted: {
+ second.focus = true
+ }
+ }
+}
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index fb8900649f..18ccd81633 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -153,6 +153,7 @@ private slots:
#endif
void readOnly();
void focusOnPress();
+ void focusOnPressOnlyOneItem();
void openInputPanel();
void setHAlignClearCache();
@@ -3468,6 +3469,46 @@ void tst_qquicktextinput::focusOnPress()
QTest::mouseRelease(&window, Qt::LeftButton, noModifiers);
}
+void tst_qquicktextinput::focusOnPressOnlyOneItem()
+{
+ QQuickView window(testFileUrl("focusOnlyOneOnPress.qml"));
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowActive(&window);
+
+ QQuickTextInput *first = window.rootObject()->findChild<QQuickTextInput*>("first");
+ QQuickTextInput *second = window.rootObject()->findChild<QQuickTextInput*>("second");
+ QQuickTextInput *third = window.rootObject()->findChild<QQuickTextInput*>("third");
+
+ // second is focused onComplete
+ QVERIFY(second->hasActiveFocus());
+
+ // and first will try focus when we press it
+ QVERIFY(first->focusOnPress());
+
+ // write some text to start editing
+ QTest::keyClick(&window, Qt::Key_A);
+
+ // click the first input. naturally, we are giving focus on press, but
+ // second's editingFinished also attempts to assign focus. lastly, focus
+ // should bounce back to second from first's editingFinished signal.
+ //
+ // this is a contrived example to be sure, but at the end of this, the
+ // important thing is that only one thing should have activeFocus.
+ Qt::KeyboardModifiers noModifiers = 0;
+ QTest::mousePress(&window, Qt::LeftButton, noModifiers, QPoint(10, 10));
+
+ // make sure the press is processed.
+ QGuiApplication::processEvents();
+
+ QVERIFY(second->hasActiveFocus()); // make sure it's still there
+ QVERIFY(!third->hasActiveFocus()); // make sure it didn't end up anywhere else
+ QVERIFY(!first->hasActiveFocus()); // make sure it didn't end up anywhere else
+
+ // reset state
+ QTest::mouseRelease(&window, Qt::LeftButton, noModifiers, QPoint(10, 10));
+}
+
void tst_qquicktextinput::openInputPanel()
{
PlatformInputContext platformInputContext;