mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
chore: fix test compilation
This commit is contained in:
parent
83d13aa166
commit
692c31b711
@ -1,7 +1,6 @@
|
|||||||
#include "Game/IW3/StringTable/AssetLoaderStringTableIW3.h"
|
#include "Game/IW3/StringTable/AssetLoaderStringTableIW3.h"
|
||||||
|
|
||||||
#include "Game/IW3/GameIW3.h"
|
#include "Game/IW3/GameIW3.h"
|
||||||
#include "Mock/MockAssetLoadingManager.h"
|
|
||||||
#include "Mock/MockSearchPath.h"
|
#include "Mock/MockSearchPath.h"
|
||||||
#include "Pool/ZoneAssetPools.h"
|
#include "Pool/ZoneAssetPools.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
@ -22,24 +21,19 @@ namespace
|
|||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW3));
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW3));
|
||||||
zone.m_pools = ZoneAssetPools::CreateForGame(GameId::IW3, &zone, 1);
|
|
||||||
|
|
||||||
const auto assetTypeCount = zone.m_pools->GetAssetTypeCount();
|
|
||||||
for (auto i = 0; i < assetTypeCount; i++)
|
|
||||||
zone.m_pools->InitPoolDynamic(i);
|
|
||||||
|
|
||||||
MemoryManager memory;
|
MemoryManager memory;
|
||||||
AssetCreatorCollection creatorCollection(zone);
|
AssetCreatorCollection creatorCollection(zone);
|
||||||
AssetLoaderStringTable assetLoader(memory, searchPath);
|
|
||||||
IgnoredAssetLookup ignoredAssetLookup;
|
IgnoredAssetLookup ignoredAssetLookup;
|
||||||
|
|
||||||
AssetCreationContext context(&zone, &creatorCollection, &ignoredAssetLookup);
|
AssetCreationContext context(&zone, &creatorCollection, &ignoredAssetLookup);
|
||||||
|
|
||||||
const auto result = assetLoader.CreateAsset("mp/cooltable.csv", context);
|
auto loader = CreateStringTableLoader(memory, searchPath);
|
||||||
|
auto result = loader->CreateAsset("mp/cooltable.csv", context);
|
||||||
REQUIRE(result.HasBeenSuccessful());
|
REQUIRE(result.HasBeenSuccessful());
|
||||||
|
|
||||||
const auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(result.GetAssetInfo());
|
const auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(result.GetAssetInfo());
|
||||||
const auto* stringTable = assetInfo->Asset();
|
const auto* stringTable = assetInfo->Asset();
|
||||||
|
|
||||||
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
||||||
REQUIRE(stringTable->columnCount == 3);
|
REQUIRE(stringTable->columnCount == 3);
|
||||||
REQUIRE(stringTable->rowCount == 2);
|
REQUIRE(stringTable->rowCount == 2);
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#include "Game/IW4/AssetLoaders/AssetLoaderStringTable.h"
|
#include "Game/IW4/StringTable/LoaderStringTableIW4.h"
|
||||||
|
|
||||||
#include "Game/IW4/CommonIW4.h"
|
#include "Game/IW4/CommonIW4.h"
|
||||||
#include "Game/IW4/GameIW4.h"
|
#include "Game/IW4/GameIW4.h"
|
||||||
#include "Mock/MockAssetLoadingManager.h"
|
|
||||||
#include "Mock/MockSearchPath.h"
|
#include "Mock/MockSearchPath.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
|
|
||||||
@ -22,17 +21,19 @@ namespace
|
|||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW4));
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW4));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
|
||||||
MemoryManager memory;
|
MemoryManager memory;
|
||||||
|
AssetCreatorCollection creatorCollection(zone);
|
||||||
|
IgnoredAssetLookup ignoredAssetLookup;
|
||||||
|
AssetCreationContext context(&zone, &creatorCollection, &ignoredAssetLookup);
|
||||||
|
|
||||||
assetLoader.LoadFromRaw("mp/cooltable.csv", &searchPath, &memory, &assetLoadingManager, &zone);
|
auto loader = CreateStringTableLoader(memory, searchPath);
|
||||||
|
auto result = loader->CreateAsset("mp/cooltable.csv", context);
|
||||||
auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(assetLoadingManager.MockGetAddedAsset("mp/cooltable.csv"));
|
REQUIRE(result.HasBeenSuccessful());
|
||||||
REQUIRE(assetInfo != nullptr);
|
|
||||||
|
|
||||||
|
const auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(result.GetAssetInfo());
|
||||||
const auto* stringTable = assetInfo->Asset();
|
const auto* stringTable = assetInfo->Asset();
|
||||||
|
|
||||||
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
||||||
REQUIRE(stringTable->columnCount == 3);
|
REQUIRE(stringTable->columnCount == 3);
|
||||||
REQUIRE(stringTable->rowCount == 2);
|
REQUIRE(stringTable->rowCount == 2);
|
@ -1,6 +1,6 @@
|
|||||||
#include "Game/IW4/AssetLoaders/AssetLoaderMenuList.h"
|
#include "Game/IW4/Menu/LoaderMenuListIW4.h"
|
||||||
|
|
||||||
#include "Game/IW4/GameIW4.h"
|
#include "Game/IW4/GameIW4.h"
|
||||||
#include "Mock/MockAssetLoadingManager.h"
|
|
||||||
#include "Mock/MockSearchPath.h"
|
#include "Mock/MockSearchPath.h"
|
||||||
#include "Parsing/Menu/MenuFileReader.h"
|
#include "Parsing/Menu/MenuFileReader.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
@ -8,6 +8,7 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include <catch2/generators/catch_generators.hpp>
|
#include <catch2/generators/catch_generators.hpp>
|
||||||
#include <catch2/matchers/catch_matchers_floating_point.hpp>
|
#include <catch2/matchers/catch_matchers_floating_point.hpp>
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
using namespace menu;
|
using namespace menu;
|
||||||
@ -23,14 +24,19 @@ namespace test::game::iw4::menu::parsing::it
|
|||||||
|
|
||||||
Zone m_zone;
|
Zone m_zone;
|
||||||
MockSearchPath m_search_path;
|
MockSearchPath m_search_path;
|
||||||
MockAssetLoadingManager m_manager;
|
std::unique_ptr<IAssetCreator> m_asset_creator;
|
||||||
AssetLoaderMenuList m_asset_loader;
|
AssetCreatorCollection m_creator_collection;
|
||||||
|
IgnoredAssetLookup m_ignored_asset_lookup;
|
||||||
|
AssetCreationContext m_context;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MenuParsingItHelper()
|
MenuParsingItHelper()
|
||||||
: m_zone("MockZone", 0, IGame::GetGameById(GameId::IW4)),
|
: m_zone("MockZone", 0, IGame::GetGameById(GameId::IW4)),
|
||||||
m_manager(m_zone, m_search_path)
|
m_creator_collection(m_zone),
|
||||||
|
m_ignored_asset_lookup(),
|
||||||
|
m_context(&m_zone, &m_creator_collection, &m_ignored_asset_lookup)
|
||||||
{
|
{
|
||||||
|
m_asset_creator = CreateMenuListLoader(*m_zone.GetMemory(), m_search_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddFile(std::string fileName, std::string data)
|
void AddFile(std::string fileName, std::string data)
|
||||||
@ -48,28 +54,19 @@ namespace test::game::iw4::menu::parsing::it
|
|||||||
auto* material = m_zone.GetMemory()->Create<Material>();
|
auto* material = m_zone.GetMemory()->Create<Material>();
|
||||||
material->info.name = m_zone.GetMemory()->Dup(name.c_str());
|
material->info.name = m_zone.GetMemory()->Dup(name.c_str());
|
||||||
|
|
||||||
m_manager.MockAddAvailableDependency(ASSET_TYPE_MATERIAL, name, material);
|
m_context.AddAsset<AssetMaterial>(name, material);
|
||||||
|
|
||||||
return material;
|
return material;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RunIntegrationTest()
|
AssetCreationResult RunIntegrationTest()
|
||||||
{
|
{
|
||||||
return m_asset_loader.LoadFromRaw(DEFAULT_ASSET_NAME, &m_search_path, m_zone.GetMemory(), &m_manager, &m_zone);
|
return m_asset_creator->CreateAsset(DEFAULT_ASSET_NAME, m_context);
|
||||||
}
|
|
||||||
|
|
||||||
MenuList* GetMenuListAsset()
|
|
||||||
{
|
|
||||||
const auto addedAsset = m_manager.MockGetAddedAsset(DEFAULT_ASSET_NAME);
|
|
||||||
REQUIRE(addedAsset);
|
|
||||||
REQUIRE(addedAsset->m_type == ASSET_TYPE_MENULIST);
|
|
||||||
|
|
||||||
return static_cast<MenuList*>(addedAsset->m_ptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
menuDef_t* GetMenuAsset(const std::string& menuName)
|
menuDef_t* GetMenuAsset(const std::string& menuName)
|
||||||
{
|
{
|
||||||
const auto addedAsset = m_manager.MockGetAddedAsset(menuName);
|
const auto addedAsset = m_zone.m_pools->GetAsset(ASSET_TYPE_MENU, menuName);
|
||||||
REQUIRE(addedAsset);
|
REQUIRE(addedAsset);
|
||||||
REQUIRE(addedAsset->m_type == ASSET_TYPE_MENU);
|
REQUIRE(addedAsset->m_type == ASSET_TYPE_MENU);
|
||||||
|
|
||||||
@ -91,9 +88,9 @@ namespace test::game::iw4::menu::parsing::it
|
|||||||
)testmenu");
|
)testmenu");
|
||||||
|
|
||||||
const auto result = helper.RunIntegrationTest();
|
const auto result = helper.RunIntegrationTest();
|
||||||
REQUIRE(result);
|
REQUIRE(result.HasBeenSuccessful());
|
||||||
|
|
||||||
const auto* menuList = helper.GetMenuListAsset();
|
const auto* menuList = (MenuList*)result.GetAssetInfo()->m_ptr;
|
||||||
const auto* menu = helper.GetMenuAsset("Hello");
|
const auto* menu = helper.GetMenuAsset("Hello");
|
||||||
|
|
||||||
REQUIRE(menuList->menuCount == 1);
|
REQUIRE(menuList->menuCount == 1);
|
||||||
@ -172,9 +169,9 @@ namespace test::game::iw4::menu::parsing::it
|
|||||||
const auto* funnyDogMaterial = helper.AddMaterial("funny_dog.png");
|
const auto* funnyDogMaterial = helper.AddMaterial("funny_dog.png");
|
||||||
|
|
||||||
const auto result = helper.RunIntegrationTest();
|
const auto result = helper.RunIntegrationTest();
|
||||||
REQUIRE(result);
|
REQUIRE(result.HasBeenSuccessful());
|
||||||
|
|
||||||
const auto* menuList = helper.GetMenuListAsset();
|
const auto* menuList = (MenuList*)result.GetAssetInfo()->m_ptr;
|
||||||
const auto* menu = helper.GetMenuAsset("Bla");
|
const auto* menu = helper.GetMenuAsset("Bla");
|
||||||
|
|
||||||
REQUIRE(menuList->menuCount == 1);
|
REQUIRE(menuList->menuCount == 1);
|
||||||
@ -343,9 +340,9 @@ namespace test::game::iw4::menu::parsing::it
|
|||||||
)testmenu");
|
)testmenu");
|
||||||
|
|
||||||
const auto result = helper.RunIntegrationTest();
|
const auto result = helper.RunIntegrationTest();
|
||||||
REQUIRE(result);
|
REQUIRE(result.HasBeenSuccessful());
|
||||||
|
|
||||||
const auto* menuList = helper.GetMenuListAsset();
|
const auto* menuList = (MenuList*)result.GetAssetInfo()->m_ptr;
|
||||||
const auto* menu = helper.GetMenuAsset("Blab");
|
const auto* menu = helper.GetMenuAsset("Blab");
|
||||||
|
|
||||||
REQUIRE(menuList->menuCount == 1);
|
REQUIRE(menuList->menuCount == 1);
|
@ -1,7 +1,6 @@
|
|||||||
#include "Game/IW5/AssetLoaders/AssetLoaderStringTable.h"
|
#include "Game/IW5/StringTable/LoaderStringTableIW5.h"
|
||||||
|
|
||||||
#include "Game/IW5/GameIW5.h"
|
#include "Game/IW5/GameIW5.h"
|
||||||
#include "Mock/MockAssetLoadingManager.h"
|
|
||||||
#include "Mock/MockSearchPath.h"
|
#include "Mock/MockSearchPath.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
|
|
||||||
@ -21,17 +20,19 @@ namespace
|
|||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW5));
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::IW5));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
|
||||||
MemoryManager memory;
|
MemoryManager memory;
|
||||||
|
AssetCreatorCollection creatorCollection(zone);
|
||||||
|
IgnoredAssetLookup ignoredAssetLookup;
|
||||||
|
AssetCreationContext context(&zone, &creatorCollection, &ignoredAssetLookup);
|
||||||
|
|
||||||
assetLoader.LoadFromRaw("mp/cooltable.csv", &searchPath, &memory, &assetLoadingManager, &zone);
|
auto loader = CreateStringTableLoader(memory, searchPath);
|
||||||
|
auto result = loader->CreateAsset("mp/cooltable.csv", context);
|
||||||
auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(assetLoadingManager.MockGetAddedAsset("mp/cooltable.csv"));
|
REQUIRE(result.HasBeenSuccessful());
|
||||||
REQUIRE(assetInfo != nullptr);
|
|
||||||
|
|
||||||
|
const auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(result.GetAssetInfo());
|
||||||
const auto* stringTable = assetInfo->Asset();
|
const auto* stringTable = assetInfo->Asset();
|
||||||
|
|
||||||
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
||||||
REQUIRE(stringTable->columnCount == 3);
|
REQUIRE(stringTable->columnCount == 3);
|
||||||
REQUIRE(stringTable->rowCount == 2);
|
REQUIRE(stringTable->rowCount == 2);
|
@ -1,7 +1,6 @@
|
|||||||
#include "Game/T5/AssetLoaders/AssetLoaderStringTable.h"
|
#include "Game/T5/StringTable/LoaderStringTableT5.h"
|
||||||
|
|
||||||
#include "Game/T5/GameT5.h"
|
#include "Game/T5/GameT5.h"
|
||||||
#include "Mock/MockAssetLoadingManager.h"
|
|
||||||
#include "Mock/MockSearchPath.h"
|
#include "Mock/MockSearchPath.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
|
|
||||||
@ -21,17 +20,19 @@ namespace
|
|||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, IGame::GetGameById(GameId::T5));
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::T5));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
|
||||||
MemoryManager memory;
|
MemoryManager memory;
|
||||||
|
AssetCreatorCollection creatorCollection(zone);
|
||||||
|
IgnoredAssetLookup ignoredAssetLookup;
|
||||||
|
AssetCreationContext context(&zone, &creatorCollection, &ignoredAssetLookup);
|
||||||
|
|
||||||
assetLoader.LoadFromRaw("mp/cooltable.csv", &searchPath, &memory, &assetLoadingManager, &zone);
|
auto loader = CreateStringTableLoader(memory, searchPath);
|
||||||
|
auto result = loader->CreateAsset("mp/cooltable.csv", context);
|
||||||
auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(assetLoadingManager.MockGetAddedAsset("mp/cooltable.csv"));
|
REQUIRE(result.HasBeenSuccessful());
|
||||||
REQUIRE(assetInfo != nullptr);
|
|
||||||
|
|
||||||
|
const auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(result.GetAssetInfo());
|
||||||
const auto* stringTable = assetInfo->Asset();
|
const auto* stringTable = assetInfo->Asset();
|
||||||
|
|
||||||
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
||||||
REQUIRE(stringTable->columnCount == 3);
|
REQUIRE(stringTable->columnCount == 3);
|
||||||
REQUIRE(stringTable->rowCount == 2);
|
REQUIRE(stringTable->rowCount == 2);
|
@ -1,7 +1,6 @@
|
|||||||
#include "Game/T6/AssetLoaders/AssetLoaderStringTable.h"
|
#include "Game/T6/StringTable/LoaderStringTableT6.h"
|
||||||
|
|
||||||
#include "Game/T6/GameT6.h"
|
#include "Game/T6/GameT6.h"
|
||||||
#include "Mock/MockAssetLoadingManager.h"
|
|
||||||
#include "Mock/MockSearchPath.h"
|
#include "Mock/MockSearchPath.h"
|
||||||
#include "Utils/MemoryManager.h"
|
#include "Utils/MemoryManager.h"
|
||||||
|
|
||||||
@ -21,17 +20,19 @@ namespace
|
|||||||
"lorem,ipsum");
|
"lorem,ipsum");
|
||||||
|
|
||||||
Zone zone("MockZone", 0, IGame::GetGameById(GameId::T6));
|
Zone zone("MockZone", 0, IGame::GetGameById(GameId::T6));
|
||||||
MockAssetLoadingManager assetLoadingManager(zone, searchPath);
|
|
||||||
|
|
||||||
AssetLoaderStringTable assetLoader;
|
|
||||||
MemoryManager memory;
|
MemoryManager memory;
|
||||||
|
AssetCreatorCollection creatorCollection(zone);
|
||||||
|
IgnoredAssetLookup ignoredAssetLookup;
|
||||||
|
AssetCreationContext context(&zone, &creatorCollection, &ignoredAssetLookup);
|
||||||
|
|
||||||
assetLoader.LoadFromRaw("mp/cooltable.csv", &searchPath, &memory, &assetLoadingManager, &zone);
|
auto loader = CreateStringTableLoader(memory, searchPath);
|
||||||
|
auto result = loader->CreateAsset("mp/cooltable.csv", context);
|
||||||
auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(assetLoadingManager.MockGetAddedAsset("mp/cooltable.csv"));
|
REQUIRE(result.HasBeenSuccessful());
|
||||||
REQUIRE(assetInfo != nullptr);
|
|
||||||
|
|
||||||
|
const auto* assetInfo = reinterpret_cast<XAssetInfo<StringTable>*>(result.GetAssetInfo());
|
||||||
const auto* stringTable = assetInfo->Asset();
|
const auto* stringTable = assetInfo->Asset();
|
||||||
|
|
||||||
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
REQUIRE(stringTable->name == "mp/cooltable.csv"s);
|
||||||
REQUIRE(stringTable->columnCount == 3);
|
REQUIRE(stringTable->columnCount == 3);
|
||||||
REQUIRE(stringTable->rowCount == 2);
|
REQUIRE(stringTable->rowCount == 2);
|
@ -1,57 +0,0 @@
|
|||||||
#include "MockAssetLoadingManager.h"
|
|
||||||
|
|
||||||
MockAssetLoadingManager::MockAssetLoadingManager(Zone& zone, ISearchPath& searchPath)
|
|
||||||
: m_zone(zone),
|
|
||||||
m_mock_gdt(std::make_unique<Gdt>()),
|
|
||||||
m_context(std::make_unique<AssetLoadingContext>(zone, searchPath, std::vector({m_mock_gdt.get()})))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
AssetLoadingContext* MockAssetLoadingManager::GetAssetLoadingContext() const
|
|
||||||
{
|
|
||||||
return m_context.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
XAssetInfoGeneric* MockAssetLoadingManager::AddAsset(std::unique_ptr<XAssetInfoGeneric> xAssetInfo)
|
|
||||||
{
|
|
||||||
const auto assetInfoPtr = xAssetInfo.get();
|
|
||||||
m_added_assets.emplace(std::make_pair(xAssetInfo->m_name, std::move(xAssetInfo)));
|
|
||||||
|
|
||||||
return assetInfoPtr;
|
|
||||||
}
|
|
||||||
|
|
||||||
XAssetInfoGeneric* MockAssetLoadingManager::LoadDependency(const asset_type_t assetType, const std::string& assetName)
|
|
||||||
{
|
|
||||||
auto foundDependencies = m_available_dependencies.find(assetName);
|
|
||||||
|
|
||||||
while (foundDependencies != m_available_dependencies.end())
|
|
||||||
{
|
|
||||||
if (foundDependencies->second->m_type == assetType)
|
|
||||||
return foundDependencies->second.get();
|
|
||||||
|
|
||||||
++foundDependencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
IndirectAssetReference MockAssetLoadingManager::LoadIndirectAssetReference(const asset_type_t assetType, const std::string& assetName)
|
|
||||||
{
|
|
||||||
return IndirectAssetReference(assetType, assetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MockAssetLoadingManager::MockAddAvailableDependency(const asset_type_t assetType, std::string assetName, void* asset)
|
|
||||||
{
|
|
||||||
auto assetInfo = std::make_unique<XAssetInfoGeneric>(assetType, std::move(assetName), asset);
|
|
||||||
m_available_dependencies.emplace(assetInfo->m_name, std::move(assetInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
XAssetInfoGeneric* MockAssetLoadingManager::MockGetAddedAsset(const std::string& assetName)
|
|
||||||
{
|
|
||||||
const auto foundAsset = m_added_assets.find(assetName);
|
|
||||||
|
|
||||||
if (foundAsset != m_added_assets.end())
|
|
||||||
return foundAsset->second.get();
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "AssetLoading/IAssetLoadingManager.h"
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
class MockAssetLoadingManager final : public IAssetLoadingManager
|
|
||||||
{
|
|
||||||
Zone& m_zone;
|
|
||||||
std::unique_ptr<Gdt> m_mock_gdt;
|
|
||||||
std::unique_ptr<AssetLoadingContext> m_context;
|
|
||||||
std::map<std::string, std::unique_ptr<XAssetInfoGeneric>> m_added_assets;
|
|
||||||
std::multimap<std::string, std::unique_ptr<XAssetInfoGeneric>> m_available_dependencies;
|
|
||||||
|
|
||||||
public:
|
|
||||||
MockAssetLoadingManager(Zone& zone, ISearchPath& searchPath);
|
|
||||||
|
|
||||||
_NODISCARD AssetLoadingContext* GetAssetLoadingContext() const override;
|
|
||||||
XAssetInfoGeneric* AddAsset(std::unique_ptr<XAssetInfoGeneric> xAssetInfo) override;
|
|
||||||
XAssetInfoGeneric* LoadDependency(asset_type_t assetType, const std::string& assetName) override;
|
|
||||||
IndirectAssetReference LoadIndirectAssetReference(asset_type_t assetType, const std::string& assetName) override;
|
|
||||||
|
|
||||||
void MockAddAvailableDependency(asset_type_t assetType, std::string assetName, void* asset);
|
|
||||||
XAssetInfoGeneric* MockGetAddedAsset(const std::string& assetName);
|
|
||||||
};
|
|
Loading…
x
Reference in New Issue
Block a user