renderer_blockquote_tests.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * ezcDocumentPdfDriverTcpdfTests
  4. *
  5. * Licensed to the Apache Software Foundation (ASF) under one
  6. * or more contributor license agreements. See the NOTICE file
  7. * distributed with this work for additional information
  8. * regarding copyright ownership. The ASF licenses this file
  9. * to you under the Apache License, Version 2.0 (the
  10. * "License"); you may not use this file except in compliance
  11. * with the License. You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing,
  16. * software distributed under the License is distributed on an
  17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  18. * KIND, either express or implied. See the License for the
  19. * specific language governing permissions and limitations
  20. * under the License.
  21. *
  22. * @package Document
  23. * @version //autogen//
  24. * @subpackage Tests
  25. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  26. */
  27. require_once 'renderer_text_box_base_tests.php';
  28. /**
  29. * Test suite for class.
  30. *
  31. * @package Document
  32. * @subpackage Tests
  33. */
  34. class ezcDocumentPdfBlockquoteRendererTests extends ezcDocumentPdfTestCase
  35. {
  36. public static function suite()
  37. {
  38. return new PHPUnit_Framework_TestSuite( __CLASS__ );
  39. }
  40. public function setUp()
  41. {
  42. parent::setUp();
  43. $this->styles = new ezcDocumentPcssStyleInferencer();
  44. $this->styles->appendStyleDirectives( array(
  45. new ezcDocumentPcssLayoutDirective(
  46. array( 'page' ),
  47. array(
  48. 'page-size' => 'TEST',
  49. 'margin' => '0',
  50. 'padding' => '10',
  51. )
  52. ),
  53. new ezcDocumentPcssLayoutDirective(
  54. array( 'blockquote' ),
  55. array(
  56. 'font-size' => '6mm',
  57. )
  58. ),
  59. ) );
  60. }
  61. public function testRenderBlockquote()
  62. {
  63. // Additional formatting
  64. $mock = $this->getMock( 'ezcTestDocumentPdfMockDriver', array(
  65. 'createPage',
  66. 'drawWord',
  67. ) );
  68. // Expectations
  69. $mock->expects( $this->at( 0 ) )->method( 'createPage' )->with(
  70. $this->equalTo( 100, 1. ), $this->equalTo( 100, 1. )
  71. );
  72. $mock->expects( $this->at( 1 ) )->method( 'drawWord' )->with(
  73. $this->equalTo( 20, 1. ), $this->equalTo( 21, 1. ), $this->equalTo( "Some" )
  74. );
  75. $mock->expects( $this->at( 2 ) )->method( 'drawWord' )->with(
  76. $this->equalTo( 35, 1. ), $this->equalTo( 21, 1. ), $this->equalTo( "random" )
  77. );
  78. $mock->expects( $this->at( 4 ) )->method( 'drawWord' )->with(
  79. $this->equalTo( 20, 1. ), $this->equalTo( 29.4, 1. ), $this->equalTo( "which" )
  80. );
  81. $mock->expects( $this->at( 13 ) )->method( 'drawWord' )->with(
  82. $this->equalTo( 25, 1. ), $this->equalTo( 46.8, 1. ), $this->equalTo( "Name" )
  83. );
  84. $docbook = new ezcDocumentDocbook();
  85. $docbook->loadFile( dirname( __FILE__ ) . '/../files/pdf/blockquote.xml' );
  86. $renderer = new ezcDocumentPdfMainRenderer( $mock, $this->styles );
  87. $pdf = $renderer->render(
  88. $docbook,
  89. new ezcDocumentPdfDefaultHyphenator()
  90. );
  91. }
  92. }
  93. ?>