Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2021-10-21 17:06:14 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-10-21 17:06:14 +0300
commit4b48b1079d9175a5b86b2299c902cac0fbe27f09 (patch)
tree89f4d53d2a715d1aa7aa57733c30189d003a1f85 /source/blender/blenkernel/intern/asset_catalog_test.cc
parent5ccec8ec6bed3e0eda1cffaae565fdfaccd2a6ac (diff)
Asset Catalogs: refresh simple name when renaming catalog
When renaming an asset catalog, also update its simple name. Catalogs will most likely be created from within Blender, so via the catalog tree in the asset browser. Here catalogs are always named "Catalog" until the user renames them, which was reflected in all simple names being "Catalog".
Diffstat (limited to 'source/blender/blenkernel/intern/asset_catalog_test.cc')
-rw-r--r--source/blender/blenkernel/intern/asset_catalog_test.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/asset_catalog_test.cc b/source/blender/blenkernel/intern/asset_catalog_test.cc
index 7691658bc57..ebb282a7371 100644
--- a/source/blender/blenkernel/intern/asset_catalog_test.cc
+++ b/source/blender/blenkernel/intern/asset_catalog_test.cc
@@ -882,6 +882,22 @@ TEST_F(AssetCatalogTest, update_catalog_path)
<< "Changing the path should update children.";
}
+TEST_F(AssetCatalogTest, update_catalog_path_simple_name)
+{
+ AssetCatalogService service(asset_library_root_);
+ service.load_from_disk(asset_library_root_ + "/" +
+ AssetCatalogService::DEFAULT_CATALOG_FILENAME);
+ service.update_catalog_path(UUID_POSES_RUZENA, "charlib/Ružena");
+
+ /* This may not be valid forever; maybe at some point we'll expose the simple name to users & let
+ * them change it from the UI. Until then, automatically updating it is better, because otherwise
+ * all simple names would be "Catalog". */
+ EXPECT_EQ("charlib-Ružena", service.find_catalog(UUID_POSES_RUZENA)->simple_name)
+ << "Changing the path should update the simplename.";
+ EXPECT_EQ("charlib-Ružena-face", service.find_catalog(UUID_POSES_RUZENA_FACE)->simple_name)
+ << "Changing the path should update the simplename of children.";
+}
+
TEST_F(AssetCatalogTest, merge_catalog_files)
{
const CatalogFilePath cdf_dir = create_temp_path();