diff options
author | Andrew <forkk@forkk.net> | 2013-12-15 15:01:34 -0600 |
---|---|---|
committer | Andrew <forkk@forkk.net> | 2013-12-15 15:01:34 -0600 |
commit | 9d8006b597aead06f1d51dacbdb346ebab3d5e8f (patch) | |
tree | 1f99ca1da321be32930198e3d72b2fc9d3bf53de /tests/TestUtil.h | |
parent | 0ee8f90d40f5b3ddb177286c9066a4e59748c681 (diff) | |
parent | b0e8037feb5b9d48defe6b8263d068f87bdb141c (diff) | |
download | PrismLauncher-9d8006b597aead06f1d51dacbdb346ebab3d5e8f.tar.gz PrismLauncher-9d8006b597aead06f1d51dacbdb346ebab3d5e8f.tar.bz2 PrismLauncher-9d8006b597aead06f1d51dacbdb346ebab3d5e8f.zip |
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into feature_news
Conflicts:
CMakeLists.txt
Diffstat (limited to 'tests/TestUtil.h')
-rw-r--r-- | tests/TestUtil.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/TestUtil.h b/tests/TestUtil.h new file mode 100644 index 00000000..64ee1675 --- /dev/null +++ b/tests/TestUtil.h @@ -0,0 +1,31 @@ +#pragma once + +#include <QFile> +#include <QCoreApplication> +#include <QTest> +#include <QDir> + +#include "MultiMC.h" + +struct TestsInternal +{ + static QByteArray readFile(const QString &fileName) + { + QFile f(fileName); + f.open(QFile::ReadOnly); + return f.readAll(); + } +}; + +#define MULTIMC_GET_TEST_FILE(file) TestsInternal::readFile(QFINDTESTDATA( file )) + +#define QTEST_GUILESS_MAIN_MULTIMC(TestObject) \ +int main(int argc, char *argv[]) \ +{ \ + char *argv_[] = { argv[0] }; \ + int argc_ = 1; \ + MultiMC app(argc_, argv_, QDir::temp().absoluteFilePath("MultiMC_Test")); \ + app.setAttribute(Qt::AA_Use96Dpi, true); \ + TestObject tc; \ + return QTest::qExec(&tc, argc, argv); \ +} |