Skip to content

Commit

Permalink
Add test for DPI
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenzV committed Apr 4, 2024
1 parent a75850c commit 021b9b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
9 changes: 4 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
- Added support for text embedding.
- Added a `text` feature flag.
- Made the CLI more flexible in terms of which features you want to include.
- Added `raster-scale` and `text-to-paths` as arguments for the CLI.
- Removed the option to configure the view box from the API. This might be readded in
a later update.
- The `convert_str` method has been removed. You should now always convert your SVG string into a `usvg`
tree yourself and then call either `to_pdf` or `to_chunk`.
- The `convert_tree` method has been renamed into `to_pdf`, and now requires you to provide the fontdb
used for the `usvg` tree, unless you have disabled the `text` feature.
- `convert_tree_into` has been renamed into `to_chunk` and now returns an independent chunk as well
as the object ID of the actual SVG in the chunk.

- TODO: The CLI options have been (temporarily) removed. They will be readded before the next release.
- TODO: Add tests for CLI and svg options
- TODO: Add CLI option to convert text to paths.

### Changed
- Bumped resvg to v0.40.
- `convert_str` now requires a `fontdb` as an argument as well.
Expand Down
Binary file added tests/ref/api/dpi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions tests/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ fn text_to_paths() {
assert_eq!(res, 0);
}

#[test]
fn dpi() {
let conversion_options = ConversionOptions::default();
let page_options = PageOptions {
dpi: 140.0
};

let svg_path = "svg/resvg/text/text/simple-case.svg";
let (pdf, actual_image) =
convert_svg(Path::new(svg_path), conversion_options, page_options);
let res = run_test_impl(pdf, actual_image, "api/dpi");
assert_eq!(res, 0);
}

#[test]
fn to_chunk() {
let mut alloc = Ref::new(1);
Expand Down

0 comments on commit 021b9b1

Please sign in to comment.