1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#include "TestUtils.h"
#include <QDebug>
#include <QFile>
QByteArray loadFile(const QString& path) {
QFile file(path);
if (!file.open(QIODevice::ReadOnly)) {
qCritical() << "Could not load" << path << ":" << file.errorString();
return {};
}
return file.readAll();
}
QtDebugSilencer::QtDebugSilencer() {
auto silentHandler = [](QtMsgType, const QMessageLogContext&, const QString&) {};
mOldHandler = qInstallMessageHandler(silentHandler);
}
QtDebugSilencer::~QtDebugSilencer() {
qInstallMessageHandler(mOldHandler);
}
std::ostream& operator<<(std::ostream& ostr, const QString& str) {
ostr << '"' << str.toStdString() << '"';
return ostr;
}
std::ostream& operator<<(std::ostream& ostr, const QUrl& url) {
ostr << '"' << url.toEncoded().constData() << '"';
return ostr;
}
|