public function testRenderParagraphWithPaddingMarginAndBorder()
 {
     // Additional formatting
     $this->styles->appendStyleDirectives(array(new ezcDocumentPcssLayoutDirective(array('para'), array('line-height' => '1', 'padding' => '10', 'margin' => '10', 'border' => '1mm solid #A00000', 'background-color' => '#eedbdb'))));
     $mock = $this->getMock('ezcTestDocumentPdfMockDriver', array('drawPolyline', 'drawPolygon', 'drawWord'));
     // Expectations
     // Expectations
     $mock->expects($this->at(0))->method('drawPolygon')->with($this->equalTo(array(array(10, 10), array(98, 10), array(98, 72), array(10, 72)), 1.0), $this->equalTo(array('red' => 0.93, 'green' => 0.86, 'blue' => 0.86, 'alpha' => 0), 0.01));
     $mock->expects($this->at(1))->method('drawPolyline')->with($this->equalTo(array(array(10.5, 10.5), array(10.5, 71.5)), 0.1), $this->equalTo(array('red' => 0.63, 'green' => 0.0, 'blue' => 0.0, 'alpha' => 0), 0.01));
     $mock->expects($this->at(2))->method('drawPolyline')->with($this->equalTo(array(array(10.5, 10.5), array(97.5, 10.5)), 0.1), $this->equalTo(array('red' => 0.63, 'green' => 0.0, 'blue' => 0.0, 'alpha' => 0), 0.01));
     $mock->expects($this->at(3))->method('drawPolyline')->with($this->equalTo(array(array(97.5, 10.5), array(97.5, 71.5)), 0.1), $this->equalTo(array('red' => 0.63, 'green' => 0.0, 'blue' => 0.0, 'alpha' => 0), 0.01));
     $mock->expects($this->at(4))->method('drawPolyline')->with($this->equalTo(array(array(97.5, 71.5), array(10.5, 71.5)), 0.1), $this->equalTo(array('red' => 0.63, 'green' => 0.0, 'blue' => 0.0, 'alpha' => 0), 0.01));
     $mock->expects($this->at(5))->method('drawWord')->with($this->equalTo(21, 1.0), $this->equalTo(29, 1.0), $this->equalTo('Paragraphs'));
     $mock->expects($this->at(6))->method('drawWord')->with($this->equalTo(65, 1.0), $this->equalTo(29, 1.0), $this->equalTo('are'));
     $mock->expects($this->at(7))->method('drawWord')->with($this->equalTo(21, 1.0), $this->equalTo(37, 1.0), $this->equalTo('separated'));
     $driver = new ezcDocumentPdfTransactionalDriverWrapper();
     $driver->setDriver($mock);
     $rendererClass = $this->renderer;
     $renderer = new $rendererClass($driver, $this->styles);
     $this->assertTrue($renderer->renderNode($this->page, new ezcDocumentPdfDefaultHyphenator(), new ezcDocumentPdfDefaultTokenizer(), $this->xpath->query('//doc:para')->item(0), new ezcDocumentPdfMainRenderer($driver, $this->styles)));
     $driver->commit();
 }
 protected function renderPdf(ezcDocumentPdfDriver $driver, $paragraph = 2)
 {
     $this->checkTestEnv($driver);
     $transactionalDriver = new ezcDocumentPdfTransactionalDriverWrapper();
     $transactionalDriver->setDriver($driver);
     $driver->createPage(108, 108);
     $renderer = new ezcDocumentPdfWrappingTextBoxRenderer($transactionalDriver, $this->styles);
     $renderer->renderNode($this->page, new ezcDocumentPdfDefaultHyphenator(), new ezcDocumentPdfDefaultTokenizer(), $this->xpath->query('//doc:para')->item($paragraph), new ezcDocumentPdfMainRenderer($transactionalDriver, $this->styles));
     $transactionalDriver->commit();
     return $driver->save();
 }