View Full Version : create QApplication in a dll for uni tests

13th July 2012, 17:58

I am creating unit tests for my Qt project using cppunit and my goal is to be able to initiate a map control, add graphics and other objects to map control when unit tests are run. Basically trying to make it UI based automated tests.

I have created a map widget application and wrapped it in to a dll. This is what I want to consume in my tests and draw stuff on it on the fly while running UI tests. My issue is that now I have QApplication inside a dll and once the exec has been called on QApplication it goes out of my control. What should I do to get control back so that I can get hold of map object and add stuff to it.


Added after 13 minutes:

Is there any kind of Signal that QApplication emits, once it is done creation of the application(i.e. UI has been created) ?????

13th July 2012, 23:25
You can call QMetaObject::invokeMethod() to schedule execution of a method (slot) once the application enters the event loop.

16th July 2012, 19:19
Hey Thanks ... that should help.