#include "test.h" #include /** * @brief Return path to source directory * @param subpath ( e.g. test/data ) * @return absolute path to desired subpath in source folder */ QString Test::sourcePath(const QString &subpath) { const QString path = QStringLiteral(SDK_TEST_PATH); QDir dir(path); return dir.absoluteFilePath(subpath); } /** * @brief Return data from source directory * @param subpath ( e.g. test/data/gizp.src ) * @return data of file - QByteArray */ QByteArray Test::sourceData(const QString &subpath) { // Get data from file QString filePath = sourcePath(subpath); if (! QFileInfo::exists(filePath)) { qWarning() << "path does not exists:" << filePath; return QByteArray(); } QFile file(filePath); if ( file.open(QIODevice::ReadOnly) ) return file.readAll(); return QByteArray(); }