|
143 | 143 | }, `Property ${property} value on pseudo element '${pseudo_element}' '${specified}'${titleExtra ? ' ' + titleExtra : ''}`); |
144 | 144 | } |
145 | 145 |
|
146 | | -function test_random_computed_value_has_fixed(property, specified, minPercentage, maxPercentage, titleExtra) { |
| 146 | +function test_random_computed_value_has_fixed(property, specified, minPercentage, maxPercentage, expectedFixedValue = undefined, titleExtra = undefined) { |
147 | 147 | test(() => { |
148 | 148 | for (i = 0; i < iterations; ++i) { |
149 | 149 | const target = document.getElementById('target'); |
|
164 | 164 | let [fixedString, fixedValue] = fixedComponent.split(' '); |
165 | 165 |
|
166 | 166 | assert_equals(fixedString, 'fixed', specified); |
167 | | - assert_greater_than_equal(parseFloat(fixedValue), 0, specified); |
168 | | - assert_less_than(parseFloat(fixedValue), 1, specified); |
| 167 | + if (expectedFixedValue) { |
| 168 | + assert_equals(parseFloat(fixedValue), expectedFixedValue); |
| 169 | + } else { |
| 170 | + assert_greater_than_equal(parseFloat(fixedValue), 0, specified); |
| 171 | + assert_less_than(parseFloat(fixedValue), 1, specified); |
| 172 | + } |
169 | 173 | assert_equals(minComponent, minPercentage, specified); |
170 | 174 | assert_equals(maxComponent, maxPercentage, specified); |
171 | 175 | } |
|
260 | 264 | // Test unresolvable percentage values |
261 | 265 | test_random_computed_value_has_fixed('translate', 'random(10%, 100%)', '10%', '100%'); |
262 | 266 |
|
| 267 | +// Test out of range math functions for fixed value |
| 268 | +test_random_computed_value_has_fixed('translate', 'random(fixed random(1, 2), 10%, 100%)', '10%', '100%'); |
| 269 | +test_random_computed_value_has_fixed('translate', 'random(fixed random(-2, -1), 10%, 100%)', '10%', '100%', 0); |
| 270 | + |
263 | 271 | // Test random value sharing |
264 | 272 | test(() => { |
265 | 273 | const holder = document.createElement('div'); |
|
0 commit comments