mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 15:00:06 +00:00 
			
		
		
		
	ImGui context model test fixes
This commit is contained in:
		
							parent
							
								
									65f63bbf85
								
							
						
					
					
						commit
						399a07b1e2
					
				
					 4 changed files with 23 additions and 14 deletions
				
			
		|  | @ -130,6 +130,11 @@ void ImGuiContextModel::DestroyContext(const std::string& name) | |||
|    } | ||||
| } | ||||
| 
 | ||||
| std::vector<ImGuiContextInfo> ImGuiContextModel::contexts() const | ||||
| { | ||||
|    return p->contexts_; | ||||
| } | ||||
| 
 | ||||
| ImGuiContextModel& ImGuiContextModel::Instance() | ||||
| { | ||||
|    static ImGuiContextModel instance_ {}; | ||||
|  |  | |||
|  | @ -45,6 +45,8 @@ public: | |||
|    ImGuiContext* CreateContext(const std::string& name); | ||||
|    void          DestroyContext(const std::string& name); | ||||
| 
 | ||||
|    std::vector<ImGuiContextInfo> contexts() const; | ||||
| 
 | ||||
|    static ImGuiContextModel& Instance(); | ||||
| 
 | ||||
| signals: | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| #include <scwx/qt/manager/imgui_manager.hpp> | ||||
| #include <scwx/qt/model/imgui_context_model.hpp> | ||||
| 
 | ||||
| #include <gtest/gtest.h> | ||||
| 
 | ||||
|  | @ -6,18 +6,18 @@ namespace scwx | |||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace manager | ||||
| namespace model | ||||
| { | ||||
| 
 | ||||
| TEST(ImGuiManagerTest, State) | ||||
| TEST(ImGuiContextModelTest, State) | ||||
| { | ||||
|    auto& ImGuiManager = ImGuiManager::Instance(); | ||||
|    auto& imGuiContextModel = ImGuiContextModel::Instance(); | ||||
| 
 | ||||
|    ImGuiManager.CreateContext("Context One"); | ||||
|    ImGuiManager.CreateContext("Context Two"); | ||||
|    ImGuiManager.CreateContext("Context Three"); | ||||
|    imGuiContextModel.CreateContext("Context One"); | ||||
|    imGuiContextModel.CreateContext("Context Two"); | ||||
|    imGuiContextModel.CreateContext("Context Three"); | ||||
| 
 | ||||
|    auto contexts = ImGuiManager.contexts(); | ||||
|    auto contexts = imGuiContextModel.contexts(); | ||||
| 
 | ||||
|    ASSERT_EQ(contexts.size(), 3u); | ||||
|    EXPECT_EQ(contexts.at(0).id_, 0u); | ||||
|  | @ -30,15 +30,15 @@ TEST(ImGuiManagerTest, State) | |||
|    EXPECT_NE(contexts.at(1).context_, nullptr); | ||||
|    EXPECT_NE(contexts.at(2).context_, nullptr); | ||||
| 
 | ||||
|    ImGuiManager.DestroyContext("Context Two"); | ||||
|    imGuiContextModel.DestroyContext("Context Two"); | ||||
| 
 | ||||
|    auto contexts2 = ImGuiManager.contexts(); | ||||
|    auto contexts2 = imGuiContextModel.contexts(); | ||||
| 
 | ||||
|    ASSERT_EQ(contexts2.size(), 2u); | ||||
|    EXPECT_EQ(contexts2.at(0), contexts.at(0)); | ||||
|    EXPECT_EQ(contexts2.at(1), contexts.at(2)); | ||||
| } | ||||
| 
 | ||||
| } // namespace manager
 | ||||
| } // namespace model
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
|  | @ -21,8 +21,8 @@ set(SRC_PROVIDER_TESTS source/scwx/provider/aws_level2_data_provider.test.cpp | |||
|                        source/scwx/provider/warnings_provider.test.cpp) | ||||
| set(SRC_QT_CONFIG_TESTS source/scwx/qt/config/county_database.test.cpp | ||||
|                         source/scwx/qt/config/radar_site.test.cpp) | ||||
| set(SRC_QT_MANAGER_TESTS source/scwx/qt/manager/imgui_manager.test.cpp | ||||
|                          source/scwx/qt/manager/settings_manager.test.cpp) | ||||
| set(SRC_QT_MANAGER_TESTS source/scwx/qt/manager/settings_manager.test.cpp) | ||||
| set(SRC_QT_MODEL_TESTS source/scwx/qt/model/imgui_context_model.test.cpp) | ||||
| set(SRC_UTIL_TESTS source/scwx/util/float.test.cpp | ||||
|                    source/scwx/util/rangebuf.test.cpp | ||||
|                    source/scwx/util/streams.test.cpp | ||||
|  | @ -40,6 +40,7 @@ add_executable(wxtest ${SRC_MAIN} | |||
|                       ${SRC_PROVIDER_TESTS} | ||||
|                       ${SRC_QT_CONFIG_TESTS} | ||||
|                       ${SRC_QT_MANAGER_TESTS} | ||||
|                       ${SRC_QT_MODEL_TESTS} | ||||
|                       ${SRC_UTIL_TESTS} | ||||
|                       ${SRC_WSR88D_TESTS} | ||||
|                       ${CMAKE_FILES}) | ||||
|  | @ -51,6 +52,7 @@ source_group("Source Files\\network"     FILES ${SRC_NETWORK_TESTS}) | |||
| source_group("Source Files\\provider"    FILES ${SRC_PROVIDER_TESTS}) | ||||
| source_group("Source Files\\qt\\config"  FILES ${SRC_QT_CONFIG_TESTS}) | ||||
| source_group("Source Files\\qt\\manager" FILES ${SRC_QT_MANAGER_TESTS}) | ||||
| source_group("Source Files\\qt\\model"   FILES ${SRC_QT_MODEL_TESTS}) | ||||
| source_group("Source Files\\util"        FILES ${SRC_UTIL_TESTS}) | ||||
| source_group("Source Files\\wsr88d"      FILES ${SRC_WSR88D_TESTS}) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat