Remove test editor integration from Controller and update integration test logic
This commit is contained in:
@@ -108,10 +108,9 @@ absl::Status Controller::OnLoad() {
|
|||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::Status Controller::OnTestLoad() {
|
|
||||||
RETURN_IF_ERROR(test_editor_->Update());
|
|
||||||
return absl::OkStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Controller::DoRender() const {
|
void Controller::DoRender() const {
|
||||||
ImGui::Render();
|
ImGui::Render();
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ class Controller {
|
|||||||
void Initialize(std::string filename = "");
|
void Initialize(std::string filename = "");
|
||||||
void OnInput();
|
void OnInput();
|
||||||
absl::Status OnLoad();
|
absl::Status OnLoad();
|
||||||
absl::Status OnTestLoad();
|
|
||||||
void DoRender() const;
|
void DoRender() const;
|
||||||
void OnExit();
|
void OnExit();
|
||||||
|
|
||||||
@@ -44,7 +43,6 @@ class Controller {
|
|||||||
absl::Status LoadConfigFiles();
|
absl::Status LoadConfigFiles();
|
||||||
|
|
||||||
auto window() -> SDL_Window * { return window_.get(); }
|
auto window() -> SDL_Window * { return window_.get(); }
|
||||||
void init_test_editor(editor::Editor *editor) { test_editor_ = editor; }
|
|
||||||
void set_active(bool active) { active_ = active; }
|
void set_active(bool active) { active_ = active; }
|
||||||
auto active() const { return active_; }
|
auto active() const { return active_; }
|
||||||
|
|
||||||
@@ -52,7 +50,6 @@ class Controller {
|
|||||||
friend int ::main(int argc, char **argv);
|
friend int ::main(int argc, char **argv);
|
||||||
|
|
||||||
bool active_ = false;
|
bool active_ = false;
|
||||||
editor::Editor *test_editor_ = nullptr;
|
|
||||||
editor::EditorManager editor_manager_;
|
editor::EditorManager editor_manager_;
|
||||||
|
|
||||||
int audio_frequency_ = 48000;
|
int audio_frequency_ = 48000;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace integration {
|
|
||||||
|
|
||||||
absl::Status TestEditor::Update() {
|
absl::Status TestEditor::Update() {
|
||||||
ImGui::NewFrame();
|
ImGui::NewFrame();
|
||||||
@@ -44,10 +43,7 @@ void TestEditor::RegisterTests(ImGuiTestEngine* engine) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int RunIntegrationTest() {
|
int RunIntegrationTest() {
|
||||||
yaze::test::integration::TestEditor test_editor;
|
|
||||||
yaze::core::Controller controller;
|
yaze::core::Controller controller;
|
||||||
controller.init_test_editor(&test_editor);
|
|
||||||
|
|
||||||
if (!controller.CreateWindow().ok()) {
|
if (!controller.CreateWindow().ok()) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -71,6 +67,7 @@ int RunIntegrationTest() {
|
|||||||
controller.window(), yaze::core::Renderer::GetInstance().renderer());
|
controller.window(), yaze::core::Renderer::GetInstance().renderer());
|
||||||
ImGui_ImplSDLRenderer2_Init(yaze::core::Renderer::GetInstance().renderer());
|
ImGui_ImplSDLRenderer2_Init(yaze::core::Renderer::GetInstance().renderer());
|
||||||
|
|
||||||
|
yaze::test::integration::TestEditor test_editor;
|
||||||
test_editor.RegisterTests(engine);
|
test_editor.RegisterTests(engine);
|
||||||
ImGuiTestEngine_Start(engine, ImGui::GetCurrentContext());
|
ImGuiTestEngine_Start(engine, ImGui::GetCurrentContext());
|
||||||
controller.set_active(true);
|
controller.set_active(true);
|
||||||
@@ -84,9 +81,7 @@ int RunIntegrationTest() {
|
|||||||
|
|
||||||
while (controller.IsActive()) {
|
while (controller.IsActive()) {
|
||||||
controller.OnInput();
|
controller.OnInput();
|
||||||
if (const auto status = controller.OnTestLoad(); !status.ok()) {
|
test_editor.Update();
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
|
||||||
controller.DoRender();
|
controller.DoRender();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,6 +90,5 @@ int RunIntegrationTest() {
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace integration
|
|
||||||
} // namespace test
|
} // namespace test
|
||||||
} // namespace yaze
|
} // namespace yaze
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ int main(int argc, char* argv[]) {
|
|||||||
absl::InstallFailureSignalHandler(options);
|
absl::InstallFailureSignalHandler(options);
|
||||||
|
|
||||||
if (argc > 1 && std::string(argv[1]) == "integration") {
|
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") {
|
} else if (argc > 1 && std::string(argv[1]) == "room_object") {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
if (!RUN_ALL_TESTS()) {
|
if (!RUN_ALL_TESTS()) {
|
||||||
return yaze::test::integration::RunIntegrationTest();
|
return yaze::test::RunIntegrationTest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user