UI: Asset Shelf (Experimental Feature) #104831
|
@ -82,7 +82,7 @@ TEST_F(AssetRepresentationTest, weak_reference__resolve_to_full_path__current_fi
|
|||
EXPECT_EQ(resolved_path, "");
|
||||
}
|
||||
|
||||
/* #AssetLibraryService::resolve_asset_weak_reference_to_full_path() */
|
||||
/* #AssetLibraryService::resolve_asset_weak_reference_to_full_path(). */
|
||||
TEST_F(AssetRepresentationTest, weak_reference__resolve_to_full_path__custom_library)
|
||||
{
|
||||
AssetLibraryService *service = AssetLibraryService::get();
|
||||
|
@ -99,4 +99,44 @@ TEST_F(AssetRepresentationTest, weak_reference__resolve_to_full_path__custom_lib
|
|||
EXPECT_EQ(resolved_path, expected_path);
|
||||
}
|
||||
|
||||
/* #AssetLibraryService::resolve_asset_weak_reference_to_exploded_path(). */
|
||||
TEST_F(AssetRepresentationTest, weak_reference__resolve_to_exploded_path__current_file)
|
||||
{
|
||||
AssetLibraryService *service = AssetLibraryService::get();
|
||||
AssetLibrary *library = get_builtin_library_from_type(ASSET_LIBRARY_LOCAL);
|
||||
AssetRepresentation &asset = add_dummy_asset(*library, "path/to/an/asset");
|
||||
|
||||
std::unique_ptr<AssetWeakReference> weak_ref = asset.make_weak_reference();
|
||||
|
||||
std::optional<AssetLibraryService::ExplodedPath> resolved_path =
|
||||
service->resolve_asset_weak_reference_to_exploded_path(*weak_ref);
|
||||
EXPECT_EQ(resolved_path->full_path, "path/to/an/asset");
|
||||
EXPECT_EQ(resolved_path->dir_component, "");
|
||||
EXPECT_EQ(resolved_path->group_component, "path");
|
||||
/* ID names may contain slashes. */
|
||||
EXPECT_EQ(resolved_path->name_component, "to/an/asset");
|
||||
}
|
||||
|
||||
/* #AssetLibraryService::resolve_asset_weak_reference_to_exploded_path(). */
|
||||
TEST_F(AssetRepresentationTest, weak_reference__resolve_to_exploded_path__custom_library)
|
||||
{
|
||||
AssetLibraryService *service = AssetLibraryService::get();
|
||||
AssetLibrary *const library = service->get_asset_library_on_disk_custom("My custom lib",
|
||||
asset_library_root_);
|
||||
AssetRepresentation &asset = add_dummy_asset(*library, "some.blend/Material/asset/name");
|
||||
|
||||
std::unique_ptr<AssetWeakReference> weak_ref = asset.make_weak_reference();
|
||||
|
||||
std::string expected_full_path = asset_library_root_ + "/some.blend/Material/asset/name";
|
||||
BLI_path_slash_native(expected_full_path.data());
|
||||
|
||||
std::optional<AssetLibraryService::ExplodedPath> resolved_path =
|
||||
service->resolve_asset_weak_reference_to_exploded_path(*weak_ref);
|
||||
EXPECT_EQ(resolved_path->full_path, expected_full_path);
|
||||
EXPECT_EQ(resolved_path->dir_component, asset_library_root_ + "/some.blend");
|
||||
EXPECT_EQ(resolved_path->group_component, "Material");
|
||||
/* ID names may contain slashes. */
|
||||
EXPECT_EQ(resolved_path->name_component, "asset/name");
|
||||
}
|
||||
|
||||
} // namespace blender::asset_system::tests
|
||||
|
|
Loading…
Reference in New Issue