18#include "testing/testing.h"
39 std::unique_ptr<AssetMetaData> dummy_metadata = std::make_unique<AssetMetaData>();
82 b.asset_library_identifier =
"My lib";
94 b.relative_asset_identifier =
"Bar";
114 b.asset_library_identifier =
"My custom lib";
115 b.relative_asset_identifier =
"path/to/an/asset";
126 asset_library_root_);
137 EXPECT_NE(weak_ref, other);
139 EXPECT_NE(weak_ref, other);
150 asset_library_root_);
161 EXPECT_NE(weak_ref, other);
163 EXPECT_NE(weak_ref, other);
188 asset_library_root_);
201 weak_reference__resolve_to_full_path__custom_library__windows_pathsep)
205 asset_library_root_);
227 std::optional<AssetLibraryService::ExplodedPath> resolved_path =
230 EXPECT_EQ(*resolved_path->full_path, expected_full_path);
231 EXPECT_EQ(resolved_path->dir_component,
"");
232 EXPECT_EQ(resolved_path->group_component,
"path");
234 EXPECT_EQ(resolved_path->name_component,
"to/an/asset");
242 asset_library_root_);
248 "/some.blend/Material/") +
250 std::optional<AssetLibraryService::ExplodedPath> resolved_path =
255 std::string(asset_library_root_ +
"/some.blend").c_str()),
257 EXPECT_EQ(resolved_path->group_component,
"Material");
259 EXPECT_EQ(resolved_path->name_component,
"asset/name");
264 weak_reference__resolve_to_exploded_path__custom_library__windows_pathsep)
268 asset_library_root_);
269 AssetRepresentation &asset = add_dummy_asset(*library,
"some.blend\\Material\\asset/name");
274 "\\some.blend\\Material\\") +
276 std::optional<AssetLibraryService::ExplodedPath> resolved_path =
281 std::string(asset_library_root_ +
"\\some.blend").c_str()),
283 EXPECT_EQ(resolved_path->group_component,
"Material");
285 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)
local_group_size(16, 16) .push_constant(Type b
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