Add doc tests for the Size constructor functions (#7658)
				
					
				
			# Objective Add doc tests for the `Size` constructor functions. Also changed the function descriptions so they explicitly state the values that elided values are given. ## Changelog * Added doc tests for the `Size` constructor functions.
This commit is contained in:
		
							parent
							
								
									14a7689e1a
								
							
						
					
					
						commit
						39bf45cf5e
					
				| @ -358,6 +358,17 @@ impl Size { | ||||
|     } | ||||
| 
 | ||||
|     /// Creates a new [`Size`] where both sides take the given value.
 | ||||
|     ///
 | ||||
|     /// # Example
 | ||||
|     ///
 | ||||
|     /// ```
 | ||||
|     /// # use bevy_ui::{Size, Val};
 | ||||
|     /// #
 | ||||
|     /// let size = Size::all(Val::Px(10.));
 | ||||
|     ///
 | ||||
|     /// assert_eq!(size.width, Val::Px(10.0));
 | ||||
|     /// assert_eq!(size.height, Val::Px(10.0));
 | ||||
|     /// ```
 | ||||
|     pub const fn all(value: Val) -> Self { | ||||
|         Self { | ||||
|             width: value, | ||||
| @ -365,7 +376,18 @@ impl Size { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /// Creates a new [`Size`] where `width` takes the given value.
 | ||||
|     /// Creates a new [`Size`] where `width` takes the given value and its `height` is `Val::Auto`.
 | ||||
|     ///
 | ||||
|     /// # Example
 | ||||
|     ///
 | ||||
|     /// ```
 | ||||
|     /// # use bevy_ui::{Size, Val};
 | ||||
|     /// #
 | ||||
|     /// let size = Size::width(Val::Px(10.));
 | ||||
|     ///
 | ||||
|     /// assert_eq!(size.width, Val::Px(10.0));
 | ||||
|     /// assert_eq!(size.height, Val::Auto);
 | ||||
|     /// ```
 | ||||
|     pub const fn width(width: Val) -> Self { | ||||
|         Self { | ||||
|             width, | ||||
| @ -373,7 +395,18 @@ impl Size { | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /// Creates a new [`Size`] where `height` takes the given value.
 | ||||
|     /// Creates a new [`Size`] where `height` takes the given value and its `width` is `Val::Auto`.
 | ||||
|     ///
 | ||||
|     /// # Example
 | ||||
|     ///
 | ||||
|     /// ```
 | ||||
|     /// # use bevy_ui::{Size, Val};
 | ||||
|     /// #
 | ||||
|     /// let size = Size::height(Val::Px(10.));
 | ||||
|     ///
 | ||||
|     /// assert_eq!(size.width, Val::Auto);
 | ||||
|     /// assert_eq!(size.height, Val::Px(10.));
 | ||||
|     /// ```
 | ||||
|     pub const fn height(height: Val) -> Self { | ||||
|         Self { | ||||
|             width: Val::Auto, | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 ickshonpe
						ickshonpe