Blender V5.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
10namespace blender {
11
12struct Depsgraph;
13struct BlendFileData;
14
15class BlendfileLoadingBaseTest : public testing::Test {
16 protected:
17 struct BlendFileData *bfile = nullptr;
18 struct Depsgraph *depsgraph = nullptr;
19
20 public:
21 /* Sets up Blender just enough to not crash on loading
22 * a blendfile and constructing a depsgraph. */
23 static void SetUpTestCase();
24 static void TearDownTestCase();
25
26 protected:
27 /* Frees the depsgraph & blendfile. */
28 void TearDown() override;
29
30 /* Loads a blend file from the tests/files directory from SVN.
31 * Returns 'ok' flag (true=good, false=bad) and sets `this->bfile`.
32 * Fails the test if the file cannot be loaded (still returns though).
33 * Requires the CLI argument `--test-asset-dir` to point to `../tests/files`.
34 *
35 * WARNING: only files saved with Blender 2.80+ can be loaded. Since Blender
36 * is only partially initialized (most importantly, without window manager),
37 * the space types are not registered, so any versioning code that handles
38 * those will SEGFAULT.
39 */
40 bool blendfile_load(const char *filepath);
41 /* Free bfile if it is not nullptr. */
42 void blendfile_free();
43
44 /* Create a depsgraph. Assumes a blend file has been loaded to this->bfile. */
45 virtual void depsgraph_create(eEvaluationMode depsgraph_evaluation_mode);
46 /* Free the depsgraph if it's not nullptr. */
47 virtual void depsgraph_free();
48};
49
50} // namespace blender
virtual void depsgraph_create(eEvaluationMode depsgraph_evaluation_mode)
BMesh Iterators.