Remove test editor integration from Controller and update integration test logic

This commit is contained in:
scawful
2025-03-11 20:11:47 -04:00
parent 986084f3cd
commit 358520fcae
4 changed files with 7 additions and 17 deletions

View File

@@ -108,10 +108,9 @@ absl::Status Controller::OnLoad() {
return absl::OkStatus();
}
absl::Status Controller::OnTestLoad() {
RETURN_IF_ERROR(test_editor_->Update());
return absl::OkStatus();
}
void Controller::DoRender() const {
ImGui::Render();

View File

@@ -33,7 +33,6 @@ class Controller {
void Initialize(std::string filename = "");
void OnInput();
absl::Status OnLoad();
absl::Status OnTestLoad();
void DoRender() const;
void OnExit();
@@ -44,7 +43,6 @@ class Controller {
absl::Status LoadConfigFiles();
auto window() -> SDL_Window * { return window_.get(); }
void init_test_editor(editor::Editor *editor) { test_editor_ = editor; }
void set_active(bool active) { active_ = active; }
auto active() const { return active_; }
@@ -52,7 +50,6 @@ class Controller {
friend int ::main(int argc, char **argv);
bool active_ = false;
editor::Editor *test_editor_ = nullptr;
editor::EditorManager editor_manager_;
int audio_frequency_ = 48000;

View File

@@ -15,7 +15,6 @@
namespace yaze {
namespace test {
namespace integration {
absl::Status TestEditor::Update() {
ImGui::NewFrame();
@@ -44,10 +43,7 @@ void TestEditor::RegisterTests(ImGuiTestEngine* engine) {
}
int RunIntegrationTest() {
yaze::test::integration::TestEditor test_editor;
yaze::core::Controller controller;
controller.init_test_editor(&test_editor);
if (!controller.CreateWindow().ok()) {
return EXIT_FAILURE;
}
@@ -71,6 +67,7 @@ int RunIntegrationTest() {
controller.window(), yaze::core::Renderer::GetInstance().renderer());
ImGui_ImplSDLRenderer2_Init(yaze::core::Renderer::GetInstance().renderer());
yaze::test::integration::TestEditor test_editor;
test_editor.RegisterTests(engine);
ImGuiTestEngine_Start(engine, ImGui::GetCurrentContext());
controller.set_active(true);
@@ -84,9 +81,7 @@ int RunIntegrationTest() {
while (controller.IsActive()) {
controller.OnInput();
if (const auto status = controller.OnTestLoad(); !status.ok()) {
return EXIT_FAILURE;
}
test_editor.Update();
controller.DoRender();
}
@@ -95,6 +90,5 @@ int RunIntegrationTest() {
return EXIT_SUCCESS;
}
} // namespace integration
} // namespace test
} // namespace yaze

View File

@@ -13,11 +13,11 @@ int main(int argc, char* argv[]) {
absl::InstallFailureSignalHandler(options);
if (argc > 1 && std::string(argv[1]) == "integration") {
return yaze::test::integration::RunIntegrationTest();
return yaze::test::RunIntegrationTest();
} else if (argc > 1 && std::string(argv[1]) == "room_object") {
::testing::InitGoogleTest(&argc, argv);
if (!RUN_ALL_TESTS()) {
return yaze::test::integration::RunIntegrationTest();
return yaze::test::RunIntegrationTest();
}
}