DotNameLib
Loading...
Searching...
No Matches
MockAssetManager.hpp
Go to the documentation of this file.
1#pragma once
2
4#include <filesystem>
5
12public:
13 explicit MockAssetManager(std::filesystem::path mockPath)
14 : mockPath_(std::move(mockPath)), mockExists_(true), mockValid_(true) {}
15
16 [[nodiscard]]
17 const std::filesystem::path &getAssetsPath() const override {
18 return mockPath_;
19 }
20
21 [[nodiscard]]
22 std::filesystem::path resolveAsset(const std::filesystem::path &relativePath) const override {
23 return mockPath_ / relativePath;
24 }
25
26 [[nodiscard]]
27 bool assetExists(const std::filesystem::path & /*relativePath*/) const override {
28 return mockExists_;
29 }
30
31 [[nodiscard]]
32 bool validate() const override {
33 return mockValid_;
34 }
35
36 // Test control methods
37 void setMockExists(bool exists) { mockExists_ = exists; }
38
39 void setMockValid(bool valid) { mockValid_ = valid; }
40
41private:
42 std::filesystem::path mockPath_;
43 bool mockExists_;
44 bool mockValid_;
45};
MockAssetManager(std::filesystem::path mockPath)
Definition MockAssetManager.hpp:13
const std::filesystem::path & getAssetsPath() const override
Get the Assets Path object.
Definition MockAssetManager.hpp:17
void setMockValid(bool valid)
Definition MockAssetManager.hpp:39
bool validate() const override
Validate the asset manager configuration.
Definition MockAssetManager.hpp:32
std::filesystem::path resolveAsset(const std::filesystem::path &relativePath) const override
Resolve the full path of an asset given its relative path.
Definition MockAssetManager.hpp:22
void setMockExists(bool exists)
Definition MockAssetManager.hpp:37
bool assetExists(const std::filesystem::path &) const override
Check if an asset exists given its relative path.
Definition MockAssetManager.hpp:27
Definition IAssetManager.hpp:6