Example #1
0
 /**
  * @dataProvider provideDimensionsAndExpectedratio
  */
 public function testFromDimensions($width, $height, $strategy, $expected, $calculatedWidth, $calculatedHeight, $modulus = 2)
 {
     $ratio = AspectRatio::create(new Dimension($width, $height), $strategy);
     $this->assertEquals($expected, $ratio->getValue());
     $this->assertEquals($calculatedHeight, $ratio->calculateHeight(240, $modulus));
     $this->assertEquals($calculatedWidth, $ratio->calculateWidth(320, $modulus));
 }
Example #2
0
 /**
  * Returns the ratio.
  *
  * @param type $forceStandards Whether or not force the use of standards ratios;
  *
  * @return AspectRatio
  */
 public function getRatio($forceStandards = true)
 {
     return AspectRatio::create($this, $forceStandards);
 }