diff options
author | Christoph Keller <gri@not-censored.com> | 2018-04-25 17:19:00 +0200 |
---|---|---|
committer | André Hartmann <aha_1980@gmx.de> | 2018-05-13 11:42:08 +0000 |
commit | 6888f9b025bdfd1a256ddbc2dc1bb8e7dd66af61 (patch) | |
tree | f1b2e7f3320f176572756c93eff3613b3e3afeee /src/qmltest | |
parent | 1f3713a2b40a467e8a8c552d0980dbdd9f7a1ab4 (diff) |
Fix TestCaseCollector fails to initialize component from resources
Change-Id: I9f1e20653776bbdf1a8a41a631636ec61ddd08b6
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qmltest')
-rw-r--r-- | src/qmltest/quicktest.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp index a02a0a806d..8b9ff4c5cd 100644 --- a/src/qmltest/quicktest.cpp +++ b/src/qmltest/quicktest.cpp @@ -207,7 +207,11 @@ public: TestCaseCollector(const QFileInfo &fileInfo, QQmlEngine *engine) { - QQmlComponent component(engine, fileInfo.absoluteFilePath()); + QString path = fileInfo.absoluteFilePath(); + if (path.startsWith(QLatin1String(":/"))) + path.prepend(QLatin1String("qrc")); + + QQmlComponent component(engine, path); m_errors += component.errors(); if (component.isReady()) { @@ -534,7 +538,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch QTestRootObject::instance()->init(); QString path = fi.absoluteFilePath(); if (path.startsWith(QLatin1String(":/"))) - view.setSource(QUrl(QLatin1String("qrc:") + path.midRef(2))); + view.setSource(QUrl(QLatin1String("qrc:") + path.midRef(1))); else view.setSource(QUrl::fromLocalFile(path)); |