Changeset 30660 for trunk/tests/phpunit/tests/image/size.php
 Timestamp:
 11/30/2014 07:53:18 PM (6 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/tests/phpunit/tests/image/size.php
r27358 r30660 14 14 // no constraint  should have no effect 15 15 $out = wp_constrain_dimensions(640, 480, 0, 0); 16 $this>assert Equals(array(640, 480), $out);16 $this>assertSame( array( 640, 480 ), $out ); 17 17 18 18 $out = wp_constrain_dimensions(640, 480); 19 $this>assert Equals(array(640, 480), $out);19 $this>assertSame( array( 640, 480 ), $out ); 20 20 21 21 $out = wp_constrain_dimensions(0, 0, 0, 0); 22 $this>assertEquals(array(0, 0), $out); 22 $this>assertSame( array( 0, 0 ), $out ); 23 24 $out = wp_constrain_dimensions(465, 700, 177, 177); 25 $this>assertSame( array( 118, 177 ), $out ); 23 26 } 24 27 … … 29 32 // image size is smaller than the constraint  no effect 30 33 $out = wp_constrain_dimensions(500, 600, 1024, 768); 31 $this>assert Equals(array(500, 600), $out);34 $this>assertSame( array( 500, 600 ), $out ); 32 35 33 36 $out = wp_constrain_dimensions(500, 600, 0, 768); 34 $this>assert Equals(array(500, 600), $out);37 $this>assertSame( array( 500, 600 ), $out ); 35 38 36 39 $out = wp_constrain_dimensions(500, 600, 1024, 0); 37 $this>assert Equals(array(500, 600), $out);40 $this>assertSame( array( 500, 600 ), $out ); 38 41 } 39 42 … … 44 47 // image size is equal to the constraint  no effect 45 48 $out = wp_constrain_dimensions(1024, 768, 1024, 768); 46 $this>assert equals(array(1024, 768), $out);49 $this>assertSame( array( 1024, 768 ), $out ); 47 50 48 51 $out = wp_constrain_dimensions(1024, 768, 0, 768); 49 $this>assert equals(array(1024, 768), $out);52 $this>assertSame( array( 1024, 768 ), $out ); 50 53 51 54 $out = wp_constrain_dimensions(1024, 768, 1024, 0); 52 $this>assert equals(array(1024, 768), $out);55 $this>assertSame( array( 1024, 768 ), $out ); 53 56 } 54 57 … … 59 62 // image size is larger than the constraint  result should be constrained 60 63 $out = wp_constrain_dimensions(1024, 768, 500, 600); 61 $this>assert equals(array(500, 375), $out);64 $this>assertSame( array( 500, 375 ), $out ); 62 65 63 66 $out = wp_constrain_dimensions(1024, 768, 0, 600); 64 $this>assert equals(array(800, 600), $out);67 $this>assertSame( array( 800, 600 ), $out ); 65 68 66 69 $out = wp_constrain_dimensions(1024, 768, 500, 0); 67 $this>assert equals(array(500, 375), $out);70 $this>assertSame( array( 500, 375 ), $out ); 68 71 69 72 // also try a portrait oriented image 70 73 $out = wp_constrain_dimensions(300, 800, 500, 600); 71 $this>assert equals(array(225, 600), $out);74 $this>assertSame( array( 225, 600 ), $out ); 72 75 73 76 $out = wp_constrain_dimensions(300, 800, 0, 600); 74 $this>assert equals(array(225, 600), $out);77 $this>assertSame( array( 225, 600 ), $out ); 75 78 76 79 $out = wp_constrain_dimensions(300, 800, 200, 0); 77 $this>assert equals(array(200, 533), $out);80 $this>assertSame( array( 200, 533 ), $out ); 78 81 } 79 82 … … 84 87 // one dimension is larger than the constraint, one smaller  result should be constrained 85 88 $out = wp_constrain_dimensions(1024, 768, 500, 800); 86 $this>assert equals(array(500, 375), $out);89 $this>assertSame( array( 500, 375 ), $out ); 87 90 88 91 $out = wp_constrain_dimensions(1024, 768, 2000, 700); 89 $this>assert equals(array(933, 700), $out);92 $this>assertSame( array( 933, 700 ), $out ); 90 93 91 94 // portrait 92 95 $out = wp_constrain_dimensions(768, 1024, 800, 500); 93 $this>assert equals(array(375, 500), $out);96 $this>assertSame( array( 375, 500 ), $out ); 94 97 95 98 $out = wp_constrain_dimensions(768, 1024, 2000, 700); 96 $this>assert equals(array(525, 700), $out);99 $this>assertSame( array( 525, 700 ), $out ); 97 100 } 98 101 … … 102 105 function test_shrink_dimensions_default() { 103 106 $out = wp_shrink_dimensions(640, 480); 104 $this>assert Equals(array(128, 96), $out);107 $this>assertSame( array( 128, 96 ), $out ); 105 108 106 109 $out = wp_shrink_dimensions(480, 640); 107 $this>assert Equals(array(72, 96), $out);110 $this>assertSame( array( 72, 96 ), $out ); 108 111 } 109 112 … … 114 117 // image size is smaller than the constraint  no effect 115 118 $out = wp_shrink_dimensions(500, 600, 1024, 768); 116 $this>assert Equals(array(500, 600), $out);119 $this>assertSame( array( 500, 600 ), $out ); 117 120 118 121 $out = wp_shrink_dimensions(600, 500, 1024, 768); 119 $this>assert Equals(array(600, 500), $out);122 $this>assertSame( array( 600, 500 ), $out ); 120 123 } 121 124 … … 126 129 // image size is equal to the constraint  no effect 127 130 $out = wp_shrink_dimensions(500, 600, 500, 600); 128 $this>assert Equals(array(500, 600), $out);131 $this>assertSame( array( 500, 600 ), $out ); 129 132 130 133 $out = wp_shrink_dimensions(600, 500, 600, 500); 131 $this>assert Equals(array(600, 500), $out);134 $this>assertSame( array( 600, 500 ), $out ); 132 135 } 133 136 … … 138 141 // image size is larger than the constraint  result should be constrained 139 142 $out = wp_shrink_dimensions(1024, 768, 500, 600); 140 $this>assert equals(array(500, 375), $out);143 $this>assertSame( array( 500, 375 ), $out ); 141 144 142 145 $out = wp_shrink_dimensions(300, 800, 500, 600); 143 $this>assert equals(array(225, 600), $out);146 $this>assertSame( array( 225, 600 ), $out ); 144 147 } 145 148 … … 150 153 // one dimension is larger than the constraint, one smaller  result should be constrained 151 154 $out = wp_shrink_dimensions(1024, 768, 500, 800); 152 $this>assert equals(array(500, 375), $out);155 $this>assertSame( array( 500, 375 ), $out ); 153 156 154 157 $out = wp_shrink_dimensions(1024, 768, 2000, 700); 155 $this>assert equals(array(933, 700), $out);158 $this>assertSame( array( 933, 700 ), $out ); 156 159 157 160 // portrait 158 161 $out = wp_shrink_dimensions(768, 1024, 800, 500); 159 $this>assert equals(array(375, 500), $out);162 $this>assertSame( array( 375, 500 ), $out ); 160 163 161 164 $out = wp_shrink_dimensions(768, 1024, 2000, 700); 162 $this>assert equals(array(525, 700), $out);165 $this>assertSame( array( 525, 700 ), $out ); 163 166 } 164 167 165 168 function test_constrain_size_for_editor_thumb() { 166 169 $out = image_constrain_size_for_editor(600, 400, 'thumb'); 167 $this>assert Equals(array(150, 100), $out);170 $this>assertSame( array( 150, 100 ), $out ); 168 171 169 172 $out = image_constrain_size_for_editor(64, 64, 'thumb'); 170 $this>assert Equals(array(64, 64), $out);173 $this>assertSame( array( 64, 64 ), $out ); 171 174 } 172 175 … … 182 185 183 186 $out = image_constrain_size_for_editor(600, 400, 'medium'); 184 $this>assert Equals(array(500, 333), $out);187 $this>assertSame( array( 500, 333 ), $out ); 185 188 186 189 $out = image_constrain_size_for_editor(400, 600, 'medium'); 187 $this>assert Equals(array(400, 600), $out);190 $this>assertSame( array( 400, 600 ), $out ); 188 191 189 192 $out = image_constrain_size_for_editor(64, 64, 'medium'); 190 $this>assert Equals(array(64, 64), $out);193 $this>assertSame( array( 64, 64 ), $out ); 191 194 192 195 // content_width should be ignored 193 196 $content_width = 350; 194 197 $out = image_constrain_size_for_editor(600, 400, 'medium'); 195 $this>assert Equals(array(500, 333), $out);198 $this>assertSame( array( 500, 333 ), $out ); 196 199 197 200 $content_width = $_content_width; … … 205 208 $content_width = 400; 206 209 $out = image_constrain_size_for_editor(600, 400, 'full'); 207 $this>assert Equals(array(600, 400), $out);210 $this>assertSame( array( 600, 400 ), $out ); 208 211 209 212 $out = image_constrain_size_for_editor(64, 64, 'full'); 210 $this>assert Equals(array(64, 64), $out);213 $this>assertSame( array( 64, 64 ), $out ); 211 214 212 215 // content_width default is 500 … … 214 217 215 218 $out = image_constrain_size_for_editor(600, 400, 'full'); 216 $this>assert Equals(array(600, 400), $out);219 $this>assertSame( array( 600, 400 ), $out ); 217 220 218 221 $out = image_constrain_size_for_editor(64, 64, 'full'); 219 $this>assert Equals(array(64, 64), $out);222 $this>assertSame( array( 64, 64 ), $out ); 220 223 221 224 $content_width = $_content_width;
Note: See TracChangeset
for help on using the changeset viewer.