createTemporaryQmlObject import path
Unsolved
QML and Qt Quick
-
So I've got a SUBDIRS project that has two directories called App and Tests. I've got a Bubba.qml under App, which is something I want to write tests for (in the Tests sub project).
In the Tests project, if I create a tst_Tests.qml file and do:
import QtQuick 2.0 import QtTest 1.0 import "../App" TestCase { ... Bubba { } }
It resolves just fine.
However, if I do what I want to do, which is add a function:
function test_bubba() { var item = createTemporaryQmlObject("import QtQuick 2.0; import \"../App\"; Bubba {}", testCase); compare(item.color, "blue") mouseClick(item, 0, 0, Qt.LeftButton); compare(item.color, "gray") }
It fails in createTemporaryQmlObject with:
test::MathTests::test_bubba
Uncaught exception: Qt.createQmlObject(): failed to create object:
file:///C:/Qt/Qt5.9.0/5.9/mingw53_32/qml/QtTest/undefined:1:21: "../App": no such directoryAny suggestions on how to get createTemporaryQmlObject to see this relative path, or a different way of having tests separated from the main code?