diff options
author | Wang Chuan <ouchuanm@outlook.com> | 2020-08-15 15:26:51 +0800 |
---|---|---|
committer | Wang Chuan <ouchuanm@outlook.com> | 2020-08-22 17:02:38 +0000 |
commit | 3d195d33ece3f8fd7cd7d8e6163fe038fc7fc036 (patch) | |
tree | f2947bb1ef53e99d3d56167e5a33f23b3e87b34c /tests/auto/quick | |
parent | b953bd67d4134b9af3e554a0287a462ddf2de5f7 (diff) |
QQuickLoader: make sure the status property change properly
When we call [setSource] in qml, we will try to convert a qml value to
a string which indicate the url we want to load. However, if this value
is undefined, it will convert to a string with content "undefined", and
then cause loading error. More worse, if there is a qml file named
"undefined", it will be loaded to the Loader.
Pick-to: 5.15
Fixes: QTBUG-85938
Change-Id: I5b192ba84aa29532e547349bbf37d413c107d8e4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/qquickloader/tst_qquickloader.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index ed3aa09767..a53b08d1b7 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -1491,6 +1491,9 @@ void tst_QQuickLoader::setSourceAndCheckStatus() QMetaObject::invokeMethod(loader, "load", Q_ARG(QVariant, QVariant::fromValue(QStringLiteral("")))); QCOMPARE(loader->status(), QQuickLoader::Null); + + QMetaObject::invokeMethod(loader, "load", Q_ARG(QVariant, QVariant())); + QCOMPARE(loader->status(), QQuickLoader::Null); } QTEST_MAIN(tst_QQuickLoader) |