3 require_once( 'PHPUnit.php' );
4 require_once( '../includes/Defines.php' );
5 #require_once( '../includes/Profiling.php' );
6 require_once( '../includes/GlobalFunctions.php' );
7 require_once( '../includes/Image.php' );
8 require_once( '../includes/ImageFunctions.php' );
10 class ImageTest
extends PHPUnit_TestCase
{
11 function ImageTest( $name ) {
12 $this->PHPUnit_TestCase( $name );
21 function testFitBoxWidth() {
51 foreach( $vals as $row ) {
53 foreach( $tests as $max => $expected ) {
54 $y = round( $expected * $height / $width );
55 $result = wfFitBoxWidth( $width, $height, $max );
56 $y2 = round( $result * $height / $width );
57 $this->assertEquals( $expected,
59 "($width, $height, $max) wanted: {$expected}x$y, got: {$result}x$y2" );
64 /* TODO: many more! */