Changeset 48937 for trunk/tests/phpunit/tests/image/dimensions.php
- Timestamp:
- 09/02/2020 12:35:36 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/dimensions.php
r47122 r48937 11 11 $out = image_resize_dimensions( 640, 480, 400, 400, false ); 12 12 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 13 $this->assert Equals( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );13 $this->assertSame( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out ); 14 14 15 15 // Portrait: resize 480x640 to fit 400x400: 300x400. 16 16 $out = image_resize_dimensions( 480, 640, 400, 400, false ); 17 17 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 18 $this->assert Equals( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );18 $this->assertSame( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out ); 19 19 } 20 20 … … 23 23 $out = image_resize_dimensions( 640, 480, 400, 0, false ); 24 24 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 25 $this->assert Equals( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );25 $this->assertSame( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out ); 26 26 27 27 // Portrait: resize 480x640 to fit 400w: 400x533. 28 28 $out = image_resize_dimensions( 480, 640, 400, 0, false ); 29 29 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 30 $this->assert Equals( array( 0, 0, 0, 0, 400, 533, 480, 640 ), $out );30 $this->assertSame( array( 0, 0, 0, 0, 400, 533, 480, 640 ), $out ); 31 31 } 32 32 … … 35 35 $out = image_resize_dimensions( 640, 480, 0, 400, false ); 36 36 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 37 $this->assert Equals( array( 0, 0, 0, 0, 533, 400, 640, 480 ), $out );37 $this->assertSame( array( 0, 0, 0, 0, 533, 400, 640, 480 ), $out ); 38 38 39 39 // Portrait: resize 480x640 to fit 400h: 300x400. 40 40 $out = image_resize_dimensions( 480, 640, 0, 400, false ); 41 41 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 42 $this->assert Equals( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );42 $this->assertSame( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out ); 43 43 } 44 44 … … 47 47 $out = image_resize_dimensions( 640, 480, 800, 800, false ); 48 48 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 49 $this->assert Equals( false,$out );49 $this->assertFalse( $out ); 50 50 51 51 // Portrait: resize 480x640 to fit 800x800. 52 52 $out = image_resize_dimensions( 480, 640, 800, 800, false ); 53 53 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 54 $this->assert Equals( false,$out );54 $this->assertFalse( $out ); 55 55 } 56 56 … … 59 59 $out = image_resize_dimensions( 640, 480, 800, 0, false ); 60 60 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 61 $this->assert Equals( false,$out );61 $this->assertFalse( $out ); 62 62 63 63 // Portrait: resize 480x640 to fit 800w. 64 64 $out = image_resize_dimensions( 480, 640, 800, 0, false ); 65 65 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 66 $this->assert Equals( false,$out );66 $this->assertFalse( $out ); 67 67 } 68 68 … … 71 71 $out = image_resize_dimensions( 640, 480, 0, 800, false ); 72 72 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 73 $this->assert Equals( false,$out );73 $this->assertFalse( $out ); 74 74 75 75 // Portrait: resize 480x640 to fit 800h. 76 76 $out = image_resize_dimensions( 480, 640, 0, 800, false ); 77 77 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 78 $this->assert Equals( false,$out );78 $this->assertFalse( $out ); 79 79 } 80 80 … … 85 85 $out = image_resize_dimensions( 640, 480, 400, 400, true ); 86 86 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 87 $this->assert Equals( array( 0, 0, 80, 0, 400, 400, 480, 480 ), $out );87 $this->assertSame( array( 0, 0, 80, 0, 400, 400, 480, 480 ), $out ); 88 88 89 89 // Portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80). 90 90 $out = image_resize_dimensions( 480, 640, 400, 400, true ); 91 91 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 92 $this->assert Equals( array( 0, 0, 0, 80, 400, 400, 480, 480 ), $out );92 $this->assertSame( array( 0, 0, 0, 80, 400, 400, 480, 480 ), $out ); 93 93 } 94 94 … … 97 97 $out = image_resize_dimensions( 640, 480, 400, 0, true ); 98 98 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 99 $this->assert Equals( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out );99 $this->assertSame( array( 0, 0, 0, 0, 400, 300, 640, 480 ), $out ); 100 100 101 101 // Portrait: resize 480x640 to fit 400w: 400x533. 102 102 $out = image_resize_dimensions( 480, 640, 400, 0, true ); 103 103 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 104 $this->assert Equals( array( 0, 0, 0, 0, 400, 533, 480, 640 ), $out );104 $this->assertSame( array( 0, 0, 0, 0, 400, 533, 480, 640 ), $out ); 105 105 } 106 106 … … 109 109 $out = image_resize_dimensions( 640, 480, 0, 400, true ); 110 110 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 111 $this->assert Equals( array( 0, 0, 0, 0, 533, 400, 640, 480 ), $out );111 $this->assertSame( array( 0, 0, 0, 0, 533, 400, 640, 480 ), $out ); 112 112 113 113 // Portrait: resize 480x640 to fit 400h: 300x400. 114 114 $out = image_resize_dimensions( 480, 640, 0, 400, true ); 115 115 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 116 $this->assert Equals( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out );116 $this->assertSame( array( 0, 0, 0, 0, 300, 400, 480, 640 ), $out ); 117 117 } 118 118 … … 121 121 $out = image_resize_dimensions( 640, 480, 400, 500, true ); 122 122 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 123 $this->assert Equals( array( 0, 0, 120, 0, 400, 480, 400, 480 ), $out );123 $this->assertSame( array( 0, 0, 120, 0, 400, 480, 400, 480 ), $out ); 124 124 125 125 // Portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop at (0. 80). 126 126 $out = image_resize_dimensions( 480, 640, 400, 500, true ); 127 127 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 128 $this->assert Equals( array( 0, 0, 0, 20, 400, 500, 480, 600 ), $out );128 $this->assertSame( array( 0, 0, 0, 20, 400, 500, 480, 600 ), $out ); 129 129 } 130 130 … … 144 144 $out = image_resize_dimensions( 640, 480, 640, 480, true ); 145 145 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 146 $this->assert Equals( array( 0, 0, 0, 0, 640, 480, 640, 480 ), $out );146 $this->assertSame( array( 0, 0, 0, 0, 640, 480, 640, 480 ), $out ); 147 147 148 148 // Resize 640x480 to fit 640x480 (no change). 149 149 $out = image_resize_dimensions( 640, 480, 640, 480, false ); 150 150 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 151 $this->assert Equals( array( 0, 0, 0, 0, 640, 480, 640, 480 ), $out );151 $this->assertSame( array( 0, 0, 0, 0, 640, 480, 640, 480 ), $out ); 152 152 153 153 remove_filter( 'wp_image_resize_identical_dimensions', '__return_true' ); … … 162 162 $out = image_resize_dimensions( 640, 480, 400, 500, array( 'left', 'top' ) ); 163 163 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 164 $this->assert Equals( array( 0, 0, 0, 0, 400, 480, 400, 480 ), $out );164 $this->assertSame( array( 0, 0, 0, 0, 400, 480, 400, 480 ), $out ); 165 165 166 166 // Portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop. … … 168 168 $out = image_resize_dimensions( 480, 640, 400, 500, array( 'left', 'top' ) ); 169 169 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 170 $this->assert Equals( array( 0, 0, 0, 0, 400, 500, 480, 600 ), $out );170 $this->assertSame( array( 0, 0, 0, 0, 400, 500, 480, 600 ), $out ); 171 171 172 172 // Landscape: crop 640x480 to fit 400x500: 400x400 taken from a 480x480 crop. … … 174 174 $out = image_resize_dimensions( 640, 480, 400, 500, array( 'right', 'bottom' ) ); 175 175 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 176 $this->assert Equals( array( 0, 0, 240, 0, 400, 480, 400, 480 ), $out );176 $this->assertSame( array( 0, 0, 240, 0, 400, 480, 400, 480 ), $out ); 177 177 178 178 // Portrait: resize 480x640 to fit 400x400: 400x400 taken from a 480x480 crop. … … 180 180 $out = image_resize_dimensions( 480, 640, 400, 500, array( 'right', 'bottom' ) ); 181 181 // dst_x, dst_y, src_x, src_y, dst_w, dst_h, src_w, src_h. 182 $this->assert Equals( array( 0, 0, 0, 40, 400, 500, 480, 600 ), $out );182 $this->assertSame( array( 0, 0, 0, 40, 400, 500, 480, 600 ), $out ); 183 183 } 184 184
Note: See TracChangeset
for help on using the changeset viewer.