[Qbs] Qt Quick Tests and custom import paths

Christian Kandeler christian.kandeler at qt.io
Tue May 15 15:45:35 CEST 2018


On Tue, 15 May 2018 15:19:49 +0200
Federico Frenguelli <synasius at gmail.com> wrote:

> I'm writing a test for a qt quick component and I need to add "qrc:/qml" to
> the qml import paths.
> One way would be to add custom arguments to the AutotestRunner:
> 
> AutotestRunner {
>     arguments: ["-import", "qrc:/qml"]
> }
> 
> but then tests fail when I mix cpp tests with qt quick tests. 

Yes, the arguments property is rather inflexible in that is applied to all tests.

> Do you know of any workaround to make this work?

I'm not a QtQuick expert, but can't you just use the QML2_IMPORT_PATH variable?

AutotestRunner {
    environment: base.concat("QML2_IMPORT_PATH=qrc:/qml")
}


Christian



More information about the Qbs mailing list