@@ -121,19 +121,24 @@ void main() {
121121
122122 await prepare (tester);
123123
124+ // Use the smallest format that's big enough.
124125 doCheck (tester, 200 , 200 , false , animated: false ,
125126 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/500x850.jpg' );
126- doCheck (tester, 250 , 425 , true , animated: false ,
127- 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/500x850.jpg' );
128127 doCheck (tester, 250 , 425 , false , animated: false ,
129128 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/500x850.jpg' );
130- // Different output from previous because it's is in physical pixels.
131- doCheck (tester, 300 , 250 , true , animated: false ,
132- 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/840x560.webp' );
129+ // The format sizes are in physical pixels.
130+ // This test set devicePixelRatio to 2, so 500 is too small for 300px.
133131 doCheck (tester, 300 , 250 , false , animated: false ,
134132 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/840x560.webp' );
133+ // When no format is big enough, use the largest format.
135134 doCheck (tester, 750 , 1000 , false , animated: false ,
136135 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/1000x2000.png' );
136+
137+ // Given the image lacks an animated version, animationMode is ignored.
138+ doCheck (tester, 250 , 425 , true , animated: false ,
139+ 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/500x850.jpg' );
140+ doCheck (tester, 300 , 250 , true , animated: false ,
141+ 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/840x560.webp' );
137142 });
138143
139144 testWidgets ('animated version exists' , (tester) async {
@@ -142,10 +147,14 @@ void main() {
142147
143148 await prepare (tester);
144149
145- doCheck (tester, 200 , 200 , false , animated: true ,
146- 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/500x850.jpg' );
150+ // Use the smallest format that's big enough, but animated.
147151 doCheck (tester, 250 , 425 , true , animated: true ,
148152 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/500x850-anim.jpg' );
153+
154+ // When animationMode says not to animate, though,
155+ // the image's animated version is ignored.
156+ doCheck (tester, 200 , 200 , false , animated: true ,
157+ 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/500x850.jpg' );
149158 doCheck (tester, 250 , 425 , false , animated: true ,
150159 'https://chat.example/user_uploads/thumbnail/1/2/a/pic.jpg/500x850.jpg' );
151160 doCheck (tester, 750 , 1000 , false , animated: true ,
0 commit comments