Files
test/source/blender/blenloader/tests/blendfile_loading_base_test.h
Sergey Sharybin bbfc97ad6f Move tests/data and assets to the main repository
This change moves the tests data files and publish folder of assets
repository to the main blender.git repository as LFS files.

The goal of this change is to eliminate toil of modifying tests,
cherry-picking changes to LFS branches, adding tests as part of a
PR which brings new features or fixes.

More detailed explanation and conversation can be found in the
design task.

Ref #137215

Pull Request: https://projects.blender.org/blender/blender/pulls/137219
2025-05-05 15:10:22 +02:00

47 lines
1.5 KiB
C++

/* SPDX-FileCopyrightText: 2019 Blender Authors
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "DEG_depsgraph.hh"
#include "testing/testing.h"
struct BlendFileData;
struct Depsgraph;
class BlendfileLoadingBaseTest : public testing::Test {
protected:
struct BlendFileData *bfile = nullptr;
struct Depsgraph *depsgraph = nullptr;
public:
/* Sets up Blender just enough to not crash on loading
* a blendfile and constructing a depsgraph. */
static void SetUpTestCase();
static void TearDownTestCase();
protected:
/* Frees the depsgraph & blendfile. */
virtual void TearDown();
/* Loads a blend file from the tests/files directory from SVN.
* Returns 'ok' flag (true=good, false=bad) and sets `this->bfile`.
* Fails the test if the file cannot be loaded (still returns though).
* Requires the CLI argument `--test-asset-dir` to point to `../tests/files`.
*
* WARNING: only files saved with Blender 2.80+ can be loaded. Since Blender
* is only partially initialized (most importantly, without window manager),
* the space types are not registered, so any versioning code that handles
* those will SEGFAULT.
*/
bool blendfile_load(const char *filepath);
/* Free bfile if it is not nullptr. */
void blendfile_free();
/* Create a depsgraph. Assumes a blend file has been loaded to this->bfile. */
virtual void depsgraph_create(eEvaluationMode depsgraph_evaluation_mode);
/* Free the depsgraph if it's not nullptr. */
virtual void depsgraph_free();
};