1
- import 'dart:async' ;
2
1
import 'dart:io' ;
3
2
4
3
import 'package:checks/checks.dart' ;
@@ -13,6 +12,7 @@ import 'package:zulip/widgets/store.dart';
13
12
14
13
import '../example_data.dart' as eg;
15
14
import '../model/binding.dart' ;
15
+ import '../test_images.dart' ;
16
16
import 'dialog_checks.dart' ;
17
17
18
18
void main () {
@@ -126,7 +126,7 @@ void main() {
126
126
addTearDown (TestZulipBinding .instance.reset);
127
127
await globalStore.add (eg.selfAccount, eg.initialSnapshot ());
128
128
129
- final httpClient = _FakeHttpClient ();
129
+ final httpClient = FakeImageHttpClient ();
130
130
debugNetworkImageHttpClientProvider = () => httpClient;
131
131
httpClient.request.response
132
132
..statusCode = HttpStatus .ok
@@ -162,67 +162,3 @@ void main() {
162
162
});
163
163
});
164
164
}
165
-
166
- class _FakeHttpClient extends Fake implements HttpClient {
167
- final _FakeHttpClientRequest request = _FakeHttpClientRequest ();
168
-
169
- @override
170
- Future <HttpClientRequest > getUrl (Uri url) async => request;
171
- }
172
-
173
- class _FakeHttpClientRequest extends Fake implements HttpClientRequest {
174
- final _FakeHttpClientResponse response = _FakeHttpClientResponse ();
175
-
176
- @override
177
- final _FakeHttpHeaders headers = _FakeHttpHeaders ();
178
-
179
- @override
180
- Future <HttpClientResponse > close () async => response;
181
- }
182
-
183
- class _FakeHttpHeaders extends Fake implements HttpHeaders {
184
- final Map <String , List <String >> values = {};
185
-
186
- @override
187
- void add (String name, Object value, {bool preserveHeaderCase = false }) {
188
- (values[name] ?? = []).add (value.toString ());
189
- }
190
- }
191
-
192
- class _FakeHttpClientResponse extends Fake implements HttpClientResponse {
193
- @override
194
- int statusCode = HttpStatus .ok;
195
-
196
- late List <int > content;
197
-
198
- @override
199
- int get contentLength => content.length;
200
-
201
- @override
202
- HttpClientResponseCompressionState get compressionState => HttpClientResponseCompressionState .notCompressed;
203
-
204
- @override
205
- StreamSubscription <List <int >> listen (void Function (List <int > event)? onData, {Function ? onError, void Function ()? onDone, bool ? cancelOnError}) {
206
- return Stream .value (content).listen (
207
- onData, onDone: onDone, onError: onError, cancelOnError: cancelOnError);
208
- }
209
- }
210
-
211
- /// A 100x100 PNG image of solid Zulip blue, [kZulipBrandColor] .
212
- // Made from the following SVG:
213
- // <svg xmlns="http://www.w3.org/2000/svg" width="1" height="1" viewBox="0 0 1 1">
214
- // <rect style="fill:#6492fe;fill-opacity:1" width="1" height="1" x="0" y="0" />
215
- // </svg>
216
- // with `inkscape tmp.svg -w 100 --export-png=tmp1.png`,
217
- // `zopflipng tmp1.png tmp.png`,
218
- // and `xxd -i tmp.png`.
219
- const List <int > kSolidBlueAvatar = [
220
- 0x89 , 0x50 , 0x4e , 0x47 , 0x0d , 0x0a , 0x1a , 0x0a , 0x00 , 0x00 , 0x00 , 0x0d ,
221
- 0x49 , 0x48 , 0x44 , 0x52 , 0x00 , 0x00 , 0x00 , 0x64 , 0x00 , 0x00 , 0x00 , 0x64 ,
222
- 0x01 , 0x03 , 0x00 , 0x00 , 0x00 , 0x4a , 0x2c , 0x07 , 0x17 , 0x00 , 0x00 , 0x00 ,
223
- 0x03 , 0x50 , 0x4c , 0x54 , 0x45 , 0x64 , 0x92 , 0xfe , 0xf1 , 0xd6 , 0x69 , 0xa5 ,
224
- 0x00 , 0x00 , 0x00 , 0x13 , 0x49 , 0x44 , 0x41 , 0x54 , 0x78 , 0x01 , 0x63 , 0xa0 ,
225
- 0x2b , 0x18 , 0x05 , 0xa3 , 0x60 , 0x14 , 0x8c , 0x82 , 0x51 , 0x00 , 0x00 , 0x05 ,
226
- 0x78 , 0x00 , 0x01 , 0x1e , 0xcd , 0x28 , 0xcd , 0x00 , 0x00 , 0x00 , 0x00 , 0x49 ,
227
- 0x45 , 0x4e , 0x44 , 0xae , 0x42 , 0x60 , 0x82 ,
228
- ];
0 commit comments