Moving kBodyBytes to test_consts

This commit is contained in:
Ashita Prasad
2023-04-25 06:40:20 +05:30
parent 33380860f1
commit ae513d45ec
2 changed files with 562 additions and 558 deletions

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
final kThemeDataDark = ThemeData( final kThemeDataDark = ThemeData(
useMaterial3: true, useMaterial3: true,
@ -11,3 +12,561 @@ final kThemeDataLight = ThemeData(
colorSchemeSeed: Colors.blue, colorSchemeSeed: Colors.blue,
brightness: Brightness.light, brightness: Brightness.light,
); );
Uint8List kBodyBytesJpeg = Uint8List.fromList([
255,
216,
255,
225,
0,
222,
69,
120,
105,
102,
0,
0,
73,
73,
42,
0,
8,
0,
0,
0,
6,
0,
18,
1,
3,
0,
1,
0,
0,
0,
1,
0,
0,
0,
26,
1,
5,
0,
1,
0,
0,
0,
86,
0,
0,
0,
27,
1,
5,
0,
1,
0,
0,
0,
94,
0,
0,
0,
40,
1,
3,
0,
1,
0,
0,
0,
2,
0,
0,
0,
19,
2,
3,
0,
1,
0,
0,
0,
1,
0,
0,
0,
105,
135,
4,
0,
1,
0,
0,
0,
102,
0,
0,
0,
0,
0,
0,
0,
72,
0,
0,
0,
1,
0,
0,
0,
72,
0,
0,
0,
1,
0,
0,
0,
7,
0,
0,
144,
7,
0,
4,
0,
0,
0,
48,
50,
49,
48,
1,
145,
7,
0,
4,
0,
0,
0,
1,
2,
3,
0,
134,
146,
7,
0,
22,
0,
0,
0,
192,
0,
0,
0,
0,
160,
7,
0,
4,
0,
0,
0,
48,
49,
48,
48,
1,
160,
3,
0,
1,
0,
0,
0,
255,
255,
0,
0,
2,
160,
4,
0,
1,
0,
0,
0,
10,
0,
0,
0,
3,
160,
4,
0,
1,
0,
0,
0,
10,
0,
0,
0,
0,
0,
0,
0,
65,
83,
67,
73,
73,
0,
0,
0,
80,
105,
99,
115,
117,
109,
32,
73,
68,
58,
32,
55,
55,
57,
255,
219,
0,
67,
0,
8,
6,
6,
7,
6,
5,
8,
7,
7,
7,
9,
9,
8,
10,
12,
20,
13,
12,
11,
11,
12,
25,
18,
19,
15,
20,
29,
26,
31,
30,
29,
26,
28,
28,
32,
36,
46,
39,
32,
34,
44,
35,
28,
28,
40,
55,
41,
44,
48,
49,
52,
52,
52,
31,
39,
57,
61,
56,
50,
60,
46,
51,
52,
50,
255,
194,
0,
11,
8,
0,
10,
0,
10,
1,
1,
17,
0,
255,
196,
0,
23,
0,
0,
3,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
4,
5,
7,
255,
218,
0,
8,
1,
1,
0,
0,
0,
1,
184,
198,
122,
127,
255,
196,
0,
26,
16,
0,
2,
2,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
3,
0,
20,
2,
16,
17,
255,
218,
0,
8,
1,
1,
0,
1,
5,
2,
188,
174,
216,
84,
200,
157,
127,
255,
196,
0,
27,
16,
0,
2,
1,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
17,
2,
1,
16,
33,
50,
145,
255,
218,
0,
8,
1,
1,
0,
6,
63,
2,
163,
108,
222,
61,
33,
155,
127,
255,
196,
0,
27,
16,
0,
1,
4,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
17,
0,
1,
16,
49,
33,
65,
145,
255,
218,
0,
8,
1,
1,
0,
1,
63,
33,
106,
156,
1,
106,
68,
202,
251,
199,
99,
255,
218,
0,
8,
1,
1,
0,
0,
0,
16,
95,
255,
196,
0,
25,
16,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
17,
0,
33,
49,
177,
255,
218,
0,
8,
1,
1,
0,
1,
63,
16,
114,
72,
72,
88,
190,
242,
249,
130,
196,
30,
148,
26,
255,
0,
173,
170,
245,
235,
191,
255,
217
]);

View File

@ -3,6 +3,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:apidash/widgets/previewer.dart'; import 'package:apidash/widgets/previewer.dart';
import 'package:apidash/consts.dart'; import 'package:apidash/consts.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import '../test_consts.dart';
void main() { void main() {
Uint8List bytes1 = Uint8List.fromList([20, 8]); Uint8List bytes1 = Uint8List.fromList([20, 8]);
@ -69,568 +70,12 @@ void main() {
}); });
testWidgets('Testing when type/subtype is image/jpeg', (tester) async { testWidgets('Testing when type/subtype is image/jpeg', (tester) async {
Uint8List bytesJpeg = Uint8List.fromList([
255,
216,
255,
225,
0,
222,
69,
120,
105,
102,
0,
0,
73,
73,
42,
0,
8,
0,
0,
0,
6,
0,
18,
1,
3,
0,
1,
0,
0,
0,
1,
0,
0,
0,
26,
1,
5,
0,
1,
0,
0,
0,
86,
0,
0,
0,
27,
1,
5,
0,
1,
0,
0,
0,
94,
0,
0,
0,
40,
1,
3,
0,
1,
0,
0,
0,
2,
0,
0,
0,
19,
2,
3,
0,
1,
0,
0,
0,
1,
0,
0,
0,
105,
135,
4,
0,
1,
0,
0,
0,
102,
0,
0,
0,
0,
0,
0,
0,
72,
0,
0,
0,
1,
0,
0,
0,
72,
0,
0,
0,
1,
0,
0,
0,
7,
0,
0,
144,
7,
0,
4,
0,
0,
0,
48,
50,
49,
48,
1,
145,
7,
0,
4,
0,
0,
0,
1,
2,
3,
0,
134,
146,
7,
0,
22,
0,
0,
0,
192,
0,
0,
0,
0,
160,
7,
0,
4,
0,
0,
0,
48,
49,
48,
48,
1,
160,
3,
0,
1,
0,
0,
0,
255,
255,
0,
0,
2,
160,
4,
0,
1,
0,
0,
0,
10,
0,
0,
0,
3,
160,
4,
0,
1,
0,
0,
0,
10,
0,
0,
0,
0,
0,
0,
0,
65,
83,
67,
73,
73,
0,
0,
0,
80,
105,
99,
115,
117,
109,
32,
73,
68,
58,
32,
55,
55,
57,
255,
219,
0,
67,
0,
8,
6,
6,
7,
6,
5,
8,
7,
7,
7,
9,
9,
8,
10,
12,
20,
13,
12,
11,
11,
12,
25,
18,
19,
15,
20,
29,
26,
31,
30,
29,
26,
28,
28,
32,
36,
46,
39,
32,
34,
44,
35,
28,
28,
40,
55,
41,
44,
48,
49,
52,
52,
52,
31,
39,
57,
61,
56,
50,
60,
46,
51,
52,
50,
255,
194,
0,
11,
8,
0,
10,
0,
10,
1,
1,
17,
0,
255,
196,
0,
23,
0,
0,
3,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2,
4,
5,
7,
255,
218,
0,
8,
1,
1,
0,
0,
0,
1,
184,
198,
122,
127,
255,
196,
0,
26,
16,
0,
2,
2,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
3,
0,
20,
2,
16,
17,
255,
218,
0,
8,
1,
1,
0,
1,
5,
2,
188,
174,
216,
84,
200,
157,
127,
255,
196,
0,
27,
16,
0,
2,
1,
5,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
17,
2,
1,
16,
33,
50,
145,
255,
218,
0,
8,
1,
1,
0,
6,
63,
2,
163,
108,
222,
61,
33,
155,
127,
255,
196,
0,
27,
16,
0,
1,
4,
3,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
17,
0,
1,
16,
49,
33,
65,
145,
255,
218,
0,
8,
1,
1,
0,
1,
63,
33,
106,
156,
1,
106,
68,
202,
251,
199,
99,
255,
218,
0,
8,
1,
1,
0,
0,
0,
16,
95,
255,
196,
0,
25,
16,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
1,
17,
0,
33,
49,
177,
255,
218,
0,
8,
1,
1,
0,
1,
63,
16,
114,
72,
72,
88,
190,
242,
249,
130,
196,
30,
148,
26,
255,
0,
173,
170,
245,
235,
191,
255,
217
]);
await tester.pumpWidget( await tester.pumpWidget(
MaterialApp( MaterialApp(
title: 'Previewer', title: 'Previewer',
home: Scaffold( home: Scaffold(
body: Previewer(type: 'image', subtype: 'jpeg', bytes: bytesJpeg), body:
Previewer(type: 'image', subtype: 'jpeg', bytes: kBodyBytesJpeg),
), ),
), ),
); );