Blender V5.0
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/usd/usd/common.h>
7#include <pxr/usd/usd/stage.h>
8
9#include <string>
10
11namespace blender::io::usd {
12
13class USDStageCreationTest : public testing::Test {};
14
15TEST_F(USDStageCreationTest, JSONFileLoadingTest)
16{
17 /* Simply the ability to create a USD Stage for a specific filename means that the extension
18 * has been recognized by the USD library, and that a USD plugin has been loaded to write such
19 * files. Practically, this is a test to see whether the USD JSON files can be found and
20 * loaded. */
21 std::string filename = "usd-stage-creation-test.usdc";
22 pxr::UsdStageRefPtr usd_stage = pxr::UsdStage::CreateNew(filename);
23 if (usd_stage != nullptr) {
24 /* Even though we don't call `usd_stage->SaveFile()`, a file is still created on the
25 * file-system when we call CreateNew(). It's immediately closed, though,
26 * so we can safely call `unlink()` here. */
27 unlink(filename.c_str());
28 }
29 else {
30 FAIL() << "unable to find suitable USD plugin to write " << filename;
31 }
32}
33
34} // namespace blender::io::usd
TEST_F(UsdExportTest, usd_export_rain_mesh)