From e8ba5dafc63de65ed8a469353b808e391633f0fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 13 Apr 2016 01:24:55 +0200 Subject: NOISSUE remove dead unit tests and reorganize CMake code related to unit tests --- cmake/UnitTest/TestUtil.h | 28 ++++++++++++++++++++++++++++ cmake/UnitTest/generate_test_data.cmake | 26 ++++++++++++++++++++++++++ cmake/UnitTest/test.manifest | 27 +++++++++++++++++++++++++++ cmake/UnitTest/test.rc | 28 ++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+) create mode 100644 cmake/UnitTest/TestUtil.h create mode 100644 cmake/UnitTest/generate_test_data.cmake create mode 100644 cmake/UnitTest/test.manifest create mode 100644 cmake/UnitTest/test.rc (limited to 'cmake/UnitTest') diff --git a/cmake/UnitTest/TestUtil.h b/cmake/UnitTest/TestUtil.h new file mode 100644 index 00000000..84f18a2e --- /dev/null +++ b/cmake/UnitTest/TestUtil.h @@ -0,0 +1,28 @@ +#pragma once + +#include +#include +#include +#include + +#define expandstr(s) expandstr2(s) +#define expandstr2(s) #s + +class TestsInternal +{ +public: + static QByteArray readFile(const QString &fileName) + { + QFile f(fileName); + f.open(QFile::ReadOnly); + return f.readAll(); + } + static QString readFileUtf8(const QString &fileName) + { + return QString::fromUtf8(readFile(fileName)); + } +}; + +#define MULTIMC_GET_TEST_FILE(file) TestsInternal::readFile(QFINDTESTDATA(file)) +#define MULTIMC_GET_TEST_FILE_UTF8(file) TestsInternal::readFileUtf8(QFINDTESTDATA(file)) + diff --git a/cmake/UnitTest/generate_test_data.cmake b/cmake/UnitTest/generate_test_data.cmake new file mode 100644 index 00000000..9de7410b --- /dev/null +++ b/cmake/UnitTest/generate_test_data.cmake @@ -0,0 +1,26 @@ +# Copy files from source directory to destination directory, substituting any +# variables. Create destination directory if it does not exist. + +function(configure_files srcDir destDir) + message(STATUS "Configuring directory ${destDir} from ${srcDir}") + make_directory(${destDir}) + + file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*) + foreach(templateFile ${templateFiles}) + set(srcTemplatePath ${srcDir}/${templateFile}) + if(NOT IS_DIRECTORY ${srcTemplatePath}) + message(STATUS "Configuring file ${templateFile}") + configure_file( + ${srcTemplatePath} + ${destDir}/${templateFile} + @ONLY + NEWLINE_STYLE LF + ) + else() + message(STATUS "Recursing? ${srcTemplatePath}") + configure_files("${srcTemplatePath}" "${destDir}/${templateFile}") + endif() + endforeach() +endfunction() + +configure_files(${SOURCE} ${DESTINATION}) \ No newline at end of file diff --git a/cmake/UnitTest/test.manifest b/cmake/UnitTest/test.manifest new file mode 100644 index 00000000..8b4dbb98 --- /dev/null +++ b/cmake/UnitTest/test.manifest @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + Custom Minecraft launcher for managing multiple installs. + + + + + + + + + + + \ No newline at end of file diff --git a/cmake/UnitTest/test.rc b/cmake/UnitTest/test.rc new file mode 100644 index 00000000..a288dba6 --- /dev/null +++ b/cmake/UnitTest/test.rc @@ -0,0 +1,28 @@ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + +1 RT_MANIFEST "test.manifest" + +VS_VERSION_INFO VERSIONINFO +FILEVERSION 1,0,0,0 +FILEOS VOS_NT_WINDOWS32 +FILETYPE VFT_APP +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "CompanyName", "MultiMC Contributors" + VALUE "FileDescription", "Testcase" + VALUE "FileVersion", "1.0.0.0" + VALUE "ProductName", "MultiMC Testcase" + VALUE "ProductVersion", "5" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0000, 0x04b0 // Unicode + END +END -- cgit v1.2.3