Making DynamicEnum::is_dynamic() return true (#14732)
				
					
				
			# Objective - Right now `DynamicEnum::is_dynamic()` is returning `false`. I don't think this was expected, since the rest of `Dynamic*` types return `true`. ## Solution - Making `DynamicEnum::is_dynamic()` return true ## Testing - Added an extra unit test to verify that `.is_dynamic()` returns `true`.
This commit is contained in:
		
							parent
							
								
									9de25ad330
								
							
						
					
					
						commit
						a44278aee6
					
				| @ -415,6 +415,11 @@ impl PartialReflect for DynamicEnum { | |||||||
|         enum_debug(self, f)?; |         enum_debug(self, f)?; | ||||||
|         write!(f, ")") |         write!(f, ")") | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     #[inline] | ||||||
|  |     fn is_dynamic(&self) -> bool { | ||||||
|  |         true | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl_type_path!((in bevy_reflect) DynamicEnum); | impl_type_path!((in bevy_reflect) DynamicEnum); | ||||||
|  | |||||||
| @ -211,6 +211,12 @@ mod tests { | |||||||
|         assert_eq!(MyEnum::A, value); |         assert_eq!(MyEnum::A, value); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     #[test] | ||||||
|  |     fn dynamic_enum_should_return_is_dynamic() { | ||||||
|  |         let dyn_enum = DynamicEnum::from(MyEnum::B(123, 321)); | ||||||
|  |         assert!(dyn_enum.is_dynamic()); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     #[test] |     #[test] | ||||||
|     fn enum_should_iterate_fields() { |     fn enum_should_iterate_fields() { | ||||||
|         // === Unit === //
 |         // === Unit === //
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 eckz
						eckz