driver_haru_tests.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * ezcDocumentPdfDriverHaruTests
  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 'driver_tests.php';
  28. /**
  29. * Test suite for class.
  30. *
  31. * @package Document
  32. * @subpackage Tests
  33. */
  34. class ezcDocumentPdfDriverHaruTests extends ezcDocumentPdfDriverTests
  35. {
  36. /**
  37. * Expected font widths for calculateWordWidth tests
  38. *
  39. * @var array
  40. */
  41. protected $expectedWidths = array(
  42. 'testEstimateDefaultWordWidthWithoutPageCreation' => 22.9,
  43. 'testEstimateDefaultWordWidth' => 22.9,
  44. 'testEstimateWordWidthDifferentSize' => 31.9,
  45. 'testEstimateWordWidthDifferentSizeAndUnit' => 11.3,
  46. 'testEstimateBoldWordWidth' => 24.6,
  47. 'testEstimateMonospaceWordWidth' => 36,
  48. 'testFontStyleFallback' => 38.8,
  49. 'testUtf8FontWidth' => 29.6,
  50. 'testCustomFontWidthEstimation' => 59.1,
  51. );
  52. public static function suite()
  53. {
  54. return new PHPUnit_Framework_TestSuite( __CLASS__ );
  55. }
  56. /**
  57. * Get driver to test
  58. *
  59. * @return ezcDocumentPdfDriver
  60. */
  61. protected function getDriver()
  62. {
  63. if ( !ezcBaseFeatures::hasExtensionSupport( 'haru' ) )
  64. {
  65. $this->markTestSkipped( 'This test requires pecl/haru installed.' );
  66. }
  67. return new ezcDocumentPdfHaruDriver();
  68. }
  69. }
  70. ?>