tst_qquickloader: Test setting source from component works

Not verifying this works before has caused regressions.

Change-Id: I4b99928bb6993d511349aec782660d24a134f67d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Maximilian Goldstein 2020-10-30 11:35:00 +01:00
parent f84282dad7
commit 92aeac07fa
4 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,3 @@
import QtQuick
Item {}

View File

@ -0,0 +1,5 @@
import QtQuick
Item {
Component.onCompleted: { loader.setSource("empty.qml"); }
}

View File

@ -0,0 +1,6 @@
import QtQuick
Loader {
id: loader
source: "loaderSelfSource.qml"
}

View File

@ -114,6 +114,7 @@ private slots:
void asyncToSync1();
void asyncToSync2();
void loadedSignal();
void selfSetSource();
void parented();
void sizeBound();
@ -1142,6 +1143,17 @@ void tst_QQuickLoader::loadedSignal()
}
}
void tst_QQuickLoader::selfSetSource()
{
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("selfSetSourceTest.qml"));
QScopedPointer<QObject> obj(component.create());
QVERIFY(obj);
QTRY_COMPARE(obj->property("source").toUrl(), testFileUrl("empty.qml"));
}
void tst_QQuickLoader::parented()
{
QQmlEngine engine;