@@ -398,7 +398,7 @@ public function testGivenWidthSignsURLs() {
398
398
399
399
public function testGivenHeightSrcsetGeneratesPairs () {
400
400
$ srcset = $ this ->srcsetBuilder (array ("h " =>300 ));
401
- $ expectedNumberOfPairs = 31 ;
401
+ $ expectedNumberOfPairs = 5 ;
402
402
$ this ->assertEquals ($ expectedNumberOfPairs , count (explode (", " , $ srcset )));
403
403
}
404
404
@@ -411,34 +411,23 @@ public function testGivenHeightRespectsParameter() {
411
411
}
412
412
}
413
413
414
- public function testGivenHeightSrcsetPairsWithinBounds () {
414
+ public function testHeightBasedSrcsetHasDprValues () {
415
415
$ srcset = $ this ->srcsetBuilder (array ("h " =>300 ));
416
416
$ srclist = explode (", " , $ srcset );
417
417
418
- $ minParsed = explode (" " , $ srclist [0 ])[1 ];
419
- $ maxParsed = explode (" " , $ srclist [count ($ srclist )-1 ])[1 ];
420
- $ min = $ this ->parseWidth ($ minParsed );
421
- $ max = $ this ->parseWidth ($ maxParsed );
422
-
423
- $ this ->assertGreaterThanOrEqual (100 , $ min );
424
- $ this ->assertLessThanOrEqual (8192 , $ max );
418
+ foreach ($ srclist as $ i =>$ src ) {
419
+ $ dpr = explode (" " , $ src )[1 ];
420
+ $ this ->assertMatchesRegularExpression ("/x/ " , $ dpr );
421
+ }
425
422
}
426
423
427
- public function testGivenHeightSrcsetIteratesEighteenPercent () {
428
- $ incrementAllowed = .18 ;
424
+ public function testHeightIncludesDPRParam () {
429
425
$ srcset = $ this ->srcsetBuilder (array ("h " =>300 ));
430
426
$ srclist = explode (", " , $ srcset );
431
427
432
- $ widths = array_map (function ($ src ) {
433
- return $ this ->parseWidth (explode (" " , $ src )[1 ]);
434
- }, $ srclist );
435
-
436
- $ prev = $ widths [0 ];
437
- $ size = count ($ widths );
438
- for ($ i = 1 ; $ i < $ size ; $ i ++) {
439
- $ width = $ widths [$ i ];
440
- $ this ->assertLessThan ((1 + $ incrementAllowed ), ($ width / $ prev ));
441
- $ prev = $ width ;
428
+ foreach ($ srclist as $ i =>$ src ) {
429
+ $ dpr = explode (" " , $ src )[0 ];
430
+ $ this ->assertMatchesRegularExpression ("/dpr=/ " , $ dpr );
442
431
}
443
432
}
444
433
0 commit comments