示例#1
0
 public function testText()
 {
     $object = new RichText();
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->addText());
     $this->assertCount(1, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText', $object->addText(new TextElement()));
     $this->assertCount(2, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->createText());
     $this->assertCount(3, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\TextElement', $object->createText('ALPHA'));
     $this->assertCount(4, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\BreakElement', $object->createBreak());
     $this->assertCount(5, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->createTextRun());
     $this->assertCount(6, $object->getActiveParagraph()->getRichTextElements());
     $this->assertInstanceOf('PhpOffice\\PhpPowerpoint\\Shape\\RichText\\Run', $object->createTextRun('BETA'));
     $this->assertCount(7, $object->getActiveParagraph()->getRichTextElements());
     $this->assertEquals('ALPHA' . "\r\n" . 'BETA', $object->getPlainText());
     $this->assertEquals('ALPHA' . "\r\n" . 'BETA', (string) $object);
 }