You're right, that line looks wrong indeed.

I've got a Qt version to debug now. I don't come that for, already exists at the TestCaseCollector (https://github.com/qt/qtdeclarative/blob/5.11/src/qmltest/quicktest.cpp#L493).

Internally this creates QQmlComponent and I can reproduce the error with:
    QGuiApplication app(argc, argv);

    QFileInfo fileInfo(":/tst_TestItem.qml");

    QQmlEngine engine;
    QQmlComponent component(&engine, fileInfo.absoluteFilePath());
    QList<QQmlError> errors = component.errors();

    for(const QQmlError &error : errors) {
        qWarning() << error.toString();
    }

    Q_ASSERT(errors.isEmpty());
fileIinfo.absoluteFilePath() resolves to ":/tst_TestItem.qml" which fails to load.

If manually changed to "qrc:/tst_TestItem.qml", it succeeds loading.

It seems the replacement from ":/" to "qrc:" like in the line you found needs to be applied in TestCaseCollector, too.

Christoph

On 25.04.18 16:08, Igor Mironchik wrote:

Hi,

if (path.startsWith(QLatin1String(":/")))
            view.setSource(QUrl(QLatin1String("qrc:") + path.midRef(2)));


Bug is here... path.midRef(1) should be

or

QLatin1String("qrc:/")


On 25.04.2018 16:16, Christoph Keller wrote:

They should, at least the source of the framework sets the path to ":/" on Android: https://github.com/qt/qtdeclarative/blob/5.11/src/qmltest/quicktest.cpp#L422

The same applies for the sourcePath property on all platforms: https://github.com/qt/qtdeclarative/blob/5.11/src/qmltest/quicktest.cpp#L536

My tst_TestItem.qml is loaded, but it can't find the normal QtQuick Item it should test.

Christoph


On 25.04.18 14:41, Igor Mironchik wrote:

Hi,


On 25.04.2018 15:19, Igor Mironchik wrote:

Hi,

Try qrc:/ as prefix...


Will not work too... Does qrc:/ supported by Qt Quick Test at all? Seems that no...


On 25.04.2018 13:53, Christoph Keller wrote:

Hello,

is there a way to run the QtQuick TestCases from qrc resources? Running them from the file system works as as expected but setting the source path to ":/" leads to the TestCase being loaded but it cannot find other imports (in the same directory).

I've attached an example which always outputs:

file::/tst_TestItem.qml:4:1: TestItem is not a type

TestItem {

^

Christoph



_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest




_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest



_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest



_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to