diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-21 20:35:09 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2024-11-21 20:35:09 +0100 |
commit | ad0dcad1f11d698abf71bf69fb0927c26298d253 (patch) | |
tree | 3e8a501a84682ca2b6c085a987666c9b777bc1c7 /src/test/AssetTest.cpp | |
parent | bdc81e355e5bee5d2a3e29346ba08f7bc55196ca (diff) | |
parent | 115d6f50152dc018073345800ca90b85846ebaa9 (diff) |
Merge branch 'master' into niels/decoupling_pixel_and_pos
Diffstat (limited to 'src/test/AssetTest.cpp')
-rw-r--r-- | src/test/AssetTest.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/AssetTest.cpp b/src/test/AssetTest.cpp new file mode 100644 index 0000000..8aa7629 --- /dev/null +++ b/src/test/AssetTest.cpp @@ -0,0 +1,26 @@ +#include <gtest/gtest.h> + +#include <crepe/api/Asset.h> +#include <crepe/api/Config.h> + +using namespace std; +using namespace crepe; +using namespace testing; + +class AssetTest : public Test { +public: + Config & cfg = Config::get_instance(); + void SetUp() override { this->cfg.asset.root_pattern = ".crepe-root"; } +}; + +TEST_F(AssetTest, Existant) { ASSERT_NO_THROW(Asset{"asset/texture/img.png"}); } + +TEST_F(AssetTest, Nonexistant) { ASSERT_ANY_THROW(Asset{"asset/nonexistant"}); } + +TEST_F(AssetTest, Rootless) { + cfg.asset.root_pattern.clear(); + + string arbitrary = "\\/this is / /../passed through as-is"; + Asset asset{arbitrary}; + ASSERT_EQ(arbitrary, asset.get_path()); +} |