PhpOffice\PhpPresentation\Tests\Writer\ODPresentation\ContentTest::testRichTextAutoShrink PHP Method

testRichTextAutoShrink() public method

    public function testRichTextAutoShrink()
    {
        $phpPresentation = new PhpPresentation();
        $oSlide = $phpPresentation->getActiveSlide();
        $oRichText1 = $oSlide->createRichTextShape();
        $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
        $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties';
        $this->assertFalse($pres->attributeElementExists($element, 'draw:auto-grow-height', 'content.xml'));
        $this->assertFalse($pres->attributeElementExists($element, 'draw:auto-grow-width', 'content.xml'));
        $oRichText1->setAutoShrinkHorizontal(false);
        $oRichText1->setAutoShrinkVertical(true);
        $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
        $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties';
        $this->assertTrue($pres->attributeElementExists($element, 'draw:auto-grow-height', 'content.xml'));
        $this->assertTrue($pres->attributeElementExists($element, 'draw:auto-grow-width', 'content.xml'));
        $this->assertEquals('true', $pres->getElementAttribute($element, 'draw:auto-grow-height', 'content.xml'));
        $this->assertEquals('false', $pres->getElementAttribute($element, 'draw:auto-grow-width', 'content.xml'));
        $oRichText1->setAutoShrinkHorizontal(true);
        $oRichText1->setAutoShrinkVertical(false);
        $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
        $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'gr1\']/style:graphic-properties';
        $this->assertTrue($pres->attributeElementExists($element, 'draw:auto-grow-height', 'content.xml'));
        $this->assertTrue($pres->attributeElementExists($element, 'draw:auto-grow-width', 'content.xml'));
        $this->assertEquals('false', $pres->getElementAttribute($element, 'draw:auto-grow-height', 'content.xml'));
        $this->assertEquals('true', $pres->getElementAttribute($element, 'draw:auto-grow-width', 'content.xml'));
    }