Changeset 1257 in tests
- Timestamp:
- 04/03/2013 09:14:15 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/image/size.php
r1256 r1257 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 effect 108 $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 effect 117 $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 constrained 126 $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 constrained 135 $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 // portrait 142 $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 98 149 function test_constrain_size_for_editor_thumb() { 99 150 $out = image_constrain_size_for_editor(600, 400, 'thumb');
Note: See TracChangeset
for help on using the changeset viewer.