diff options
Diffstat (limited to 'cmake/UnitTest')
-rw-r--r-- | cmake/UnitTest/TestUtil.h | 28 | ||||
-rw-r--r-- | cmake/UnitTest/generate_test_data.cmake | 26 | ||||
-rw-r--r-- | cmake/UnitTest/test.manifest | 27 | ||||
-rw-r--r-- | cmake/UnitTest/test.rc | 28 |
4 files changed, 109 insertions, 0 deletions
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 <QFile> +#include <QCoreApplication> +#include <QTest> +#include <QDir> + +#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 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> + <assemblyIdentity name="MultiMC.Test.0" type="win32" version="5.0.0.0" /> + <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> + <security> + <requestedPrivileges> + <requestedExecutionLevel level="asInvoker" uiAccess="false"/> + </requestedPrivileges> + </security> + </trustInfo> + <dependency> + <dependentAssembly> + <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="x86" publicKeyToken="6595b64144ccf1df" language="*"/> + </dependentAssembly> + </dependency> + <description>Custom Minecraft launcher for managing multiple installs.</description> + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <!--The ID below indicates app support for Windows Vista --> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> + <!--The ID below indicates app support for Windows 7 --> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> + <!--The ID below indicates app support for Windows Developer Preview / Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + </application> + </compatibility> +</assembly>
\ 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 <windows.h> + +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 |