Skip to content

Commit 6b59a27

Browse files
committed
try CI
1 parent 39bb3c5 commit 6b59a27

18 files changed

+486
-20
lines changed

Cargo.lock

Lines changed: 468 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ cosmic-text = {git = "https://github.com/LaurenzV/cosmic-text", rev = "d8cad28"}
3434
quote = "1.0.37"
3535
syn = { version = "2.0.76", features = ["full", "extra-traits"] }
3636
proc-macro2 = "1.0.86"
37+
oxipng = "9.1.2"
3738
krilla-macros = {path = "krilla-macros"}
3839

3940
[package]
@@ -71,5 +72,6 @@ rustybuzz = { workspace = true }
7172
sitro = { workspace = true }
7273
cosmic-text = { workspace = true }
7374
krilla-macros = { workspace = true }
75+
oxipng = { workspace = true }
7476

7577

src/tests/mod.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::font::Font;
22
use crate::stream::Glyph;
33
use difference::{Changeset, Difference};
44
use image::{load_from_memory, Rgba, RgbaImage};
5-
use resvg::render;
65
use rustybuzz::{Direction, UnicodeBuffer};
76
use sitro::{
87
render_ghostscript, render_mupdf, render_pdfbox, render_pdfium, render_pdfjs, render_poppler,
@@ -13,6 +12,7 @@ use std::cell::LazyCell;
1312
use std::cmp::max;
1413
use std::path::PathBuf;
1514
use std::sync::Arc;
15+
use oxipng::{InFile, OutFile};
1616
use tiny_skia_path::{Path, PathBuilder, Rect};
1717

1818
mod manual;
@@ -23,27 +23,27 @@ const STORE: bool = true;
2323

2424
const SNAPSHOT_PATH: LazyCell<PathBuf> = LazyCell::new(|| {
2525
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/snapshots");
26-
std::fs::create_dir_all(&path).unwrap();
26+
let _ = std::fs::create_dir_all(&path);
2727
path
2828
});
2929

3030
const REFS_PATH: LazyCell<PathBuf> = LazyCell::new(|| {
3131
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/refs");
32-
std::fs::create_dir_all(&path).unwrap();
32+
let _ = std::fs::create_dir_all(&path);
3333
path
3434
});
3535

3636
const DIFFS_PATH: LazyCell<PathBuf> = LazyCell::new(|| {
3737
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/diffs");
38-
std::fs::remove_dir_all(&path);
39-
std::fs::create_dir_all(&path).unwrap();
38+
let _ = std::fs::remove_dir_all(&path);
39+
let _ = std::fs::create_dir_all(&path).unwrap();
4040
path
4141
});
4242

4343
const STORE_PATH: LazyCell<PathBuf> = LazyCell::new(|| {
4444
let path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/store");
45-
std::fs::remove_dir_all(&path);
46-
std::fs::create_dir_all(&path).unwrap();
45+
let _ = std::fs::remove_dir_all(&path);
46+
let _ = std::fs::create_dir_all(&path).unwrap();
4747
path
4848
});
4949

@@ -76,14 +76,14 @@ pub fn rect_to_path(x1: f32, y1: f32, x2: f32, y2: f32) -> Path {
7676

7777
fn write_snapshot_to_store(name: &str, content: &[u8]) {
7878
let mut path = STORE_PATH.clone().join("snapshots");
79-
std::fs::create_dir_all(&path).unwrap();
79+
let _ = std::fs::create_dir_all(&path);
8080
path.push(format!("{}.pdf", name));
8181
std::fs::write(&path, &content).unwrap();
8282
}
8383

8484
pub fn write_manual_to_store(name: &str, data: &[u8]) {
85-
let mut path = STORE_PATH.clone().join("manual");
86-
std::fs::create_dir_all(&path).unwrap();
85+
let path = STORE_PATH.clone().join("manual");
86+
let _ = std::fs::create_dir_all(&path);
8787

8888
let pdf_path = path.join(format!("{}.pdf", name));
8989
let txt_path = path.join(format!("{}.txt", name));
@@ -141,6 +141,12 @@ pub fn check_render(name: &str, renderer: &Renderer, document: RenderedDocument)
141141

142142
if !ref_path.exists() {
143143
std::fs::write(&ref_path, page).unwrap();
144+
oxipng::optimize(
145+
&InFile::Path(ref_path.clone()),
146+
&OutFile::from_path(ref_path),
147+
&oxipng::Options::max_compression(),
148+
)
149+
.unwrap();
144150
panic!("new reference image was created");
145151
}
146152

src/tests/visreg.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use cosmic_text::{Attrs, Buffer, FontSystem, Metrics, Shaping};
88
use fontdb::{Database, Source};
99
use krilla_macros::visreg;
1010
use skrifa::GlyphId;
11-
use std::sync::Arc;
1211
use tiny_skia_path::{NormalizedF32, PathBuilder, Rect, Transform};
1312

1413
#[visreg]
3.09 KB
Loading

tests/refs/cosmic_text_mupdf.png

5.18 KB
Loading

tests/refs/cosmic_text_pdfbox.png

5.86 KB
Loading

tests/refs/cosmic_text_pdfium.png

11.9 KB
Loading

tests/refs/cosmic_text_pdfjs.png

4.85 KB
Loading

tests/refs/cosmic_text_poppler.png

6.27 KB
Loading

tests/refs/cosmic_text_quartz.png

7.06 KB
Loading
850 Bytes
Loading

tests/refs/linear_gradient_mupdf.png

2.45 KB
Loading

tests/refs/linear_gradient_pdfbox.png

1.13 KB
Loading

tests/refs/linear_gradient_pdfium.png

1.73 KB
Loading

tests/refs/linear_gradient_pdfjs.png

810 Bytes
Loading
584 Bytes
Loading

tests/refs/linear_gradient_quartz.png

21.4 KB
Loading

0 commit comments

Comments
 (0)