/* * 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 #include "Host/Windows/EmbeddedResourceLoaderWindows.hpp" #include "Base/Logger.hpp" #include "../resources/resource.h" #include #include #include 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 groupData = loader.GetResource(MAKEINTRESOURCE(IDI_MADVOXEL_ICON), RT_GROUP_ICON); // load resource that has no numeric ID Array groupData2 = loader.GetResource("MADVOXEL_ICON", RT_GROUP_ICON); // load resource providing it's full name entry from .rc file without specifying explicit resource type Array groupData3 = loader.GetResource("MADVOXEL_ICON"); REQUIRE((!groupData.Empty() && !groupData2.Empty() && !groupData3.Empty())); REQUIRE((groupData.Size() == groupData2.Size() && groupData2.Size() == groupData3.Size())); // ICON data Array iconData = loader.GetResource(MAKEINTRESOURCE(1), RT_ICON); REQUIRE((!iconData.Empty() && iconData.Size() == 194344)); // non-existing resources Array nonExistingRes = loader.GetResource(1234, RT_FONT); Array nonExistingRes2 = loader.GetResource("NON_EXISTING_ICON", RT_GROUP_ICON); REQUIRE((nonExistingRes.Empty() && nonExistingRes2.Empty())); } TEST_CASE("Load archive") { EmbeddedResourceLoaderWindows loader; Array zipData = loader.GetResource(MAKEINTRESOURCE(ARCHIVE_RCDATA), RT_RCDATA); REQUIRE(!zipData.Empty()); }