diff options
| author | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 18:45:07 +0300 |
|---|---|---|
| committer | Mehmet Samet Duman <yongdohyun@projecttick.org> | 2026-04-02 18:45:07 +0300 |
| commit | 31b9a8949ed0a288143e23bf739f2eb64fdc63be (patch) | |
| tree | 8a984fa143c38fccad461a77792d6864f3e82cd3 /meshmc/cmake/UnitTest | |
| parent | 934382c8a1ce738589dee9ee0f14e1cec812770e (diff) | |
| parent | fad6a1066616b69d7f5fef01178efdf014c59537 (diff) | |
| download | Project-Tick-31b9a8949ed0a288143e23bf739f2eb64fdc63be.tar.gz Project-Tick-31b9a8949ed0a288143e23bf739f2eb64fdc63be.zip | |
Add 'meshmc/' from commit 'fad6a1066616b69d7f5fef01178efdf014c59537'
git-subtree-dir: meshmc
git-subtree-mainline: 934382c8a1ce738589dee9ee0f14e1cec812770e
git-subtree-split: fad6a1066616b69d7f5fef01178efdf014c59537
Diffstat (limited to 'meshmc/cmake/UnitTest')
| -rw-r--r-- | meshmc/cmake/UnitTest/TestUtil.h | 29 | ||||
| -rw-r--r-- | meshmc/cmake/UnitTest/generate_test_data.cmake | 23 | ||||
| -rw-r--r-- | meshmc/cmake/UnitTest/test.manifest | 27 | ||||
| -rw-r--r-- | meshmc/cmake/UnitTest/test.rc | 28 |
4 files changed, 107 insertions, 0 deletions
diff --git a/meshmc/cmake/UnitTest/TestUtil.h b/meshmc/cmake/UnitTest/TestUtil.h new file mode 100644 index 0000000000..228905d46b --- /dev/null +++ b/meshmc/cmake/UnitTest/TestUtil.h @@ -0,0 +1,29 @@ +#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); + if (!f.open(QFile::ReadOnly)) + return QByteArray(); + return f.readAll(); + } + static QString readFileUtf8(const QString& fileName) + { + return QString::fromUtf8(readFile(fileName)); + } +}; + +#define GET_TEST_FILE(file) TestsInternal::readFile(QFINDTESTDATA(file)) +#define GET_TEST_FILE_UTF8(file) \ + TestsInternal::readFileUtf8(QFINDTESTDATA(file)) diff --git a/meshmc/cmake/UnitTest/generate_test_data.cmake b/meshmc/cmake/UnitTest/generate_test_data.cmake new file mode 100644 index 0000000000..d0bd4ab12e --- /dev/null +++ b/meshmc/cmake/UnitTest/generate_test_data.cmake @@ -0,0 +1,23 @@ +# Copy files from source directory to destination directory, substituting any +# variables. Create destination directory if it does not exist. + +function(configure_files srcDir destDir) + make_directory(${destDir}) + + file(GLOB templateFiles RELATIVE ${srcDir} ${srcDir}/*) + foreach(templateFile ${templateFiles}) + set(srcTemplatePath ${srcDir}/${templateFile}) + if(NOT IS_DIRECTORY ${srcTemplatePath}) + configure_file( + ${srcTemplatePath} + ${destDir}/${templateFile} + @ONLY + NEWLINE_STYLE LF + ) + else() + configure_files("${srcTemplatePath}" "${destDir}/${templateFile}") + endif() + endforeach() +endfunction() + +configure_files(${SOURCE} ${DESTINATION})
\ No newline at end of file diff --git a/meshmc/cmake/UnitTest/test.manifest b/meshmc/cmake/UnitTest/test.manifest new file mode 100644 index 0000000000..142891a121 --- /dev/null +++ b/meshmc/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="MeshMC.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> diff --git a/meshmc/cmake/UnitTest/test.rc b/meshmc/cmake/UnitTest/test.rc new file mode 100644 index 0000000000..64a383cbd9 --- /dev/null +++ b/meshmc/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", "Project Tick" + VALUE "FileDescription", "Testcase" + VALUE "FileVersion", "1.0.0.0" + VALUE "ProductName", "MeshMC Testcase" + VALUE "ProductVersion", "5" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0000, 0x04b0 // Unicode + END +END |
