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 <dev@notgull.net>
Signed-off-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
Kirill Chibisov 2024-03-12 15:23:32 +04:00
parent 66df2c22ba
commit 249d5d8bff
2 changed files with 8 additions and 1 deletions

View file

@ -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') &&

View file

@ -250,7 +250,7 @@ impl<P: Pixel> PhysicalUnit<P> {
#[inline]
pub fn to_logical<X: Pixel>(&self, scale_factor: f64) -> LogicalUnit<X> {
assert!(validate_scale_factor(scale_factor));
LogicalUnit::new(self.0.into() * scale_factor).cast()
LogicalUnit::new(self.0.into() / scale_factor).cast()
}
#[inline]