mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 02:10:05 +00:00 
			
		
		
		
	Settings container
This commit is contained in:
		
							parent
							
								
									08b1d6e152
								
							
						
					
					
						commit
						1ad67de71b
					
				
					 7 changed files with 251 additions and 14 deletions
				
			
		
							
								
								
									
										32
									
								
								test/source/scwx/qt/settings/settings_container.test.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								test/source/scwx/qt/settings/settings_container.test.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,32 @@ | |||
| #include <scwx/qt/settings/settings_container.hpp> | ||||
| 
 | ||||
| #include <gmock/gmock.h> | ||||
| #include <gtest/gtest.h> | ||||
| 
 | ||||
| namespace scwx | ||||
| { | ||||
| namespace qt | ||||
| { | ||||
| namespace settings | ||||
| { | ||||
| 
 | ||||
| TEST(SettingsContainerTest, Integer) | ||||
| { | ||||
|    SettingsContainer<std::vector<int64_t>> intContainer { | ||||
|       "std::vector<int64_t>"}; | ||||
|    intContainer.SetDefault({42, 5, 63}); | ||||
|    intContainer.SetElementMinimum(4); | ||||
|    intContainer.SetElementMaximum(70); | ||||
|    intContainer.SetValueToDefault(); | ||||
| 
 | ||||
|    EXPECT_EQ(intContainer.name(), "std::vector<int64_t>"); | ||||
|    EXPECT_THAT(intContainer.GetValue(), ::testing::ElementsAre(42, 5, 63)); | ||||
|    EXPECT_EQ(intContainer.SetValueOrDefault({50, 0, 80}), false); | ||||
|    EXPECT_THAT(intContainer.GetValue(), ::testing::ElementsAre(50, 4, 70)); | ||||
|    EXPECT_EQ(intContainer.SetValueOrDefault({10, 20, 30}), true); | ||||
|    EXPECT_THAT(intContainer.GetValue(), ::testing::ElementsAre(10, 20, 30)); | ||||
| } | ||||
| 
 | ||||
| } // namespace settings
 | ||||
| } // namespace qt
 | ||||
| } // namespace scwx
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat