From 249d5d8bffa044e464f2938708256a19abd7555b Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Tue, 12 Mar 2024 15:23:32 +0400 Subject: [PATCH] bugfix(dpi): `PhysicalUnit::to_logical` computation The conversion of PhysicalUnit was wrongly computed and the tests were not running on the CI for the dpi crate, thus it was missed, even though the test was correctly failing. Signed-off-by: John Nunley Signed-off-by: Kirill Chibisov --- .github/workflows/ci.yml | 7 +++++++ dpi/src/lib.rs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2552aba6..ee307553 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -145,6 +145,13 @@ jobs: - name: Build crate run: cargo $CMD build $OPTIONS + # Test only on Linux x86_64, so we avoid spending unnecessary CI hours. + - name: Test dpi crate + if: > + contains(matrix.platform.name, 'Linux 64bit') && + matrix.toolchain != '1.70.0' + run: cargo test -p dpi + - name: Build tests if: > !contains(matrix.platform.target, 'redox') && diff --git a/dpi/src/lib.rs b/dpi/src/lib.rs index 0faf475f..9258de30 100644 --- a/dpi/src/lib.rs +++ b/dpi/src/lib.rs @@ -250,7 +250,7 @@ impl PhysicalUnit

{ #[inline] pub fn to_logical(&self, scale_factor: f64) -> LogicalUnit { assert!(validate_scale_factor(scale_factor)); - LogicalUnit::new(self.0.into() * scale_factor).cast() + LogicalUnit::new(self.0.into() / scale_factor).cast() } #[inline]