First of all it should be stated whether the condition should be checked during compile or run time.
First of all it should be stated whether the condition should be checked during compile or run time.
TorAn (3rd June 2017)
Sorry, it was not clear. During compile time. Currently I am just moving the test methods from slot specification to regular methods. Perhaps there is a better way.
#ifdef might be a good way but I think moc doesn't obey ifdefs unless you explicitly pass them to it via a commandline switch. What you can do though is put the #ifdef in body of the test and add/remove a QSKIP macro.
Yes, you can conditionally skip tests using the QSKIP macro. The following provides an example to skip the database test if there is no database connection:
http://doc.qt.io/qt-4.8/qtest.html#QSKIP
Bookmarks