How to initialize QTest framework for a osgQt GUI app
Unsolved
General and Desktop
-
Hello,
I am trying to initialize the QTest library for an application using osgQt in the following recommended way:
QTEST_MAIN(InterfaceTests)
However, this macro seems to create a QCoreApplication, which does not support GUI library use, as seen below:
#define QTEST_MAIN(TestObject) \ int main(int argc, char *argv[]) \ { \ QCoreApplication app(argc, argv); \ app.setAttribute(Qt::AA_Use96Dpi, true); \ TestObject tc; \ QTEST_SET_MAIN_SOURCE_PATH \ return QTest::qExec(&tc, argc, argv); \ }
What would be the correct way of initializing tests for a GUI application with osg?
Thank you in advance.
-
@Cyrus-P. said in How to initialize QTest framework for a osgQt GUI app:
QTEST_MAIN
You're looking at the wrong place: https://code.woboq.org/qt5/qtbase/src/testlib/qtest.h.html#427
The macro is using QApplication when you link against QtWidgets (and therefore QT_WIDGETS_LIB is defined) or QGuiApplication when you only link against QtGui (and therefore QT_GUI_LIB is defined)