PhpOffice\PhpPresentation\DocumentLayout::getCX PHP Method

getCX() public method

Get Document Layout cx
public getCX ( string $unit = self::UNIT_EMU ) : integer
$unit string
return integer
    public function getCX($unit = self::UNIT_EMU)
    {
        return $this->convertUnit($this->dimensionX, self::UNIT_EMU, $unit);
    }

Usage Example

 public function testCX()
 {
     $value = rand(1, 100000);
     $object = new DocumentLayout();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value));
     $this->assertEquals($value, $object->getCX());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_CENTIMETER));
     $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_CENTIMETER));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_EMU));
     $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_EMU));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_INCH));
     $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_INCH));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_MILLIMETER));
     $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_MILLIMETER));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_POINT));
     $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_POINT));
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\DocumentLayout', $object->setCX($value, DocumentLayout::UNIT_PIXEL));
     $this->assertEquals($value, $object->getCX(DocumentLayout::UNIT_PIXEL));
 }