1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 14:50:03 -04:00

Test that halign & justify works the same

This commit is contained in:
Emil Ernerfeldt
2025-03-30 16:58:19 +02:00
parent 4ee4572f02
commit b0d0d2f279

View File

@@ -997,6 +997,7 @@ mod tests {
use super::*; use super::*;
use crate::{text::TextFormat, Stroke}; use crate::{text::TextFormat, Stroke};
use ecolor::Color32; use ecolor::Color32;
use emath::Align;
fn jobs() -> Vec<LayoutJob> { fn jobs() -> Vec<LayoutJob> {
vec![ vec![
@@ -1021,7 +1022,6 @@ mod tests {
{ {
let mut job = LayoutJob { let mut job = LayoutJob {
first_row_min_height: 20.0, first_row_min_height: 20.0,
justify: true,
..Default::default() ..Default::default()
}; };
job.append( job.append(
@@ -1067,7 +1067,12 @@ mod tests {
FontDefinitions::default(), FontDefinitions::default(),
); );
for job in jobs() { for halign in [Align::Min, Align::Center, Align::Max] {
for justify in [false, true] {
for mut job in jobs() {
job.halign = halign;
job.justify = justify;
let whole = GalleyCache::default().layout(&mut fonts, job.clone(), false); let whole = GalleyCache::default().layout(&mut fonts, job.clone(), false);
let split = GalleyCache::default().layout(&mut fonts, job.clone(), true); let split = GalleyCache::default().layout(&mut fonts, job.clone(), true);
@@ -1097,4 +1102,6 @@ mod tests {
} }
} }
} }
}
}
} }