Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
flutter: ['stable']
runs-on: macos-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
Expand All @@ -22,9 +22,6 @@ jobs:
- run: flutter pub get
working-directory: example
- run: flutter analyze
- run: flutter test test # https://github.com/flutter/flutter/issues/20907
- run: flutter test test
working-directory: example
- run: flutter pub run tool/prepare_submit.dart
- name: "check for uncommitted changes"
run: |
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lottie Flutter
on:
pull_request:
push:
branches:
- master

jobs:
test:
name: Run all tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
uses: docker://cirrusci/flutter:1.22.1
with:
args: sh run_tests.sh
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

## Run the Golden tests
Run and update the golden tests requires Docker installed.

```shell script
sh update_goldens.sh
```
10 changes: 5 additions & 5 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ packages:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
version: "1.5.2"
async:
dependency: transitive
description:
Expand Down Expand Up @@ -70,7 +70,7 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
version: "2.1.3"
fake_async:
dependency: transitive
description:
Expand Down Expand Up @@ -213,7 +213,7 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.2"
version: "1.8.0+1"
platform:
dependency: transitive
description:
Expand Down Expand Up @@ -309,7 +309,7 @@ packages:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
version: "0.1.0"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
3 changes: 3 additions & 0 deletions example/test/dynamic_properties_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ void main() {
.replaceAll(' ', '_');

testWidgets(description, (tester) async {
tester.binding.window.physicalSizeTestValue = Size(500, 400);
tester.binding.window.devicePixelRatioTestValue = 1.0;

var animation =
AnimationController(vsync: tester, duration: composition.duration);
if (progress != null) {
Expand Down
3 changes: 3 additions & 0 deletions example/test/dynamic_text_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import 'package:lottie/lottie.dart';

void main() {
testWidgets('Dynamic test', (tester) async {
tester.binding.window.physicalSizeTestValue = Size(500, 400);
tester.binding.window.devicePixelRatioTestValue = 1.0;

var composition = await LottieComposition.fromBytes(
File('assets/Tests/DynamicText.json').readAsBytesSync());

Expand Down
Binary file modified example/test/goldens/all/14595-thumbs-up.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/Logo/logosmall.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/Mobilo/f.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/Mobilo/g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/Tests/dynamictext.png
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.
Binary file modified example/test/goldens/all/hamburgerarrow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/atm_link.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/im_thirsty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/lottie_logo_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/moving_eye.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/passport.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/personal_character.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/progress_bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/star 2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/streetbymorning.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottiefiles/tractor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/all/lottielogo1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/dynamic/color_filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/dynamic/ellipse_position.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/dynamic/ellipse_size.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/dynamic/fill_color_green.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/dynamic/fill_color_yellow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/dynamic/fill_opacity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/dynamic/null_color_filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified example/test/goldens/dynamic/opacity_interpolation_00.png
Binary file modified example/test/goldens/dynamic/opacity_interpolation_05.png
Binary file modified example/test/goldens/dynamic/opacity_interpolation_10.png
Binary file modified example/test/goldens/dynamic/polygon_points.png
Binary file modified example/test/goldens/dynamic/polygon_position.png
Binary file modified example/test/goldens/dynamic/polygon_radius.png
Binary file modified example/test/goldens/dynamic/polygon_rotation.png
Binary file modified example/test/goldens/dynamic/polygon_roundedness.png
Binary file modified example/test/goldens/dynamic/rectangle_corner_roundedness.png
Binary file modified example/test/goldens/dynamic/rectangle_position.png
Binary file modified example/test/goldens/dynamic/rectangle_size.png
Binary file modified example/test/goldens/dynamic/repeater_transform_end_opacity.png
Binary file modified example/test/goldens/dynamic/repeater_transform_position.png
Binary file modified example/test/goldens/dynamic/repeater_transform_rotation.png
Binary file modified example/test/goldens/dynamic/repeater_transform_scale.png
Binary file modified example/test/goldens/dynamic/star_inner_radius.png
Binary file modified example/test/goldens/dynamic/star_inner_roundedness.png
Binary file modified example/test/goldens/dynamic/star_outer_radius.png
Binary file modified example/test/goldens/dynamic/star_outer_roundedness.png
Binary file modified example/test/goldens/dynamic/star_points.png
Binary file modified example/test/goldens/dynamic/star_position.png
Binary file modified example/test/goldens/dynamic/star_rotation.png
Binary file modified example/test/goldens/dynamic/stroke_color.png
Binary file modified example/test/goldens/dynamic/stroke_opacity.png
Binary file modified example/test/goldens/dynamic/stroke_width.png
Binary file modified example/test/goldens/dynamic/time_remapping.png
Binary file modified example/test/goldens/dynamic/transform_anchor_point.png
Binary file modified example/test/goldens/dynamic/transform_opacity.png
Binary file modified example/test/goldens/dynamic/transform_position.png
Binary file modified example/test/goldens/dynamic/transform_position_relative.png
Binary file modified example/test/goldens/dynamic/transform_rotation.png
Binary file modified example/test/goldens/dynamic/transform_scale.png
Binary file modified example/test/goldens/dynamic_text.png
Binary file modified example/test/goldens/dynamic_without_delegate.png
Binary file modified example/test/goldens/gradients/linear_gradient_fill.png
Binary file modified example/test/goldens/gradients/linear_gradient_stroke.png
Binary file modified example/test/goldens/gradients/radial_gradient_fill.png
Binary file modified example/test/goldens/gradients/radial_gradient_stroke.png
3 changes: 3 additions & 0 deletions example/test/gradient_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import 'package:lottie/lottie.dart';
void main() {
void testGradient(String name, ValueDelegate valueDelegate) {
testWidgets(name, (tester) async {
tester.binding.window.physicalSizeTestValue = Size(500, 400);
tester.binding.window.devicePixelRatioTestValue = 1.0;

var composition = await LottieComposition.fromBytes(
File('assets/Tests/DynamicGradient.json').readAsBytesSync());

Expand Down
79 changes: 22 additions & 57 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "11.0.0"
version: "7.0.0"
analyzer:
dependency: "direct dev"
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.40.4"
version: "0.39.17"
archive:
dependency: "direct main"
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
version: "1.5.2"
async:
dependency: transitive
description:
Expand All @@ -43,27 +43,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.1"
build:
dependency: transitive
description:
name: build
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.2"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.dartlang.org"
source: hosted
version: "7.1.0"
characters:
dependency: "direct main"
description:
Expand Down Expand Up @@ -92,13 +71,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.1"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "3.5.0"
collection:
dependency: "direct main"
description:
Expand All @@ -119,28 +91,28 @@ packages:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
version: "2.1.3"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.2"
dart_style:
dependency: "direct dev"
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.8"
version: "1.3.6"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.1"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.dartlang.org"
source: hosted
version: "0.10.11"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -158,6 +130,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.0+4"
js:
dependency: transitive
description:
Expand Down Expand Up @@ -192,7 +171,7 @@ packages:
name: mockito
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.3"
version: "4.1.1"
node_interop:
dependency: transitive
description:
Expand Down Expand Up @@ -227,33 +206,19 @@ packages:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.2"
version: "1.8.0+1"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+1"
source_span:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions run_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
flutter test test
(cd example && flutter test test)
1 change: 1 addition & 0 deletions update_goldens.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docker run --rm -it -v "${PWD}":/build --workdir /build cirrusci/flutter:1.22.1 sh update_goldens_inside_docker.sh
12 changes: 12 additions & 0 deletions update_goldens_inside_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PUB_CACHE="$(mktemp -d)"
export PUB_CACHE
COPY_DIR="$(mktemp -d)"

(cd /build && git ls-files | xargs -I '{}' cp -pR --parents '{}' "$COPY_DIR")
cd "$COPY_DIR" || exit
flutter test --update-goldens test
cp -pR test/* /build/test

cd example || exit
flutter test --update-goldens test
cp -pR test/* /build/example/test