16#include "testing/testing.h"
37 std::unique_ptr<AssetMetaData> dummy_metadata = std::make_unique<AssetMetaData>();
80 b.asset_library_identifier =
"My lib";
92 b.relative_asset_identifier =
"Bar";
112 b.asset_library_identifier =
"My custom lib";
113 b.relative_asset_identifier =
"path/to/an/asset";
124 asset_library_root_);
135 EXPECT_NE(weak_ref, other);
137 EXPECT_NE(weak_ref, other);
148 asset_library_root_);
159 EXPECT_NE(weak_ref, other);
161 EXPECT_NE(weak_ref, other);
186 asset_library_root_);
199 weak_reference__resolve_to_full_path__custom_library__windows_pathsep)
203 asset_library_root_);
225 std::optional<AssetLibraryService::ExplodedPath> resolved_path =
228 EXPECT_EQ(*resolved_path->full_path, expected_full_path);
229 EXPECT_EQ(resolved_path->dir_component,
"");
230 EXPECT_EQ(resolved_path->group_component,
"path");
232 EXPECT_EQ(resolved_path->name_component,
"to/an/asset");
240 asset_library_root_);
246 "/some.blend/Material/") +
248 std::optional<AssetLibraryService::ExplodedPath> resolved_path =
253 std::string(asset_library_root_ +
"/some.blend").c_str()),
255 EXPECT_EQ(resolved_path->group_component,
"Material");
257 EXPECT_EQ(resolved_path->name_component,
"asset/name");
262 weak_reference__resolve_to_exploded_path__custom_library__windows_pathsep)
266 asset_library_root_);
267 AssetRepresentation &asset = add_dummy_asset(*library,
"some.blend\\Material\\asset/name");
272 "\\some.blend\\Material\\") +
274 std::optional<AssetLibraryService::ExplodedPath> resolved_path =
279 std::string(asset_library_root_ +
"\\some.blend").c_str()),
281 EXPECT_EQ(resolved_path->group_component,
"Material");
283 EXPECT_EQ(resolved_path->name_component,
"asset/name");
Main runtime representation of an asset.
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
int BLI_path_cmp_normalized(const char *p1, const char *p2) ATTR_NONNULL(1
@ ASSET_LIBRARY_ESSENTIALS
AssetLibrary * get_asset_library(const Main *bmain, const AssetLibraryReference &library_reference)
std::optional< ExplodedPath > resolve_asset_weak_reference_to_exploded_path(const AssetWeakReference &asset_reference)
std::string resolve_asset_weak_reference_to_full_path(const AssetWeakReference &asset_reference)
static AssetLibraryService * get()
AssetLibrary * get_asset_library_on_disk_custom(StringRef name, StringRefNull root_path)
std::weak_ptr< AssetRepresentation > add_external_asset(StringRef relative_asset_path, StringRef name, int id_type, std::unique_ptr< AssetMetaData > metadata)
AssetWeakReference make_weak_reference() const
AssetLibrary * get_builtin_library_from_type(eAssetLibraryType type)
AssetRepresentation & add_dummy_asset(AssetLibrary &library, StringRef relative_path)
TEST_F(AssetCatalogTest, load_single_file)
std::string normalize_path(StringRefNull path, int64_t max_len)
const char * relative_asset_identifier
const char * asset_library_identifier