mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 08:20:05 +00:00 
			
		
		
		
	Add ImGui Manager to manage creation and deletion of contexts
This commit is contained in:
		
							parent
							
								
									fef3c597d0
								
							
						
					
					
						commit
						ee2ec329da
					
				
					 5 changed files with 197 additions and 3 deletions
				
			
		
							
								
								
									
										44
									
								
								test/source/scwx/qt/manager/imgui_manager.test.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								test/source/scwx/qt/manager/imgui_manager.test.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,44 @@ | |||
| #include <scwx/qt/manager/imgui_manager.hpp> | ||||
| 
 | ||||
| #include <gtest/gtest.h> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace manager | ||||
| { | ||||
| 
 | ||||
| TEST(ImGuiManagerTest, State) | ||||
| { | ||||
|    auto& ImGuiManager = ImGuiManager::Instance(); | ||||
| 
 | ||||
|    ImGuiManager.CreateContext("Context One"); | ||||
|    ImGuiManager.CreateContext("Context Two"); | ||||
|    ImGuiManager.CreateContext("Context Three"); | ||||
|     | ||||
|    auto contexts = ImGuiManager.contexts(); | ||||
| 
 | ||||
|    ASSERT_EQ(contexts.size(), 3u); | ||||
|    EXPECT_EQ(contexts.at(0).id_, 0u); | ||||
|    EXPECT_EQ(contexts.at(1).id_, 1u); | ||||
|    EXPECT_EQ(contexts.at(2).id_, 2u); | ||||
|    EXPECT_EQ(contexts.at(0).name_, "Context One"); | ||||
|    EXPECT_EQ(contexts.at(1).name_, "Context Two"); | ||||
|    EXPECT_EQ(contexts.at(2).name_, "Context Three"); | ||||
|    EXPECT_NE(contexts.at(0).context_, nullptr); | ||||
|    EXPECT_NE(contexts.at(1).context_, nullptr); | ||||
|    EXPECT_NE(contexts.at(2).context_, nullptr); | ||||
| 
 | ||||
|    ImGuiManager.DestroyContext("Context Two"); | ||||
| 
 | ||||
|    auto contexts2 = ImGuiManager.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 qt
 | ||||
| } // namespace scwx
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat