2020-09-29 13:47:50 +02:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include <mm/resource_manager.hpp>
|
|
|
|
|
|
|
|
#include <mm/engine.hpp>
|
|
|
|
|
|
|
|
#include <mm/services/sdl_service.hpp>
|
|
|
|
#include <mm/services/filesystem.hpp>
|
2021-12-12 22:56:16 +01:00
|
|
|
#include <mm/services/organizer_scene.hpp>
|
2020-09-29 13:47:50 +02:00
|
|
|
#include <mm/services/imgui_s.hpp>
|
2021-01-11 18:47:15 +01:00
|
|
|
#include <mm/services/imgui_menu_bar.hpp>
|
|
|
|
#include <mm/services/engine_tools.hpp>
|
2022-11-07 00:52:37 +01:00
|
|
|
#include <mm/services/count_down.hpp>
|
2020-09-29 13:47:50 +02:00
|
|
|
|
|
|
|
#include <mm/services/opengl_renderer.hpp>
|
|
|
|
#include <mm/opengl/render_tasks/imgui.hpp>
|
|
|
|
|
|
|
|
#include <mm/services/scene_tools.hpp>
|
|
|
|
|
|
|
|
static char* argv0;
|
|
|
|
|
2020-12-12 18:21:45 +01:00
|
|
|
using namespace entt::literals;
|
|
|
|
|
2020-09-29 13:47:50 +02:00
|
|
|
TEST(imgui_scene_tools, it) {
|
|
|
|
MM::Engine engine;
|
|
|
|
|
|
|
|
auto& sdl_ss = engine.addService<MM::Services::SDLService>(SDL_INIT_VIDEO);
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::SDLService>());
|
|
|
|
|
|
|
|
sdl_ss.createGLWindow("imgui_scene_tools_test", 1280, 720);
|
|
|
|
|
|
|
|
engine.addService<MM::Services::FilesystemService>(argv0, "imgui_scene_tools_test");
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::FilesystemService>());
|
|
|
|
|
2021-12-12 22:56:16 +01:00
|
|
|
engine.addService<MM::Services::OrganizerSceneService>();
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::OrganizerSceneService>());
|
2020-09-29 13:47:50 +02:00
|
|
|
|
2021-12-12 22:56:16 +01:00
|
|
|
bool provide_ret = engine.provide<MM::Services::SceneServiceInterface, MM::Services::OrganizerSceneService>();
|
2020-09-29 13:47:50 +02:00
|
|
|
ASSERT_TRUE(provide_ret);
|
|
|
|
|
|
|
|
engine.addService<MM::Services::ImGuiService>();
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::ImGuiService>());
|
|
|
|
|
2021-01-11 18:47:15 +01:00
|
|
|
engine.addService<MM::Services::ImGuiMenuBar>();
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::ImGuiMenuBar>());
|
|
|
|
|
|
|
|
engine.addService<MM::Services::ImGuiEngineTools>();
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::ImGuiEngineTools>());
|
|
|
|
|
2020-09-29 13:47:50 +02:00
|
|
|
engine.addService<MM::Services::ImGuiSceneToolsService>();
|
2021-04-28 19:38:25 +02:00
|
|
|
//engine.getUpdateStrategy().depend("ImGuiSceneToolsService::render"_hs, "SimpleSceneService::scene_tick"_hs);
|
2020-09-29 13:47:50 +02:00
|
|
|
|
|
|
|
auto& rs = engine.addService<MM::Services::OpenGLRenderer>();
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::OpenGLRenderer>());
|
|
|
|
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::ImGuiSceneToolsService>());
|
|
|
|
|
2022-11-07 00:52:37 +01:00
|
|
|
#ifdef MM_AUTOTEST
|
|
|
|
engine.addService<MM::Services::CountDown>(50); // 50 frames
|
|
|
|
ASSERT_TRUE(engine.enableService<MM::Services::CountDown>());
|
|
|
|
#endif
|
|
|
|
|
2020-09-29 13:47:50 +02:00
|
|
|
rs.addRenderTask<MM::OpenGL::RenderTasks::ImGuiRT>(engine);
|
|
|
|
|
2020-12-26 19:29:39 +01:00
|
|
|
engine.run();
|
2020-09-29 13:47:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
// TODO: clear asset manager
|
|
|
|
|
|
|
|
sdl_ss.destroyWindow();
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
argv0 = argv[0];
|
|
|
|
|
|
|
|
::testing::InitGoogleTest(&argc, argv);
|
|
|
|
|
|
|
|
return RUN_ALL_TESTS();
|
|
|
|
}
|
|
|
|
|