Changeset 1256 in tests
- Timestamp:
- 04/03/2013 07:34:47 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/image/size.php
r909 r1256 96 96 } 97 97 98 function test_shrink_dimensions_default() {99 $out = wp_shrink_dimensions(640, 480);100 $this->assertEquals(array(128, 96), $out);101 102 $out = wp_shrink_dimensions(480, 640);103 $this->assertEquals(array(72, 96), $out);104 }105 106 function test_shrink_dimensions_smaller() {107 // image size is smaller than the constraint - no effect108 $out = wp_shrink_dimensions(500, 600, 1024, 768);109 $this->assertEquals(array(500, 600), $out);110 111 $out = wp_shrink_dimensions(600, 500, 1024, 768);112 $this->assertEquals(array(600, 500), $out);113 }114 115 function test_shrink_dimensions_equal() {116 // image size is equal to the constraint - no effect117 $out = wp_shrink_dimensions(500, 600, 500, 600);118 $this->assertEquals(array(500, 600), $out);119 120 $out = wp_shrink_dimensions(600, 500, 600, 500);121 $this->assertEquals(array(600, 500), $out);122 }123 124 function test_shrink_dimensions_larger() {125 // image size is larger than the constraint - result should be constrained126 $out = wp_shrink_dimensions(1024, 768, 500, 600);127 $this->assertequals(array(500, 375), $out);128 129 $out = wp_shrink_dimensions(300, 800, 500, 600);130 $this->assertequals(array(225, 600), $out);131 }132 133 function test_shrink_dimensions_boundary() {134 // one dimension is larger than the constraint, one smaller - result should be constrained135 $out = wp_shrink_dimensions(1024, 768, 500, 800);136 $this->assertequals(array(500, 375), $out);137 138 $out = wp_shrink_dimensions(1024, 768, 2000, 700);139 $this->assertequals(array(933, 700), $out);140 141 // portrait142 $out = wp_shrink_dimensions(768, 1024, 800, 500);143 $this->assertequals(array(375, 500), $out);144 145 $out = wp_shrink_dimensions(768, 1024, 2000, 700);146 $this->assertequals(array(525, 700), $out);147 }148 149 98 function test_constrain_size_for_editor_thumb() { 150 99 $out = image_constrain_size_for_editor(600, 400, 'thumb');
Note: See TracChangeset
for help on using the changeset viewer.