Blender V4.3
usd_stage_creation_test.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#include "testing/testing.h"
5
6#include <pxr/base/plug/registry.h>
7#include <pxr/usd/usd/stage.h>
8
9#include <string>
10
11#include "BLI_path_utils.hh"
12#include "BLI_utildefines.h"
13
14#include "BKE_appdir.hh"
15
16namespace blender::io::usd {
17
18class USDStageCreationTest : public testing::Test {};
19
20TEST_F(USDStageCreationTest, JSONFileLoadingTest)
21{
22 /* Simply the ability to create a USD Stage for a specific filename means that the extension
23 * has been recognized by the USD library, and that a USD plugin has been loaded to write such
24 * files. Practically, this is a test to see whether the USD JSON files can be found and
25 * loaded. */
26 std::string filename = "usd-stage-creation-test.usdc";
27 pxr::UsdStageRefPtr usd_stage = pxr::UsdStage::CreateNew(filename);
28 if (usd_stage != nullptr) {
29 /* Even though we don't call `usd_stage->SaveFile()`, a file is still created on the
30 * file-system when we call CreateNew(). It's immediately closed, though,
31 * so we can safely call `unlink()` here. */
32 unlink(filename.c_str());
33 }
34 else {
35 FAIL() << "unable to find suitable USD plugin to write " << filename;
36 }
37}
38
39} // namespace blender::io::usd
TEST_F(UsdCurvesTest, usd_export_curves)