Skip to content

Commit

Permalink
tests extension crashes when loading unless kit 105.1 update is reverted
Browse files Browse the repository at this point in the history
  • Loading branch information
mattelser committed Oct 3, 2023
1 parent a61f0a8 commit fc1fb84
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cesiumOmniverseCppTestsExtension/include/UsdUtilTests.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

void run_all_UsdUtil_tests();
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

#include "CesiumOmniverseCppTests.h"

#include "UsdUtilTests.h"

#include "cesium/omniverse/Context.h"
#include "cesium/omniverse/LoggerSink.h"
#include "cesium/omniverse/UsdUtil.h"

#include <carb/PluginUtils.h>
#include <doctest/doctest.h>
Expand Down Expand Up @@ -66,7 +67,9 @@ class CesiumOmniverseCppTestsPlugin final : public ICesiumOmniverseCppTestsInter

CESIUM_LOG_INFO("Running Cesium Omniverse Tests with stage id: {}", stage_id);

// construct a context
Context::instance().setStageId(stage_id);

// construct a doctest context
doctest::Context context;

// sets the context as the default one - so asserts used outside of a testing context do not crash
Expand All @@ -77,6 +80,7 @@ class CesiumOmniverseCppTestsPlugin final : public ICesiumOmniverseCppTestsInter
context.setAssertHandler(handler);

exampleTest();
run_all_UsdUtil_tests();

CESIUM_LOG_INFO("Cesium Omniverse Tests complete");
}
Expand Down
20 changes: 20 additions & 0 deletions cesiumOmniverseCppTestsExtension/public/UsdUtilTests.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// #define DOCTEST_CONFIG_IMPLEMENT
// #define DOCTEST_CONFIG_IMPLEMENTATION_IN_DLL
// #define DOCTEST_CONFIG_SUPER_FAST_ASSERTS

#include "UsdUtilTests.h"

#include "cesium/omniverse/Context.h"
#include "cesium/omniverse/LoggerSink.h"
#include "cesium/omniverse/UsdUtil.h"

#include <doctest/doctest.h>

#include <iostream>

void run_all_UsdUtil_tests() {
using namespace cesium::omniverse;
CESIUM_LOG_INFO("Running UsdUtil Tests...");
CHECK(cesium::omniverse::UsdUtil::primExists(pxr::SdfPath("/Cesium")));
CESIUM_LOG_INFO("UsdUtil Tests complete!");
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import omni.ext
import omni.usd
import omni.kit.ui
Expand All @@ -14,7 +15,8 @@ def on_startup(self):
global tests_interface
tests_interface = acquire_cesium_omniverse_tests_interface()

tests_interface.on_startup("exts/cesium.omniverse")
tests_interface.on_startup(os.path.join(os.path.dirname(__file__), "../../../../../cesium.omniverse"))
# tests_interface.on_startup("/home/melser/git/cesium-omniverse/exts/cesium.omniverse/cesium/omniverse/../../")

# TODO ensure the stage has been set up before getting stage id
stageId = omni.usd.get_context().get_stage_id()
Expand Down

0 comments on commit fc1fb84

Please sign in to comment.