mirror of https://github.com/linebender/xilem
Default to a line height of 1.2 (#756)
https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#normal
This commit is contained in:
parent
af96e784e3
commit
15c0a5546c
|
@ -666,16 +666,19 @@ impl TestHarness {
|
|||
// TODO: If this file is corrupted, it could be an lfs bandwidth/installation issue.
|
||||
// Have a warning for that case (i.e. differentiation between not-found and invalid format)
|
||||
// and a environment variable to ignore the test in that case.
|
||||
if let Ok(reference_file) = ImageReader::open(reference_path) {
|
||||
if let Ok(reference_file) = ImageReader::open(&reference_path) {
|
||||
let ref_image = reference_file.decode().unwrap().to_rgb8();
|
||||
|
||||
if let Some(diff_image) = get_image_diff(&ref_image, &new_image.to_rgb8()) {
|
||||
// Remove '<test_name>.new.png' '<test_name>.diff.png' files if they exist
|
||||
let _ = std::fs::remove_file(&new_path);
|
||||
let _ = std::fs::remove_file(&diff_path);
|
||||
new_image.save(&new_path).unwrap();
|
||||
diff_image.save(&diff_path).unwrap();
|
||||
panic!("Snapshot test '{test_name}' failed: Images are different");
|
||||
if std::env::var_os("MASONRY_TEST_BLESS").is_some_and(|it| !it.is_empty()) {
|
||||
let _ = std::fs::remove_file(&new_path);
|
||||
let _ = std::fs::remove_file(&diff_path);
|
||||
new_image.save(&reference_path).unwrap();
|
||||
} else {
|
||||
new_image.save(&new_path).unwrap();
|
||||
diff_image.save(&diff_path).unwrap();
|
||||
panic!("Snapshot test '{test_name}' failed: Images are different");
|
||||
}
|
||||
} else {
|
||||
// Remove the vestigial new and diff images
|
||||
let _ = std::fs::remove_file(&new_path);
|
||||
|
|
|
@ -15,6 +15,10 @@ impl<Brush: parley::Brush> StyleSet<Brush> {
|
|||
pub fn new(font_size: f32) -> Self {
|
||||
let mut this = Self(Default::default());
|
||||
this.insert(StyleProperty::FontSize(font_size));
|
||||
// Emulate: https://developer.mozilla.org/en-US/docs/Web/CSS/line-height#normal
|
||||
// This is a more sensible default that Parley's default.
|
||||
// We expect Parley to make a different choice here at some point?
|
||||
this.insert(StyleProperty::LineHeight(1.2));
|
||||
this
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2d6aba6b8c39bfd7b3dd64d7909d970d2e548cdea553f77e9792aa26174bc6ed
|
||||
oid sha256:19b9f424c375ea163fc0449695ff0c9f0f3f04d2e6ecd0fdd750c2dcb69c30be
|
||||
size 6772
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:491d4b32093f22c4f4bdcd3799f129c5f8357c5b3286510784b19a2f52fbb130
|
||||
oid sha256:8cff20e13cc4f0e7b8170f7e532c9cbd6186ee75f303ff2c82fe608ed136b9fe
|
||||
size 2453
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d6dfbc29948c5c320f02b6c4d7a1c9679f5a72e053ce287bdf2ec5b5191f536a
|
||||
size 19698
|
||||
oid sha256:4cfdacb4dd4dec10f71009ffab2d5ea4d39a78b4128112be210be5a047350616
|
||||
size 19716
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:33d472739acebf5d924ed59c80ff8a386a917c8d3baa1b3c491ad4d43ec24b6e
|
||||
oid sha256:b49b0f26b281e6cd84f39c828fc2152dd291c866bf77e95bb4a33fddaf93b99c
|
||||
size 9754
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a19a2fd637f0d5337f458985fed9484d8130e75f1ed07124ac6e4d570f04207b
|
||||
oid sha256:0e5d4fc75d2532c9fa2132173572d27c7cd721484096f2737e1809261125d8ab
|
||||
size 2433
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:279bd83a4fbbb701586a597cdaf31e90b24bda5a8092ef941a0f1460c1058fbf
|
||||
oid sha256:0ce079b70da1efa2e4870a3f8a789d6ff5e748e8d6604125357cca55f1a0bc8f
|
||||
size 1664
|
||||
|
|
Loading…
Reference in New Issue