On Wed, Apr 23, 2014 at 1:18 AM, Luca Bonifacio <luca.bonifa...@bbv.ch> wrote: > Hi everyone > > > > Actually, I’m getting serious problems by setting up a Qt/QML project > integrating also unit tests for a multi-platform mobile application. The > idea is to set up a project skeleton for the development of applications, > which will run on Android and iOS; and at the same time, the unit tests will > be executed on a continuous integration server. > > For that purpose, I initially defined a subdirs project containing two > projects: one for the application and one for the unit tests. > > The HelloWorld application ran without any problems on both platforms. Also > the unit test written in QML worked fine. > > > > The problems began when I started to write my unit tests for the QML file > that embeds C++ objects. By running the unit tests on the QML component that > uses C++ objects, errors are displayed on the console: the C++ objects are > not found. That makes also sense cause the C++ objects are set in the > main.cpp file by using setContextProperty on my root context view. To get > around to the problem I decided to do the following: > > 1. Mock the C++ objects in my QML unit tests, and > > 2. Add a new unit tests project for the C++ part. > > > > For the first item, unfortunately, I didn’t find any information or example > about how to mock a C++ object in QML. >
http://qt-project.org/doc/qt-5/qtquick-qmlscene.html#loading-test-data It's a little out of date, the same functionality exists in the newer 'qml' binary. -- Alan Alpert _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest