Skip to content

Commit b6e4d17

Browse files
authored
Adding PartialEq to some UI and Text types (#19552)
# Objective - During the development of [`bevy_flair`](https://github.com/eckz/bevy_flair) I found [some types lacking `PartialEq`](https://github.com/search?q=repo%3Aeckz%2Fbevy_flair%20%20%22Try%20to%20upstream%20it%20to%20bevy%22&type=code) which made the unit testing a little bit inconvinient. ## Solution - Adding `PartialEq` for the following types: - `LineHeight ` - `TextShadow` - `NodeImageMode` ## Testing - Letting github actions do the testing, this is not an invasive change and `cargo run --bin ci` doesn't seem to work in `main` at the moment.
1 parent bebe7c4 commit b6e4d17

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

crates/bevy_text/src/text.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,8 @@ impl Default for TextFont {
354354
/// Specifies the height of each line of text for `Text` and `Text2d`
355355
///
356356
/// Default is 1.2x the font size
357-
#[derive(Debug, Clone, Copy, Reflect)]
358-
#[reflect(Debug, Clone)]
357+
#[derive(Debug, Clone, Copy, PartialEq, Reflect)]
358+
#[reflect(Debug, Clone, PartialEq)]
359359
pub enum LineHeight {
360360
/// Set line height to a specific number of pixels
361361
Px(f32),

crates/bevy_ui/src/ui_node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2865,8 +2865,8 @@ impl ComputedNodeTarget {
28652865
}
28662866

28672867
/// Adds a shadow behind text
2868-
#[derive(Component, Copy, Clone, Debug, Reflect)]
2869-
#[reflect(Component, Default, Debug, Clone)]
2868+
#[derive(Component, Copy, Clone, Debug, PartialEq, Reflect)]
2869+
#[reflect(Component, Default, Debug, Clone, PartialEq)]
28702870
pub struct TextShadow {
28712871
/// Shadow displacement in logical pixels
28722872
/// With a value of zero the shadow will be hidden directly behind the text

crates/bevy_ui/src/widget/image.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ impl From<Handle<Image>> for ImageNode {
138138
}
139139

140140
/// Controls how the image is altered to fit within the layout and how the layout algorithm determines the space in the layout for the image
141-
#[derive(Default, Debug, Clone, Reflect)]
142-
#[reflect(Clone, Default)]
141+
#[derive(Default, Debug, Clone, PartialEq, Reflect)]
142+
#[reflect(Clone, Default, PartialEq)]
143143
pub enum NodeImageMode {
144144
/// The image will be sized automatically by taking the size of the source image and applying any layout constraints.
145145
#[default]

0 commit comments

Comments
 (0)