-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from eBay/improve-font-loading
Improve font loading
- Loading branch information
Showing
19 changed files
with
248 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// *************************************************** | ||
/// Copyright 2019-2020 eBay Inc. | ||
/// | ||
/// Use of this source code is governed by a BSD-style | ||
/// license that can be found in the LICENSE file or at | ||
/// https://opensource.org/licenses/BSD-3-Clause | ||
/// *************************************************** | ||
/// | ||
import 'dart:async'; | ||
|
||
import 'package:golden_toolkit/golden_toolkit.dart'; | ||
|
||
Future<void> main(FutureOr<void> testMain()) async { | ||
await loadAppFonts(); | ||
return testMain(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// *************************************************** | ||
/// Copyright 2019-2020 eBay Inc. | ||
/// | ||
/// Use of this source code is governed by a BSD-style | ||
/// license that can be found in the LICENSE file or at | ||
/// https://opensource.org/licenses/BSD-3-Clause | ||
/// *************************************************** | ||
/// | ||
import 'dart:io'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:golden_toolkit/golden_toolkit.dart'; | ||
|
||
Future<void> main() async { | ||
group('Font loading', () { | ||
testGoldens('Roboto fonts should work', (tester) async { | ||
final golden = GoldenBuilder.column() | ||
..addScenario('Material Fonts should work', | ||
const Text('This is material text in "Roboto"')) | ||
..addScenario( | ||
'Material Icons should work', const Icon(Icons.phone_in_talk)) | ||
..addScenario( | ||
'Fonts from packages should work', | ||
const Text('This is a custom font', | ||
style: TextStyle( | ||
fontFamily: 'OpenSans', package: 'sample_dependency'))) | ||
..addScenario('Unknown fonts render in Ahem', | ||
const Text('unknown font', style: TextStyle(fontFamily: 'foo'))); | ||
await tester.pumpWidgetBuilder(golden.build()); | ||
await screenMatchesGolden(tester, 'material_fonts', | ||
skip: !Platform.isMacOS); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: 27321ebbad34b0a3fafe99fac037102196d655ff | ||
channel: unknown | ||
|
||
project_type: package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# sample_dependency | ||
|
||
A new Flutter package project. | ||
|
||
## Getting Started | ||
|
||
This project is a starting point for a Dart | ||
[package](https://flutter.dev/developing-packages/), | ||
a library module containing code that can be shared easily across | ||
multiple Flutter or Dart projects. | ||
|
||
For help getting started with Flutter, view our | ||
[online documentation](https://flutter.dev/docs), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. |
Binary file added
BIN
+94.7 KB
packages/golden_toolkit/test/sample_dependency/lib/fonts/OpenSans-Regular.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions
1
packages/golden_toolkit/test/sample_dependency/lib/sample_dependency.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
library sample_dependency; |
43 changes: 43 additions & 0 deletions
43
packages/golden_toolkit/test/sample_dependency/pubspec.lock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Generated by pub | ||
# See https://dart.dev/tools/pub/glossary#lockfile | ||
packages: | ||
collection: | ||
dependency: transitive | ||
description: | ||
name: collection | ||
url: "https://pub.dartlang.org" | ||
source: hosted | ||
version: "1.14.11" | ||
flutter: | ||
dependency: "direct main" | ||
description: flutter | ||
source: sdk | ||
version: "0.0.0" | ||
meta: | ||
dependency: transitive | ||
description: | ||
name: meta | ||
url: "https://pub.dartlang.org" | ||
source: hosted | ||
version: "1.1.8" | ||
sky_engine: | ||
dependency: transitive | ||
description: flutter | ||
source: sdk | ||
version: "0.0.99" | ||
typed_data: | ||
dependency: transitive | ||
description: | ||
name: typed_data | ||
url: "https://pub.dartlang.org" | ||
source: hosted | ||
version: "1.1.6" | ||
vector_math: | ||
dependency: transitive | ||
description: | ||
name: vector_math | ||
url: "https://pub.dartlang.org" | ||
source: hosted | ||
version: "2.0.8" | ||
sdks: | ||
dart: ">=2.2.2 <3.0.0" |
16 changes: 16 additions & 0 deletions
16
packages/golden_toolkit/test/sample_dependency/pubspec.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: sample_dependency | ||
description: A sample dependency that includes fonts to validate golden_toolkit's loadAppFonts() helper | ||
version: 0.0.1 | ||
author: | ||
|
||
environment: | ||
sdk: ">=2.1.0 <3.0.0" | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
flutter: | ||
fonts: | ||
- family: OpenSans | ||
fonts: | ||
- asset: packages/sample_dependency/fonts/OpenSans-Regular.ttf |
Oops, something went wrong.