|
3 | 3 | // found in the LICENSE file.
|
4 | 4 |
|
5 | 5 | import 'dart:async';
|
6 |
| -import 'dart:convert'; |
7 | 6 | import 'dart:io';
|
8 | 7 |
|
9 | 8 | import 'package:mockito/mockito.dart';
|
@@ -69,25 +68,15 @@ MockHttpClient createMockImageHttpClient(SecurityContext? _) {
|
69 | 68 | return client;
|
70 | 69 | }
|
71 | 70 |
|
72 |
| -// This string represents the hexidecial bytes of a transparent image. A |
73 |
| -// string is used to make the visual representation of the data compact. A |
74 |
| -// List<int> of the same data requires over 60 lines in a source file with |
75 |
| -// each element in the array on a single line. |
76 |
| -const String _imageBytesAsString = ''' |
| 71 | +// A list of integers that can be consumed as image data in a stream. |
| 72 | +final List<int> _transparentImage = <int>[ |
| 73 | + // Image bytes. |
77 | 74 | 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49,
|
78 | 75 | 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x08, 0x06,
|
79 | 76 | 0x00, 0x00, 0x00, 0x1F, 0x15, 0xC4, 0x89, 0x00, 0x00, 0x00, 0x0A, 0x49, 0x44,
|
80 | 77 | 0x41, 0x54, 0x78, 0x9C, 0x63, 0x00, 0x01, 0x00, 0x00, 0x05, 0x00, 0x01, 0x0D,
|
81 | 78 | 0x0A, 0x2D, 0xB4, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE,
|
82 |
| - '''; |
83 |
| - |
84 |
| -// Convert the string representing the hexidecimal bytes in the image into |
85 |
| -// a list of integers that can be consumed as image data in a stream. |
86 |
| -final List<int> _transparentImage = const LineSplitter() |
87 |
| - .convert(_imageBytesAsString.replaceAllMapped( |
88 |
| - RegExp(r' *0x([A-F0-9]{2}),? *\n? *'), (Match m) => '${m[1]}\n')) |
89 |
| - .map<int>((String b) => int.parse(b, radix: 16)) |
90 |
| - .toList(); |
| 79 | +]; |
91 | 80 |
|
92 | 81 | List<int> getTestImageData() {
|
93 | 82 | return _transparentImage;
|
|
0 commit comments