test: add unit test for ImageIwdPostProcessor

This commit is contained in:
Jan
2025-01-08 18:35:39 +01:00
parent 8c8ceae0bd
commit 3b5ca86b0d
4 changed files with 284 additions and 2 deletions

View File

@ -4,7 +4,6 @@
#include <algorithm>
#include <format>
#include <ranges>
AbstractImageIwdPostProcessor::AbstractImageIwdPostProcessor(const ZoneDefinitionContext& zoneDefinition,
ISearchPath& searchPath,
@ -58,7 +57,7 @@ void AbstractImageIwdPostProcessor::PostProcessAsset(XAssetInfoGeneric& assetInf
while (m_current_iwd && m_zone_definition.m_asset_index_in_definition >= m_current_iwd_end_index)
FindNextObjContainer();
if (m_current_iwd && m_zone_definition.m_asset_index_in_definition <= m_current_iwd_start_index)
if (m_current_iwd && m_zone_definition.m_asset_index_in_definition >= m_current_iwd_start_index)
m_current_iwd->AddFile(std::format("images/{}.iwi", assetInfo.m_name));
}

View File

@ -79,6 +79,11 @@ void IwdToCreate::Build(ISearchPath& searchPath, IOutputPath& outPath)
std::cout << std::format("Created iwd {} with {} entries\n", m_name, m_file_paths.size());
}
const std::vector<std::string>& IwdToCreate::GetFilePaths() const
{
return m_file_paths;
}
IwdToCreate* IwdCreator::GetOrAddIwd(const std::string& iwdName)
{
const auto existingIwd = m_iwd_lookup.find(iwdName);

View File

@ -15,6 +15,7 @@ public:
void AddFile(std::string filePath);
void Build(ISearchPath& searchPath, IOutputPath& outPath);
[[nodiscard]] const std::vector<std::string>& GetFilePaths() const;
private:
std::string m_name;