|
70 | 70 | ;; Don't resize remote images. Or should we fetch it and resize it? |
71 | 71 | '((div ((class "figure")) (img ((src "//somehost.com/img/file.jpg")))))) |
72 | 72 | (when magick-available? |
73 | | - (test-equal? "Big image" |
| 73 | + (test-equal? "Image bigger than maximum size" |
74 | 74 | (responsive-images |
75 | 75 | '((div ((class "figure")) |
76 | 76 | (img ((src "/img/1300px-image.gif") (alt ""))) |
|
80 | 80 | (current-image-default-size))) |
81 | 81 | (srcset |
82 | 82 | ,(string-join (map (λ (s) |
83 | | - (format "/img/resized/1300px-image-~a.gif ~aw" s s)) |
84 | | - (current-image-sizes)) |
85 | | - ", ")) |
| 83 | + (format "/img/resized/1300px-image-~a.gif ~aw" s s)) |
| 84 | + (current-image-sizes)) |
| 85 | + ", ")) |
86 | 86 | (sizes "(max-width: 1300px) 100vw, 1300px") |
87 | 87 | (alt ""))) |
88 | 88 | (p ((class "caption")) "some text")))) |
89 | | - (test-equal? "Medium image" |
| 89 | + (test-equal? "Image smaller than biggest image but bigger than smallest size" |
90 | 90 | (responsive-images |
91 | 91 | '((div ((class "figure")) |
92 | 92 | (img ((src "/img/800px-image.gif") (alt ""))) |
93 | 93 | (p ((class "caption")) "some text")))) |
94 | 94 | `((div ((class "figure")) |
95 | 95 | (img ((src ,(format "/img/resized/800px-image-~a.gif" |
96 | 96 | (current-image-default-size))) |
97 | | - (srcset ,(string-join (map (λ (s) |
98 | | - (format "/img/resized/800px-image-~a.gif ~aw" s s)) |
99 | | - '(320 600)) |
100 | | - ", ")) |
| 97 | + (srcset |
| 98 | + ,(string-append |
| 99 | + (string-join |
| 100 | + (map (λ (s) |
| 101 | + (format "/img/resized/800px-image-~a.gif ~aw" s s)) |
| 102 | + '(320 600)) |
| 103 | + ", ") |
| 104 | + ", /img/800px-image.gif 800w")) |
101 | 105 | (sizes "(max-width: 800px) 100vw, 800px") |
102 | 106 | (alt ""))) |
103 | 107 | (p ((class "caption")) "some text")))) |
104 | | - (test-equal? "Small image" |
| 108 | + (test-equal? "Image equal to a one of the sizes specified" |
105 | 109 | (responsive-images |
106 | 110 | '((div ((class "figure")) |
107 | | - (img ((src "/img/480px-image.gif") (alt ""))) |
| 111 | + (img ((src "/img/600px-image.gif") (alt ""))) |
108 | 112 | (p ((class "caption")) "some text")))) |
109 | 113 | '((div ((class "figure")) |
110 | | - (img ((src "/img/480px-image.gif") |
111 | | - (srcset "/img/resized/480px-image-320.gif 320w") |
112 | | - (sizes "(max-width: 480px) 100vw, 480px") |
| 114 | + (img ((src "/img/600px-image.gif") |
| 115 | + (srcset "/img/resized/600px-image-320.gif 320w, /img/600px-image.gif 600w") |
| 116 | + (sizes "(max-width: 600px) 100vw, 600px") |
113 | 117 | (alt ""))) |
114 | 118 | (p ((class "caption")) "some text")))) |
115 | | - (test-equal? "Tiny image" |
| 119 | + (test-equal? "Image smaller than smallest size" |
116 | 120 | (responsive-images |
117 | 121 | '((div ((class "figure")) |
118 | 122 | (img ((src "/img/1x1.gif") (alt ""))) ; Tiny image |
119 | 123 | (p ((class "caption")) "some text")))) |
120 | 124 | '((div ((class "figure")) |
121 | 125 | (img ((src "/img/1x1.gif") |
122 | | - (srcset "") |
| 126 | + (srcset "/img/1x1.gif 2w") |
123 | 127 | (sizes "(max-width: 2px) 100vw, 2px") |
124 | 128 | (alt ""))) |
125 | 129 | (p ((class "caption")) "some text")))) |
|
0 commit comments