summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarge Bot <marge-bot@gnome.org>2022-11-25 19:04:44 +0000
committerMarge Bot <marge-bot@gnome.org>2022-11-25 19:04:44 +0000
commitc6f3fa4e72315cca92a00f30c7448029ba50d1ce (patch)
tree479b02c853922ff9938052a6e8fc8dceff4d4d67
parent4e75d530fed5783b7d6b5df2f63e50fd38829523 (diff)
parentf8be4abbaf59613a55042e2eb1086c6283624a21 (diff)
downloadlibrsvg-c6f3fa4e72315cca92a00f30c7448029ba50d1ce.tar.gz
Merge branch 'update-lopdf-crate-0.29.0' into 'main'
Update the lopdf crate to 0.29.0 See merge request GNOME/librsvg!774
-rw-r--r--Cargo.lock8
-rw-r--r--Cargo.toml2
-rw-r--r--tests/src/predicates/pdf.rs32
3 files changed, 20 insertions, 22 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 8e0b699a..50088cdf 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1113,16 +1113,14 @@ dependencies = [
[[package]]
name = "lopdf"
-version = "0.27.0"
+version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8146695b97752d9c66da0092c6364f8f3ca683f5ea34341db21e5550c3b8c4f4"
+checksum = "de0f69c40d6dbc68ebac4bf5aec3d9978e094e22e29fcabd045acd9cec74a9dc"
dependencies = [
"chrono",
- "dtoa",
"encoding",
"flate2",
- "itoa 0.4.8",
- "lazy_static",
+ "itoa 1.0.4",
"linked-hash-map",
"log",
"pom",
diff --git a/Cargo.toml b/Cargo.toml
index 6c2bbc4f..ab0fd706 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -93,7 +93,7 @@ chrono = "0.4.0"
criterion = "0.3"
glib = "0.16"
libc = "0.2"
-lopdf = "0.27.0"
+lopdf = "0.29.0"
matches = "0.1"
pango = "0.16"
pangocairo = "0.16"
diff --git a/tests/src/predicates/pdf.rs b/tests/src/predicates/pdf.rs
index 62a3da4b..f7872d71 100644
--- a/tests/src/predicates/pdf.rs
+++ b/tests/src/predicates/pdf.rs
@@ -21,8 +21,8 @@ impl PdfPredicate {
pub fn with_page_size(
self: Self,
idx: usize,
- width_in_points: f64,
- height_in_points: f64,
+ width_in_points: f32,
+ height_in_points: f32,
) -> DetailPredicate<Self> {
DetailPredicate::<Self> {
p: self,
@@ -101,13 +101,13 @@ enum Detail {
/// Note that `w` and `h` given in `UserUnit`, which is by default 1.0 = 1/72 inch.
#[derive(Debug)]
struct Dimensions {
- w: f64,
- h: f64,
- unit: f64, // UserUnit, in points (1/72 of an inch)
+ w: f32,
+ h: f32,
+ unit: f32, // UserUnit, in points (1/72 of an inch)
}
impl Dimensions {
- pub fn from_media_box(obj: &lopdf::Object, unit: Option<f64>) -> lopdf::Result<Dimensions> {
+ pub fn from_media_box(obj: &lopdf::Object, unit: Option<f32>) -> lopdf::Result<Dimensions> {
let a = obj.as_array()?;
Ok(Dimensions {
w: a[2].as_float()?,
@@ -116,11 +116,11 @@ impl Dimensions {
})
}
- pub fn width_in_pt(self: &Self) -> f64 {
+ pub fn width_in_pt(self: &Self) -> f32 {
self.w * self.unit
}
- pub fn height_in_pt(self: &Self) -> f64 {
+ pub fn height_in_pt(self: &Self) -> f32 {
self.h * self.unit
}
}
@@ -134,15 +134,15 @@ impl fmt::Display for Dimensions {
impl cmp::PartialEq for Dimensions {
fn eq(&self, other: &Self) -> bool {
approx_eq!(
- f64,
+ f32,
self.width_in_pt(),
other.width_in_pt(),
- epsilon = 0.000_001
+ epsilon = 0.0001
) && approx_eq!(
- f64,
+ f32,
self.height_in_pt(),
other.height_in_pt(),
- epsilon = 0.000_001
+ epsilon = 0.0001
)
}
}
@@ -212,14 +212,14 @@ impl DetailPredicate<PdfPredicate> {
// Extensions to lopdf::Object; can be removed after lopdf 0.26
trait ObjExt {
/// Get the object value as a float.
- /// Unlike as_f64() this will also cast an Integer to a Real.
- fn as_float(&self) -> lopdf::Result<f64>;
+ /// Unlike as_f32() this will also cast an Integer to a Real.
+ fn as_float(&self) -> lopdf::Result<f32>;
}
impl ObjExt for lopdf::Object {
- fn as_float(&self) -> lopdf::Result<f64> {
+ fn as_float(&self) -> lopdf::Result<f32> {
match *self {
- lopdf::Object::Integer(ref value) => Ok(*value as f64),
+ lopdf::Object::Integer(ref value) => Ok(*value as f32),
lopdf::Object::Real(ref value) => Ok(*value),
_ => Err(lopdf::Error::Type),
}