Changeset View
Changeset View
Standalone View
Standalone View
tests/gtests/blenloader/blendfile_loading_base_test.cc
| Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
| #include "IMB_imbuf.h" | #include "IMB_imbuf.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "wm.h" | #include "wm.h" | ||||
| } | } | ||||
| DEFINE_string(test_assets_dir, "", "lib/tests directory from SVN containing the test assets."); | |||||
| BlendfileLoadingBaseTest::~BlendfileLoadingBaseTest() | BlendfileLoadingBaseTest::~BlendfileLoadingBaseTest() | ||||
| { | { | ||||
| } | } | ||||
| void BlendfileLoadingBaseTest::SetUpTestCase() | void BlendfileLoadingBaseTest::SetUpTestCase() | ||||
| { | { | ||||
| testing::Test::SetUpTestCase(); | testing::Test::SetUpTestCase(); | ||||
| ▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | void BlendfileLoadingBaseTest::TearDown() | ||||
| depsgraph_free(); | depsgraph_free(); | ||||
| blendfile_free(); | blendfile_free(); | ||||
| testing::Test::TearDown(); | testing::Test::TearDown(); | ||||
| } | } | ||||
| bool BlendfileLoadingBaseTest::blendfile_load(const char *filepath) | bool BlendfileLoadingBaseTest::blendfile_load(const char *filepath) | ||||
| { | { | ||||
| if (FLAGS_test_assets_dir.empty()) { | const std::string &test_assets_dir = blender::tests::flags_test_asset_dir(); | ||||
| ADD_FAILURE() | if (test_assets_dir.empty()) { | ||||
| << "Pass the flag --test-assets-dir and point to the lib/tests directory from SVN."; | |||||
| return false; | return false; | ||||
| } | } | ||||
| char abspath[FILENAME_MAX]; | char abspath[FILENAME_MAX]; | ||||
| BLI_path_join(abspath, sizeof(abspath), FLAGS_test_assets_dir.c_str(), filepath, NULL); | BLI_path_join(abspath, sizeof(abspath), test_assets_dir.c_str(), filepath, NULL); | ||||
| bfile = BLO_read_from_file(abspath, BLO_READ_SKIP_NONE, NULL /* reports */); | bfile = BLO_read_from_file(abspath, BLO_READ_SKIP_NONE, NULL /* reports */); | ||||
| if (bfile == nullptr) { | if (bfile == nullptr) { | ||||
| ADD_FAILURE() << "Unable to load file '" << filepath << "' from test assets dir '" | ADD_FAILURE() << "Unable to load file '" << filepath << "' from test assets dir '" | ||||
| << FLAGS_test_assets_dir << "'"; | << test_assets_dir << "'"; | ||||
| return false; | return false; | ||||
| } | } | ||||
| return true; | return true; | ||||
| } | } | ||||
| void BlendfileLoadingBaseTest::blendfile_free() | void BlendfileLoadingBaseTest::blendfile_free() | ||||
| { | { | ||||
| if (bfile == nullptr) { | if (bfile == nullptr) { | ||||
| Show All 27 Lines | |||||