Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.12.0
-
None
-
Ubuntu 18.04
-
-
52ac0ea8cbdc9a2b8e895ceee09994fba229ee12 (qt/qtdeclarative/5.12)
Description
Hello,
I try to setup quicktests for a qml application. I need to use QUICK_TEST_MAIN_WITH_SETUP to setup some things (including an import path) in the qmlEngine before launching the tests.
I have the following minimal code:
#include <QtQuickTest> #include <QQmlEngine> #include <QQmlContext> #include <CircleCommon/CircleCommon.h> class Setup : public QObject { Q_OBJECTpublic: Setup() { qDebug() << "setup" ; }public slots: void applicationAvailable() { qDebug() << "appli available" ; } void qmlEngineAvailable(QQmlEngine *engine) { CircleCommon circleCommon; engine->addImportPath("/home/elisabeth/dev/sofa/build/CircleCommonData/qml/"); qDebug() << QCoreApplication::applicationDirPath(); } }; QUICK_TEST_MAIN_WITH_SETUP(example, Setup) #include "main.moc"
With this code my tests fail because the import path is not correctly set. If I launch the test with -import /home/elisabeth/dev/sofa/build/CircleCommonData/qml/ they pass. The qDebug calls seem to indicate that the setup slots are called after the tests instead of before the tests.
Is this a bug or did I do something wrong ?
Regards.