/ test / common.cpp
common.cpp
 1  #include "common.h"
 2  
 3  #include <QFileInfo>
 4  
 5  bool SPYWAIT(QSignalSpy& spy, int timeout) noexcept
 6  {
 7  	// For more details, see:
 8  	// http://stackoverflow.com/questions/22390208/google-test-mock-with-qt-signals
 9  	return spy.count() > 0 || spy.wait(timeout);
10  }
11  
12  QString GetRuntimeAbsolutePath() noexcept
13  {
14  	static const QFileInfo cs_runtime{ QStringLiteral(CMAKE_SOURCE_DIR)
15  		+ QStringLiteral("/src/gui/runtime") };
16  
17  	if (!cs_runtime.exists()) {
18  		qFatal("Unable to find GUI runtime!");
19  	}
20  
21  	return cs_runtime.absoluteFilePath();
22  }