Blender V4.3
blendfile_loading_base_test.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include "DEG_depsgraph.hh"
8#include "testing/testing.h"
9
10struct BlendFileData;
11struct Depsgraph;
12
13class BlendfileLoadingBaseTest : public testing::Test {
14 protected:
15 struct BlendFileData *bfile = nullptr;
16 struct Depsgraph *depsgraph = nullptr;
17
18 public:
19 /* Sets up Blender just enough to not crash on loading
20 * a blendfile and constructing a depsgraph. */
21 static void SetUpTestCase();
22 static void TearDownTestCase();
23
24 protected:
25 /* Frees the depsgraph & blendfile. */
26 virtual void TearDown();
27
28 /* Loads a blend file from the tests/data directory from SVN.
29 * Returns 'ok' flag (true=good, false=bad) and sets `this->bfile`.
30 * Fails the test if the file cannot be loaded (still returns though).
31 * Requires the CLI argument `--test-asset-dir` to point to `../tests/data`.
32 *
33 * WARNING: only files saved with Blender 2.80+ can be loaded. Since Blender
34 * is only partially initialized (most importantly, without window manager),
35 * the space types are not registered, so any versioning code that handles
36 * those will SEGFAULT.
37 */
38 bool blendfile_load(const char *filepath);
39 /* Free bfile if it is not nullptr. */
40 void blendfile_free();
41
42 /* Create a depsgraph. Assumes a blend file has been loaded to this->bfile. */
43 virtual void depsgraph_create(eEvaluationMode depsgraph_evaluation_mode);
44 /* Free the depsgraph if it's not nullptr. */
45 virtual void depsgraph_free();
46};
eEvaluationMode
virtual void depsgraph_create(eEvaluationMode depsgraph_evaluation_mode)
bool blendfile_load(const char *filepath)