aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-02-13 01:03:07 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2020-02-13 13:09:47 +0100
commitd5a5e9dcd594e2d2f3dbb05fdb0baf56cc50774d (patch)
tree4c6979394422c97dc21bc8b6e7852e1998eafb25 /tests/auto
parent229e3220ef521dd4389808fd311ea5ae33ab0cae (diff)
parentac0ce38dcfeeded87db0c1dd5d348f5ed6fc1af3 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Conflicts: src/qml/jsruntime/qv4engine.cpp Change-Id: I61f41672e2dfe7e542ca30fed5f173d0a9ee3412
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qjsvalue/tst_qjsvalue.cpp7
-rw-r--r--tests/auto/qml/qqmlconnections/data/underscore.qml14
-rw-r--r--tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp15
-rw-r--r--tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp20
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml31
-rw-r--r--tests/auto/quick/qquickloader/data/statusChanged.qml16
-rw-r--r--tests/auto/quick/qquickloader/tst_qquickloader.cpp14
7 files changed, 116 insertions, 1 deletions
diff --git a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
index d6e85f973f..b561e5f398 100644
--- a/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
+++ b/tests/auto/qml/qjsvalue/tst_qjsvalue.cpp
@@ -1128,6 +1128,10 @@ void tst_QJSValue::toVariant()
// array
{
+ auto handler = qInstallMessageHandler([](QtMsgType type, const QMessageLogContext &, const QString &) {
+ if (type == QtMsgType::QtWarningMsg)
+ QFAIL("Converting QJSValue to QVariant should not cause error messages");
+ });
QVariantList listIn;
listIn << 123 << "hello";
QJSValue array = eng.toScriptValue(listIn);
@@ -1145,8 +1149,9 @@ void tst_QJSValue::toVariant()
QCOMPARE(array2.property("length").toInt(), array.property("length").toInt());
for (int i = 0; i < array.property("length").toInt(); ++i)
QVERIFY(array2.property(i).strictlyEquals(array.property(i)));
- }
+ qInstallMessageHandler(handler);
+ }
}
void tst_QJSValue::toQObject_nonQObject_data()
diff --git a/tests/auto/qml/qqmlconnections/data/underscore.qml b/tests/auto/qml/qqmlconnections/data/underscore.qml
new file mode 100644
index 0000000000..0f73dc8f17
--- /dev/null
+++ b/tests/auto/qml/qqmlconnections/data/underscore.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.12
+
+Item {
+ id: item
+ property bool success: false
+ property bool sanityCheck: false
+ property int __underscore_property: 0
+ on__Underscore_propertyChanged: item.sanityCheck = true
+
+ Connections {
+ target: item
+ on__Underscore_propertyChanged: item.success = true
+ }
+}
diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
index 07af519a3d..f144002875 100644
--- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
+++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp
@@ -77,6 +77,8 @@ private slots:
void noAcceleratedGlobalLookup_data() { prefixes(); }
void noAcceleratedGlobalLookup();
+ void bindToPropertyWithUnderscoreChangeHandler();
+
private:
QQmlEngine engine;
void prefixes();
@@ -474,6 +476,19 @@ void tst_qqmlconnections::noAcceleratedGlobalLookup()
QCOMPARE(val.toInt(), int(Proxy::EnumValue));
}
+void tst_qqmlconnections::bindToPropertyWithUnderscoreChangeHandler()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("underscore.qml"));
+ QScopedPointer<QObject> root {component.create()};
+ QVERIFY(root);
+ QQmlProperty underscoreProperty(root.get(), "__underscore_property");
+ QVERIFY(underscoreProperty.isValid());
+ underscoreProperty.write(42);
+ QVERIFY(root->property("sanityCheck").toBool());
+ QVERIFY(root->property("success").toBool());
+}
+
QTEST_MAIN(tst_qqmlconnections)
#include "tst_qqmlconnections.moc"
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
index 166437c8de..8a96fc52c5 100644
--- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
+++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp
@@ -162,6 +162,8 @@ private slots:
void bindingToAlias();
void nestedQQmlPropertyMap();
+
+ void underscorePropertyChangeHandler();
private:
QQmlEngine engine;
};
@@ -2190,6 +2192,24 @@ void tst_qqmlproperty::nestedQQmlPropertyMap()
QCOMPARE(success.read().toString(), QLatin1String("success"));
}
+void tst_qqmlproperty::underscorePropertyChangeHandler()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData(R"(
+ import QtQuick 2.12
+
+ Item {
+ property int __withUnderScore
+ }
+ )", QUrl::fromLocalFile("."));
+ QScopedPointer<QObject> root { component.create() };
+ QVERIFY(root);
+ QQmlProperty changeHandler(root.get(), "on__WithUnderScoreChanged");
+ QVERIFY(changeHandler.isValid());
+ QVERIFY(changeHandler.isSignalProperty());
+}
+
QTEST_MAIN(tst_qqmlproperty)
#include "tst_qqmlproperty.moc"
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index 07af6a77ac..0732884c97 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -1100,5 +1100,36 @@ Item {
waitForRendering(rootRect.layout)
compare(rootRect.item1.width, 100)
}
+
+//---------------------------
+ Component {
+ id: rowlayoutWithTextItems_Component
+ RowLayout {
+ Text {
+ Layout.fillWidth: true
+ text: "OneWord"
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ }
+ Text {
+ Layout.fillWidth: true
+ text: "OneWord"
+ wrapMode: Text.WrapAtWordBoundaryOrAnywhere
+ }
+ }
+ }
+
+ // QTBUG-73683
+ function test_rowlayoutWithTextItems() {
+ var layout = createTemporaryObject(rowlayoutWithTextItems_Component, container)
+ waitForRendering(layout)
+ for (var i = 0; i < 3; i++) {
+ ignoreWarning(/Qt Quick Layouts: Detected recursive rearrange. Aborting after two iterations./)
+ }
+ ignoreWarning(/Qt Quick Layouts: Polish loop detected. Aborting after two iterations./)
+ layout.width = layout.width - 2 // set the size to be smaller than its "minimum size"
+ waitForRendering(layout) // do not exit before all warnings have been received
+
+ // DO NOT CRASH due to stack overflow (or loop endlessly due to updatePolish()/polish() loop)
+ }
}
}
diff --git a/tests/auto/quick/qquickloader/data/statusChanged.qml b/tests/auto/quick/qquickloader/data/statusChanged.qml
new file mode 100644
index 0000000000..fe46bc7b24
--- /dev/null
+++ b/tests/auto/quick/qquickloader/data/statusChanged.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.12
+import QtQuick.Window 2.12
+
+Window {
+ id: root
+ property int statusChangedCounter: 0
+ property alias status: loader.status
+ visible: true; width: 640; height: 480
+ Loader {
+ id: loader
+ anchors.fill: parent
+ asynchronous: true
+ source: "./RedRect.qml"
+ onStatusChanged: root.statusChangedCounter++
+ }
+}
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
index e05b7ae9ce..91d0bcab2e 100644
--- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp
+++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp
@@ -39,6 +39,7 @@
#include "testhttpserver.h"
#include "../../shared/util.h"
#include "../shared/geometrytestutil.h"
+#include <QQmlApplicationEngine>
Q_LOGGING_CATEGORY(lcTests, "qt.quick.tests")
@@ -128,6 +129,7 @@ private slots:
void rootContext();
void sourceURLKeepComponent();
+ void statusChangeOnlyEmittedOnce();
};
Q_DECLARE_METATYPE(QList<QQmlError>)
@@ -1456,6 +1458,18 @@ void tst_QQuickLoader::sourceURLKeepComponent()
}
+// QTBUG-82002
+void tst_QQuickLoader::statusChangeOnlyEmittedOnce()
+{
+ QQmlApplicationEngine engine;
+ auto url = testFileUrl("statusChanged.qml");
+ engine.load(url);
+ auto root = engine.rootObjects().at(0);
+ QVERIFY(root);
+ QTRY_COMPARE(QQuickLoader::Status(root->property("status").toInt()), QQuickLoader::Ready);
+ QCOMPARE(root->property("statusChangedCounter").toInt(), 2); // 1xLoading + 1xReady*/
+}
+
QTEST_MAIN(tst_QQuickLoader)
#include "tst_qquickloader.moc"