I used QApplication objects in gTest in Visual Studio.
int argc = 0;
char **argv = 0;
QMainWindow *window;
TEST() {
app = new QApplication(argc, argv);
window = new QMainWindow();
// Test Execution
// Data gathering
app.exec();
delete window;
window = new QMainWindow();
delete app;
app = new QApplication(argc, argv);
// Test Execution
// Data gathering
app.exec();
}
And it works pretty well.
If i am using the same snippet with Linux and the windows generated on the second call of exec()
is empty and I have to kill the execution.
What is missing to get that working with Linux.
Making two separate tests does not work either
Ronny Brendel had the right Question in the comment.
The solution is not to reinitialize the QApplication.
delete app;
app = new QApplication(argc, argv);
must be removed.