Skip to content

Commit

Permalink
Merge eca93ab into 1431994
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Jul 21, 2021
2 parents 1431994 + eca93ab commit 93b8ff6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/Common/Drawing.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function emuToPixels(int $pValue = 0): float
*/
public static function pixelsToPoints(int $pValue = 0): float
{
return $pValue * 0.67777777;
return $pValue * 0.75;
}

/**
Expand All @@ -74,7 +74,7 @@ public static function pointsToCentimeters(int $pValue = 0): float
return 0;
}

return (($pValue * 1.333333333) / self::DPI_96) * 2.54;
return (($pValue / 0.75) / self::DPI_96) * 2.54;
}

/**
Expand All @@ -90,7 +90,7 @@ public static function pointsToPixels(int $pValue = 0): float
return 0;
}

return $pValue * 1.333333333;
return $pValue / 0.75;
}

/**
Expand Down Expand Up @@ -227,7 +227,7 @@ public static function twipsToPixels(int $pValue = 0): float
return 0;
}

return round($pValue / 15.873984);
return round($pValue / 15);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/Common/Tests/DrawingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ public function testPixelsPoints(): void
$value = rand(1, 100);

$this->assertEquals(0, Drawing::pixelsToPoints());
$this->assertEquals($value * 0.67777777, Drawing::pixelsToPoints($value));
$this->assertEquals($value * 0.75, Drawing::pixelsToPoints($value));
$this->assertEquals(0, Drawing::pointsToPixels());
$this->assertEquals($value * 1.333333333, Drawing::pointsToPixels($value));
$this->assertEquals($value / 0.75, Drawing::pointsToPixels($value));
}

public function testPointsCentimeters(): void
{
$value = rand(1, 100);

$this->assertEquals(0, Drawing::pointsToCentimeters());
$this->assertEquals($value * 1.333333333 / Drawing::DPI_96 * 2.54, Drawing::pointsToCentimeters($value));
$this->assertEquals($value / 0.75 / Drawing::DPI_96 * 2.54, Drawing::pointsToCentimeters($value));
}

public function testTwips(): void
Expand All @@ -94,7 +94,7 @@ public function testTwips(): void

// Pixels
$this->assertEquals(0, Drawing::twipsToPixels());
$this->assertEquals(round($value / 15.873984), Drawing::twipsToPixels($value));
$this->assertEquals(round($value / 15), Drawing::twipsToPixels($value));
}

public function testHTML(): void
Expand Down

0 comments on commit 93b8ff6

Please sign in to comment.