Compare commits

...

1 Commits

Author SHA1 Message Date
a0b9572315 docker 2021-05-05 13:39:29 +02:00
13 changed files with 52 additions and 16 deletions

View File

@ -6,11 +6,11 @@ on:
- master - master
jobs: jobs:
analyze_and_test: analyze:
name: Flutter analyze name: Flutter analyze
strategy: strategy:
matrix: matrix:
flutter: ['beta'] flutter: ['stable', 'beta']
runs-on: macos-latest runs-on: macos-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -22,9 +22,6 @@ jobs:
- run: flutter pub get - run: flutter pub get
working-directory: example working-directory: example
- run: flutter analyze - 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 - run: flutter pub run tool/prepare_submit.dart
- name: "check for uncommitted changes" - name: "check for uncommitted changes"
run: | run: |
@ -33,6 +30,15 @@ jobs:
"and check in all changes" \ "and check in all changes" \
&& exit 1) && exit 1)
shell: bash shell: bash
test:
name: Run all tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
uses: docker://cirrusci/flutter:2.0.6
with:
args: sh run_tests.sh
build_web_version: build_web_version:
name: Check that the web version compile name: Check that the web version compile
runs-on: ubuntu-latest runs-on: ubuntu-latest

7
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,7 @@
## Run the Golden tests
Run and update the golden tests requires Docker installed.
```shell script
sh update_goldens.sh
```

View File

@ -5,11 +5,13 @@ analyzer:
implicit-dynamic: false implicit-dynamic: false
linter: linter:
rules: rules:
avoid_dynamic_calls: true
avoid_renaming_method_parameters: true avoid_renaming_method_parameters: true
avoid_returning_null_for_future: true avoid_returning_null_for_future: true
avoid_returning_null_for_void: true avoid_returning_null_for_void: true
avoid_returning_this: true avoid_returning_this: true
avoid_setters_without_getters: true avoid_setters_without_getters: true
avoid_web_libraries_in_flutter: true
await_only_futures: true await_only_futures: true
camel_case_types: true camel_case_types: true
cancel_subscriptions: true cancel_subscriptions: true
@ -25,6 +27,7 @@ linter:
overridden_fields: true overridden_fields: true
prefer_inlined_adds: true prefer_inlined_adds: true
prefer_interpolation_to_compose_strings: true prefer_interpolation_to_compose_strings: true
prefer_null_aware_method_calls: true
prefer_null_aware_operators: true prefer_null_aware_operators: true
prefer_relative_imports: true prefer_relative_imports: true
prefer_typing_uninitialized_variables: true prefer_typing_uninitialized_variables: true
@ -32,7 +35,9 @@ linter:
test_types_in_equals: true test_types_in_equals: true
unnecessary_brace_in_string_interps: true unnecessary_brace_in_string_interps: true
unnecessary_getters_setters: true unnecessary_getters_setters: true
unnecessary_null_checks: true
unnecessary_parenthesis: true unnecessary_parenthesis: true
unnecessary_statements: true unnecessary_statements: true
use_function_type_syntax_for_parameters: true use_function_type_syntax_for_parameters: true
use_if_null_to_convert_nulls_to_bools: true
void_checks: true void_checks: true

View File

@ -95,13 +95,6 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
golden_toolkit:
dependency: "direct dev"
description:
name: golden_toolkit
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
@ -225,7 +218,7 @@ packages:
name: source_span name: source_span
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@ -260,7 +253,7 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19" version: "0.3.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

View File

@ -17,7 +17,6 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
golden_toolkit:
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec

View File

@ -1,3 +1,5 @@
// This file is using conditional import so it is safe to import dart:html
// ignore: avoid_web_libraries_in_flutter
import 'dart:html'; import 'dart:html';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';

View File

@ -1,6 +1,6 @@
name: lottie name: lottie
description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player. description: Render After Effects animations natively on Flutter. This package is a pure Dart implementation of a Lottie player.
version: 1.0.1 version: 1.0.2
homepage: https://github.com/xvrh/lottie-flutter homepage: https://github.com/xvrh/lottie-flutter
environment: environment:

2
run_tests.sh Normal file
View File

@ -0,0 +1,2 @@
flutter test test
(cd example && flutter test test)

View File

@ -22,6 +22,9 @@ void main() {
.replaceAll(' ', '_'); .replaceAll(' ', '_');
testWidgets(description, (tester) async { testWidgets(description, (tester) async {
tester.binding.window.physicalSizeTestValue = Size(500, 400);
tester.binding.window.devicePixelRatioTestValue = 1.0;
var animation = var animation =
AnimationController(vsync: tester, duration: composition.duration); AnimationController(vsync: tester, duration: composition.duration);
if (progress != null) { if (progress != null) {

View File

@ -5,6 +5,9 @@ import 'package:lottie/lottie.dart';
void main() { void main() {
testWidgets('Dynamic test', (tester) async { testWidgets('Dynamic test', (tester) async {
tester.binding.window.physicalSizeTestValue = Size(500, 400);
tester.binding.window.devicePixelRatioTestValue = 1.0;
var composition = await LottieComposition.fromBytes( var composition = await LottieComposition.fromBytes(
File('example/assets/Tests/DynamicText.json').readAsBytesSync()); File('example/assets/Tests/DynamicText.json').readAsBytesSync());

View File

@ -7,6 +7,9 @@ import 'package:lottie/lottie.dart';
void main() { void main() {
void testGradient(String name, ValueDelegate valueDelegate) { void testGradient(String name, ValueDelegate valueDelegate) {
testWidgets(name, (tester) async { testWidgets(name, (tester) async {
tester.binding.window.physicalSizeTestValue = Size(500, 400);
tester.binding.window.devicePixelRatioTestValue = 1.0;
var composition = await LottieComposition.fromBytes( var composition = await LottieComposition.fromBytes(
File('example/assets/Tests/DynamicGradient.json').readAsBytesSync()); File('example/assets/Tests/DynamicGradient.json').readAsBytesSync());

1
update_goldens.sh Normal file
View File

@ -0,0 +1 @@
docker run --rm -it -v "${PWD}":/build --workdir /build cirrusci/flutter:2.0.6 sh update_goldens_inside_docker.sh

View File

@ -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