Changeset 47122 for trunk/tests/phpunit/tests/image/size.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/image/size.php
r46586 r47122 9 9 10 10 function test_constrain_dims_zero() { 11 // no constraint - should have no effect11 // No constraint - should have no effect. 12 12 $out = wp_constrain_dimensions( 640, 480, 0, 0 ); 13 13 $this->assertSame( array( 640, 480 ), $out ); … … 24 24 25 25 function test_constrain_dims_smaller() { 26 // image size is smaller than the constraint - no effect26 // Image size is smaller than the constraint - no effect. 27 27 $out = wp_constrain_dimensions( 500, 600, 1024, 768 ); 28 28 $this->assertSame( array( 500, 600 ), $out ); … … 36 36 37 37 function test_constrain_dims_equal() { 38 // image size is equal to the constraint - no effect38 // Image size is equal to the constraint - no effect. 39 39 $out = wp_constrain_dimensions( 1024, 768, 1024, 768 ); 40 40 $this->assertSame( array( 1024, 768 ), $out ); … … 48 48 49 49 function test_constrain_dims_larger() { 50 // image size is larger than the constraint - result should be constrained50 // Image size is larger than the constraint - result should be constrained. 51 51 $out = wp_constrain_dimensions( 1024, 768, 500, 600 ); 52 52 $this->assertSame( array( 500, 375 ), $out ); … … 58 58 $this->assertSame( array( 500, 375 ), $out ); 59 59 60 // also try a portrait oriented image60 // Also try a portrait oriented image. 61 61 $out = wp_constrain_dimensions( 300, 800, 500, 600 ); 62 62 $this->assertSame( array( 225, 600 ), $out ); … … 70 70 71 71 function test_constrain_dims_boundary() { 72 // one dimension is larger than the constraint, one smaller - result should be constrained72 // One dimension is larger than the constraint, one smaller - result should be constrained. 73 73 $out = wp_constrain_dimensions( 1024, 768, 500, 800 ); 74 74 $this->assertSame( array( 500, 375 ), $out ); … … 77 77 $this->assertSame( array( 933, 700 ), $out ); 78 78 79 // portrait79 // Portrait. 80 80 $out = wp_constrain_dimensions( 768, 1024, 800, 500 ); 81 81 $this->assertSame( array( 375, 500 ), $out ); … … 100 100 */ 101 101 function test_shrink_dimensions_smaller() { 102 // image size is smaller than the constraint - no effect102 // Image size is smaller than the constraint - no effect. 103 103 $out = wp_shrink_dimensions( 500, 600, 1024, 768 ); 104 104 $this->assertSame( array( 500, 600 ), $out ); … … 112 112 */ 113 113 function test_shrink_dimensions_equal() { 114 // image size is equal to the constraint - no effect114 // Image size is equal to the constraint - no effect. 115 115 $out = wp_shrink_dimensions( 500, 600, 500, 600 ); 116 116 $this->assertSame( array( 500, 600 ), $out ); … … 124 124 */ 125 125 function test_shrink_dimensions_larger() { 126 // image size is larger than the constraint - result should be constrained126 // Image size is larger than the constraint - result should be constrained. 127 127 $out = wp_shrink_dimensions( 1024, 768, 500, 600 ); 128 128 $this->assertSame( array( 500, 375 ), $out ); … … 136 136 */ 137 137 function test_shrink_dimensions_boundary() { 138 // one dimension is larger than the constraint, one smaller - result should be constrained138 // One dimension is larger than the constraint, one smaller - result should be constrained. 139 139 $out = wp_shrink_dimensions( 1024, 768, 500, 800 ); 140 140 $this->assertSame( array( 500, 375 ), $out ); … … 143 143 $this->assertSame( array( 933, 700 ), $out ); 144 144 145 // portrait145 // Portrait. 146 146 $out = wp_shrink_dimensions( 768, 1024, 800, 500 ); 147 147 $this->assertSame( array( 375, 500 ), $out ); … … 160 160 161 161 function test_constrain_size_for_editor_medium() { 162 // default max width is 500, no constraint on height162 // Default max width is 500, no constraint on height. 163 163 global $content_width; 164 164 … … 178 178 $this->assertSame( array( 64, 64 ), $out ); 179 179 180 // content_width should be ignored180 // $content_width should be ignored. 181 181 $content_width = 350; 182 182 $out = image_constrain_size_for_editor( 600, 400, 'medium' ); … … 198 198 $this->assertSame( array( 64, 64 ), $out ); 199 199 200 // content_width default is 500200 // $content_width default is 500. 201 201 $content_width = 0; 202 202
Note: See TracChangeset
for help on using the changeset viewer.