-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Showing
20 changed files
with
135 additions
and
81 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import 'dart:io'; | ||
import 'dart:ui'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:lottie/lottie.dart'; | ||
|
||
void main() { | ||
void testGradient(String name, ValueDelegate valueDelegate) { | ||
testWidgets(name, (tester) async { | ||
var composition = await LottieComposition.fromBytes( | ||
File('assets/Tests/DynamicGradient.json').readAsBytesSync()); | ||
|
||
var animation = | ||
AnimationController(vsync: tester, duration: composition.duration); | ||
|
||
await tester.pumpWidget( | ||
Lottie( | ||
composition: composition, | ||
controller: animation, | ||
delegates: LottieDelegates(values: [valueDelegate]), | ||
), | ||
); | ||
|
||
var screenshotName = name | ||
.toLowerCase() | ||
.replaceAll(RegExp('[^a-z0-9 ]'), '') | ||
.replaceAll(' ', '_'); | ||
|
||
await expectLater(find.byType(Lottie), | ||
matchesGoldenFile('goldens/gradients/$screenshotName.png')); | ||
}); | ||
} | ||
|
||
testGradient( | ||
'Linear Gradient Fill', | ||
ValueDelegate.gradientColor(['Linear', 'Rectangle', 'Gradient Fill'], | ||
value: [Color(0xFFFFFF00), Color(0xFF00FF00)])); | ||
|
||
testGradient( | ||
'Radial Gradient Fill', | ||
ValueDelegate.gradientColor(['Radial', 'Rectangle', 'Gradient Fill'], | ||
value: [Color(0xFFFFFF00), Color(0xFF00FF00)])); | ||
|
||
testGradient( | ||
'Linear Gradient Stroke', | ||
ValueDelegate.gradientColor(['Linear', 'Rectangle', 'Gradient Stroke'], | ||
value: [Color(0xFFFFFF00), Color(0xFF00FF00)])); | ||
|
||
testGradient( | ||
'Radial Gradient Stroke', | ||
ValueDelegate.gradientColor(['Radial', 'Rectangle', 'Gradient Stroke'], | ||
value: [Color(0xFFFFFF00), Color(0xFF00FF00)])); | ||
|
||
testGradient( | ||
'Opacity Linear Gradient Fill', | ||
ValueDelegate.opacity(['Linear', 'Rectangle', 'Gradient Fill'], | ||
value: 50)); | ||
} |
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
Oops, something went wrong.