-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee0eaba
commit e10d531
Showing
7 changed files
with
53 additions
and
210 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
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 |
---|---|---|
@@ -1,16 +1,44 @@ | ||
# flutter_svg_test | ||
|
||
A new Flutter project. | ||
### Testing | ||
|
||
## Getting Started | ||
This package provides a set of functions to find images generated by | ||
[**flutter_svg** ](https://github.com/dnfield/flutter_svg/tree/master/packages/flutter_svg) | ||
in widget tests. | ||
|
||
This project is a starting point for a Flutter application. | ||
The methods find elements with the `SvgPicture` type and compare either the `BytesLoader` or the | ||
configuration of the `BytesLoader` with the giving test attribute. | ||
|
||
A few resources to get you started if this is your first Flutter project: | ||
### Example | ||
|
||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) | ||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) | ||
#### Find by BytesLoader | ||
|
||
For help getting started with Flutter development, view the | ||
[online documentation](https://docs.flutter.dev/), which offers tutorials, | ||
samples, guidance on mobile development, and a full API reference. | ||
The following example shows how you can find svgs with the matching `SvgAssetLoader`. | ||
|
||
```dart | ||
testWidgets('Finds svg', (WidgetTester widgetTester) async { | ||
final SvgPicture asset = SvgPicture.asset('/test/path/my.svg'); | ||
await widgetTester.pumpWidget(asset); | ||
expect(find.svg(asset.bytesLoader), findsOneWidget); | ||
}); | ||
``` | ||
|
||
#### Find by svg path | ||
|
||
Sometimes it is more convenient instead of instantiate the whole `BytesLoader` to | ||
compare only specific attributes. | ||
|
||
The following example shows how you can find svgs with the specified attribute. | ||
|
||
```dart | ||
testWidgets('asset svg with path', (WidgetTester widgetTester) async { | ||
const String svgPath = 'test/flutter_logo.svg'; | ||
await widgetTester.pumpWidget(SvgPicture.asset(svgPath)); | ||
expect(find.svgAssetWithPath(svgPath), findsOneWidget); | ||
}); | ||
``` |
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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