~repos /only-bible-app
GIT_CONFIG_PARAMETERS="'http.version=HTTP/1.1'" git clone
https://git.pyrossh.dev/only-bible-app.git
Discussions:
https://groups.google.com/g/rust-embed-devs
The only bible app you will ever need. No ads. No in-app purchases. No distractions.
1f94d199
—
pyrossh 1 month ago
fix golden tests
- android/fastlane/metadata/android/en-GB/images/phoneScreenshots/bible_select.png +0 -0
- android/fastlane/metadata/android/en-GB/images/phoneScreenshots/book_select.png +0 -0
- android/fastlane/metadata/android/en-GB/images/phoneScreenshots/chapter_select.png +0 -0
- android/fastlane/metadata/android/en-GB/images/phoneScreenshots/hindi_home.png +0 -0
- android/fastlane/metadata/android/en-GB/images/phoneScreenshots/home_dark.png +0 -0
- android/fastlane/metadata/android/en-GB/images/phoneScreenshots/home_light.png +0 -0
- android/fastlane/metadata/android/en-GB/images/phoneScreenshots/settings.png +0 -0
- android/fastlane/metadata/android/en-GB/images/phoneScreenshots/verse_select.png +0 -0
- ios/fastlane/screenshots/en-US/ipadScreenshots/bible_select.png +0 -0
- ios/fastlane/screenshots/en-US/ipadScreenshots/book_select.png +0 -0
- ios/fastlane/screenshots/en-US/ipadScreenshots/chapter_select.png +0 -0
- ios/fastlane/screenshots/en-US/ipadScreenshots/hindi_home.png +0 -0
- ios/fastlane/screenshots/en-US/ipadScreenshots/home_dark.png +0 -0
- ios/fastlane/screenshots/en-US/ipadScreenshots/home_light.png +0 -0
- ios/fastlane/screenshots/en-US/ipadScreenshots/settings.png +0 -0
- ios/fastlane/screenshots/en-US/ipadScreenshots/verse_select.png +0 -0
- ios/fastlane/screenshots/en-US/iphoneScreenshots/bible_select.png +0 -0
- ios/fastlane/screenshots/en-US/iphoneScreenshots/book_select.png +0 -0
- ios/fastlane/screenshots/en-US/iphoneScreenshots/chapter_select.png +0 -0
- ios/fastlane/screenshots/en-US/iphoneScreenshots/hindi_home.png +0 -0
- ios/fastlane/screenshots/en-US/iphoneScreenshots/home_dark.png +0 -0
- ios/fastlane/screenshots/en-US/iphoneScreenshots/home_light.png +0 -0
- ios/fastlane/screenshots/en-US/iphoneScreenshots/settings.png +0 -0
- ios/fastlane/screenshots/en-US/iphoneScreenshots/verse_select.png +0 -0
- test/Roboto-Regular.ttf +0 -0
- test/fonts/NotoSansDevanagari/NotoSansDevanagari-Regular.ttf +0 -0
- test/fonts/Roboto/Roboto-Bold.ttf +0 -0
- test/fonts/Roboto/Roboto-Medium.ttf +0 -0
- test/fonts/Roboto/Roboto-Regular.ttf +0 -0
- test/screenshot_test.dart +59 -7
android/fastlane/metadata/android/en-GB/images/phoneScreenshots/bible_select.png
CHANGED
|
Binary file
|
android/fastlane/metadata/android/en-GB/images/phoneScreenshots/book_select.png
CHANGED
|
Binary file
|
android/fastlane/metadata/android/en-GB/images/phoneScreenshots/chapter_select.png
CHANGED
|
Binary file
|
android/fastlane/metadata/android/en-GB/images/phoneScreenshots/hindi_home.png
CHANGED
|
Binary file
|
android/fastlane/metadata/android/en-GB/images/phoneScreenshots/home_dark.png
CHANGED
|
Binary file
|
android/fastlane/metadata/android/en-GB/images/phoneScreenshots/home_light.png
CHANGED
|
Binary file
|
android/fastlane/metadata/android/en-GB/images/phoneScreenshots/settings.png
CHANGED
|
Binary file
|
android/fastlane/metadata/android/en-GB/images/phoneScreenshots/verse_select.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/ipadScreenshots/bible_select.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/ipadScreenshots/book_select.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/ipadScreenshots/chapter_select.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/ipadScreenshots/hindi_home.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/ipadScreenshots/home_dark.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/ipadScreenshots/home_light.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/ipadScreenshots/settings.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/ipadScreenshots/verse_select.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/iphoneScreenshots/bible_select.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/iphoneScreenshots/book_select.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/iphoneScreenshots/chapter_select.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/iphoneScreenshots/hindi_home.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/iphoneScreenshots/home_dark.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/iphoneScreenshots/home_light.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/iphoneScreenshots/settings.png
CHANGED
|
Binary file
|
ios/fastlane/screenshots/en-US/iphoneScreenshots/verse_select.png
CHANGED
|
Binary file
|
test/Roboto-Regular.ttf
DELETED
|
Binary file
|
test/fonts/NotoSansDevanagari/NotoSansDevanagari-Regular.ttf
ADDED
|
Binary file
|
test/fonts/Roboto/Roboto-Bold.ttf
ADDED
|
Binary file
|
test/fonts/Roboto/Roboto-Medium.ttf
ADDED
|
Binary file
|
test/fonts/Roboto/Roboto-Regular.ttf
ADDED
|
Binary file
|
test/screenshot_test.dart
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import "dart:io" as io;
|
|
2
|
+
|
|
1
3
|
import "package:async_redux/async_redux.dart";
|
|
2
4
|
import "package:flutter/material.dart";
|
|
5
|
+
import "package:flutter/services.dart";
|
|
3
6
|
import "package:flutter_test/flutter_test.dart";
|
|
4
7
|
import "package:go_router/go_router.dart";
|
|
5
8
|
import "package:golden_screenshot/golden_screenshot.dart";
|
|
@@ -9,6 +12,7 @@ import "package:only_bible_app/store/app_navigator.dart";
|
|
|
9
12
|
import "package:only_bible_app/store/app_state.dart";
|
|
10
13
|
import "package:only_bible_app/theme.dart";
|
|
11
14
|
import "package:only_bible_app/utils.dart";
|
|
15
|
+
import "package:path/path.dart" as path;
|
|
12
16
|
|
|
13
17
|
Widget buildScreenshotApp({
|
|
14
18
|
required ScreenshotDevice device,
|
|
@@ -29,8 +33,18 @@ Widget buildScreenshotApp({
|
|
|
29
33
|
router: router,
|
|
30
34
|
child: ScreenshotApp(
|
|
31
35
|
device: device,
|
|
32
|
-
theme: lightTheme
|
|
36
|
+
theme: lightTheme.copyWith(
|
|
37
|
+
textTheme: lightTheme.textTheme.apply(
|
|
38
|
+
fontFamily: "Roboto",
|
|
39
|
+
fontFamilyFallback: const ["NotoSansDevanagari"], // This is for the golden tests
|
|
40
|
+
),
|
|
41
|
+
),
|
|
33
|
-
darkTheme: darkTheme
|
|
42
|
+
darkTheme: darkTheme.copyWith(
|
|
43
|
+
textTheme: darkTheme.textTheme.apply(
|
|
44
|
+
fontFamily: "Roboto",
|
|
45
|
+
fontFamilyFallback: const ["NotoSansDevanagari"], // This is for the golden tests
|
|
46
|
+
),
|
|
47
|
+
),
|
|
34
48
|
themeMode: themeMode,
|
|
35
49
|
home: home,
|
|
36
50
|
),
|
|
@@ -38,11 +52,49 @@ Widget buildScreenshotApp({
|
|
|
38
52
|
);
|
|
39
53
|
}
|
|
40
54
|
|
|
55
|
+
Future<ByteData> _loadMaterialIcons() async {
|
|
56
|
+
final flutterRoot = io.Platform.environment['FLUTTER_ROOT']!;
|
|
57
|
+
final iconFont = io.File('$flutterRoot/bin/cache/artifacts/material_fonts/MaterialIcons-Regular.otf');
|
|
58
|
+
return iconFont.readAsBytesSync().buffer.asByteData();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
Map<String, List<Future<ByteData>>> _loadFontsFromDir() {
|
|
62
|
+
final fontFamilyToData = <String, List<Future<ByteData>>>{};
|
|
63
|
+
final fontsDirectory = path.join(path.dirname(io.Platform.script.path), 'test/fonts');
|
|
64
|
+
for (final familyDir in io.Directory(fontsDirectory).listSync()) {
|
|
65
|
+
if (familyDir is io.Directory) {
|
|
66
|
+
final fontFamily = path.basename(familyDir.path);
|
|
67
|
+
for (final file in familyDir.listSync()) {
|
|
68
|
+
if (file is io.File) {
|
|
69
|
+
(fontFamilyToData[fontFamily] ??= []).add(file.readAsBytes().then((bytes) => ByteData.view(bytes.buffer)));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return fontFamilyToData;
|
|
75
|
+
}
|
|
76
|
+
|
|
41
77
|
void main() {
|
|
42
78
|
late Bible bible;
|
|
43
79
|
late Bible hindiBible;
|
|
44
80
|
|
|
45
81
|
setUpAll(() async {
|
|
82
|
+
TestWidgetsFlutterBinding.ensureInitialized();
|
|
83
|
+
|
|
84
|
+
// Load fonts from test/fonts/ directory
|
|
85
|
+
final fontFamilies = _loadFontsFromDir();
|
|
86
|
+
for (final entry in fontFamilies.entries) {
|
|
87
|
+
final loader = FontLoader(entry.key);
|
|
88
|
+
for (final fontData in entry.value) {
|
|
89
|
+
loader.addFont(fontData);
|
|
90
|
+
}
|
|
91
|
+
await loader.load();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Load MaterialIcons font
|
|
95
|
+
final materialLoader = FontLoader('MaterialIcons')..addFont(_loadMaterialIcons());
|
|
96
|
+
await materialLoader.load();
|
|
97
|
+
|
|
46
98
|
bible = await loadBible("en_kjv");
|
|
47
99
|
hindiBible = await loadBible("hi");
|
|
48
100
|
});
|
|
@@ -97,10 +149,10 @@ void main() {
|
|
|
97
149
|
store: store,
|
|
98
150
|
home: const Home(bookIndex: 0, chapterIndex: 0),
|
|
99
151
|
));
|
|
152
|
+
await tester.loadAssets();
|
|
100
153
|
await tester.pumpAndSettle();
|
|
101
154
|
await tester.tap(find.byKey(const Key("bookTitle")));
|
|
102
155
|
await tester.pumpAndSettle();
|
|
103
|
-
await tester.loadAssets();
|
|
104
156
|
await tester.pump();
|
|
105
157
|
await tester.expectScreenshot(device.device, "book_select");
|
|
106
158
|
});
|
|
@@ -112,10 +164,10 @@ void main() {
|
|
|
112
164
|
store: store,
|
|
113
165
|
home: const Home(bookIndex: 0, chapterIndex: 0),
|
|
114
166
|
));
|
|
167
|
+
await tester.loadAssets();
|
|
115
168
|
await tester.pumpAndSettle();
|
|
116
169
|
await tester.tap(find.byKey(const Key("chapterTitle")));
|
|
117
170
|
await tester.pumpAndSettle();
|
|
118
|
-
await tester.loadAssets();
|
|
119
171
|
await tester.pump();
|
|
120
172
|
await tester.expectScreenshot(device.device, "chapter_select");
|
|
121
173
|
});
|
|
@@ -151,10 +203,10 @@ void main() {
|
|
|
151
203
|
store: store,
|
|
152
204
|
home: const Home(bookIndex: 0, chapterIndex: 0),
|
|
153
205
|
));
|
|
206
|
+
await tester.loadAssets();
|
|
154
207
|
await tester.pumpAndSettle();
|
|
155
208
|
await tester.tap(find.byKey(const Key("settingsButton")));
|
|
156
209
|
await tester.pumpAndSettle();
|
|
157
|
-
await tester.loadAssets();
|
|
158
210
|
await tester.pump();
|
|
159
211
|
await tester.expectScreenshot(device.device, "settings");
|
|
160
212
|
});
|
|
@@ -166,10 +218,10 @@ void main() {
|
|
|
166
218
|
store: store,
|
|
167
219
|
home: const Home(bookIndex: 0, chapterIndex: 0),
|
|
168
220
|
));
|
|
221
|
+
await tester.loadAssets();
|
|
169
222
|
await tester.pumpAndSettle();
|
|
170
223
|
await tester.tap(find.byKey(const Key("bible")));
|
|
171
224
|
await tester.pumpAndSettle();
|
|
172
|
-
await tester.loadAssets();
|
|
173
225
|
await tester.pump();
|
|
174
226
|
await tester.expectScreenshot(device.device, "bible_select");
|
|
175
227
|
});
|
|
@@ -181,7 +233,7 @@ void main() {
|
|
|
181
233
|
store: store,
|
|
182
234
|
home: const Home(bookIndex: 0, chapterIndex: 0),
|
|
183
235
|
));
|
|
184
|
-
await tester.loadAssets(
|
|
236
|
+
await tester.loadAssets();
|
|
185
237
|
await tester.pump();
|
|
186
238
|
await tester.expectScreenshot(device.device, "hindi_home");
|
|
187
239
|
});
|