14 #include "testing/testing.h"
38 const std::string test_files_dir = blender::tests::flags_test_asset_dir();
39 if (test_files_dir.empty()) {
78 <<
"Calling twice without destroying in between should return the same instance.";
96 <<
"Calling twice without destroying in between should return the same instance.";
98 <<
"Calling twice without destroying in between should return the same instance.";
110 char asset_lib_with_slash[
PATH_MAX];
111 STRNCPY(asset_lib_no_slash, asset_library_root_.c_str());
112 STRNCPY(asset_lib_with_slash, asset_library_root_.c_str());
116 while (strlen(asset_lib_no_slash) &&
117 ELEM(asset_lib_no_slash[strlen(asset_lib_no_slash) - 1],
SEP,
ALTSEP)) {
118 asset_lib_no_slash[strlen(asset_lib_no_slash) - 1] =
'\0';
126 <<
"With or without trailing slash shouldn't matter.";
137 <<
"Catalogs should be loaded after getting an asset library from disk.";
144 <<
"Empty AssetLibraryService should have no unsaved catalogs";
149 <<
"Unchanged AssetLibrary should have no unsaved catalogs";
154 <<
"Deletion of catalogs via AssetCatalogService should not automatically tag as 'unsaved "
159 ASSERT_NE(
nullptr, cat) <<
"Catalog " <<
UUID_POSES_RUZENA <<
" should be known";
163 <<
"Tagging as having unsaved changes of a single catalog service should result in unsaved "
164 "changes being reported.";
171 const CatalogFilePath original_cdf_file = asset_library_root_ +
"/blender_assets.cats.txt";
174 ASSERT_EQ(0,
BLI_copy(original_cdf_file.c_str(), writable_cdf_file.c_str()));
180 <<
"Unchanged AssetLibrary should have no unsaved catalogs";
188 <<
"Tagging as having unsaved changes of a single catalog service should result in unsaved "
189 "changes being reported.";
192 cat_service->
write_to_disk(writable_dir +
"dummy_path.blend");
194 <<
"Written AssetCatalogService should have no unsaved catalogs";
void BKE_tempdir_init(const char *userdir)
void BKE_callback_global_finalize(void)
void BKE_callback_global_init(void)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
File and directory operations.
int BLI_delete(const char *file, bool dir, bool recursive) ATTR_NONNULL()
bool BLI_dir_create_recursive(const char *dir) ATTR_NONNULL()
int BLI_copy(const char *file, const char *to) ATTR_NONNULL()
int BLI_path_slash_ensure(char *string) ATTR_NONNULL()
void BLI_path_slash_native(char *path) ATTR_NONNULL()
#define STRNCPY(dst, src)
bool write_to_disk(const CatalogFilePath &blend_file_path)
void tag_has_unsaved_changes(AssetCatalog *edited_catalog)
AssetCatalog * find_catalog(CatalogID catalog_id) const
void prune_catalogs_by_id(CatalogID catalog_id)
static const CatalogFilePath DEFAULT_CATALOG_FILENAME
struct blender::bke::AssetCatalog::Flags flags
AssetLibrary * get_asset_library_current_file()
bool has_any_unsaved_catalogs() const
static AssetLibraryService * get()
AssetLibrary * get_asset_library_on_disk(StringRefNull top_level_directory)
CatalogFilePath create_temp_path()
CatalogFilePath temp_library_path_
static void TearDownTestSuite()
CatalogFilePath asset_library_root_
static void SetUpTestSuite()
CatalogFilePath use_temp_path()
void * BKE_tempdir_session
const bUUID UUID_POSES_ELLIE("df60e1f6-2259-475b-93d9-69a1b4a8db78")
TEST_F(BKE_armature_find_selected_bones_test, some_bones_selected)
const bUUID UUID_POSES_RUZENA("79a4f887-ab60-4bd4-94da-d572e27d6aed")
std::string CatalogFilePath
Universally Unique Identifier according to RFC4122.