Files
OpenVulkano/tests/Host/Windows/ResourceLoaderTests.cpp

36 lines
1.1 KiB
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#include <catch2/catch_all.hpp>
#include "Host/Windows/EmbeddedResourceLoaderWindows.hpp"
#include "Base/Logger.hpp"
#include "../resources/resource.h"
#include <Windows.h>
#include <filesystem>
#include <fstream>
using namespace OpenVulkano;
TEST_CASE("Load icon")
{
Logger::SetupLogger("", "tests.log");
EmbeddedResourceLoaderWindows loader;
// the icon is split into RT_GROUP_ICON and RT_ICON. resource.h defines RT_GROUP_ICON entry
// RT_GROUP_ICON data
Array<char> groupData = loader.GetResource(MAKEINTRESOURCE(IDI_MADVOXEL_ICON), RT_GROUP_ICON);
// load resource that has no numeric ID
Array<char> groupData2 = loader.GetResource("MADVOXEL_ICON", RT_GROUP_ICON);
REQUIRE((!groupData.Empty() && groupData.Size() == groupData2.Size()));
// ICON data
Array<char> iconData = loader.GetResource(MAKEINTRESOURCE(1), RT_ICON);
REQUIRE((!iconData.Empty() && iconData.Size() == 194344));
}