diff --git a/.travis.yml b/.travis.yml index fcc5dac..0262ecf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,13 @@ -language: dart +os: + - linux sudo: false +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - libstdc++6 + - fonts-droid-fallback before_script: - git clone https://github.com/flutter/flutter.git -b stable --depth 1 - ./flutter/bin/flutter doctor @@ -23,4 +31,4 @@ after_success: - bash <(curl -s https://codecov.io/bash) cache: directories: - - $HOME/.pub-cache + - $HOME/.pub-cache \ No newline at end of file diff --git a/packages/golden_toolkit/CHANGELOG.md b/packages/golden_toolkit/CHANGELOG.md index 34eea9e..8668c27 100644 --- a/packages/golden_toolkit/CHANGELOG.md +++ b/packages/golden_toolkit/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.14.0 + +- Updated to Dart 2.18 and newer dependencies + ## 0.13.0 - Updated to Flutter 2.8 / Dart 2.15 diff --git a/packages/golden_toolkit/example/pubspec.lock b/packages/golden_toolkit/example/pubspec.lock index 597487e..a536ec0 100644 --- a/packages/golden_toolkit/example/pubspec.lock +++ b/packages/golden_toolkit/example/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,35 +21,28 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -73,7 +66,7 @@ packages: path: ".." relative: true source: path - version: "0.13.0" + version: "0.14.0" lints: dependency: transitive description: @@ -87,21 +80,28 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" sky_engine: dependency: transitive description: flutter @@ -113,7 +113,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -134,34 +134,27 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" sdks: - dart: ">=2.15.0 <3.0.0" + dart: ">=2.18.4 <3.0.0" diff --git a/packages/golden_toolkit/example/test/example_test.dart b/packages/golden_toolkit/example/test/example_test.dart index 8d10819..2430051 100644 --- a/packages/golden_toolkit/example/test/example_test.dart +++ b/packages/golden_toolkit/example/test/example_test.dart @@ -209,7 +209,7 @@ class FutureWidgetTester extends StatefulWidget { final Widget child; final Duration duration; @override - _FutureWidgetTesterState createState() => _FutureWidgetTesterState(); + State createState() => _FutureWidgetTesterState(); } class _FutureWidgetTesterState extends State { diff --git a/packages/golden_toolkit/example/test/goldens/all_sized_all_fonts.phone.png b/packages/golden_toolkit/example/test/goldens/all_sized_all_fonts.phone.png index 59f93f0..8025f6f 100644 Binary files a/packages/golden_toolkit/example/test/goldens/all_sized_all_fonts.phone.png and b/packages/golden_toolkit/example/test/goldens/all_sized_all_fonts.phone.png differ diff --git a/packages/golden_toolkit/example/test/goldens/all_sized_all_fonts.tablet_landscape.png b/packages/golden_toolkit/example/test/goldens/all_sized_all_fonts.tablet_landscape.png index ef08393..4ef995f 100644 Binary files a/packages/golden_toolkit/example/test/goldens/all_sized_all_fonts.tablet_landscape.png and b/packages/golden_toolkit/example/test/goldens/all_sized_all_fonts.tablet_landscape.png differ diff --git a/packages/golden_toolkit/example/test/goldens/example_of_images_not_properly_loading.phone.png b/packages/golden_toolkit/example/test/goldens/example_of_images_not_properly_loading.phone.png index d2243c7..b39c5aa 100644 Binary files a/packages/golden_toolkit/example/test/goldens/example_of_images_not_properly_loading.phone.png and b/packages/golden_toolkit/example/test/goldens/example_of_images_not_properly_loading.phone.png differ diff --git a/packages/golden_toolkit/example/test/goldens/flutter_demo_page_multiple_scenarios.png b/packages/golden_toolkit/example/test/goldens/flutter_demo_page_multiple_scenarios.png index 639f3ce..70cf096 100644 Binary files a/packages/golden_toolkit/example/test/goldens/flutter_demo_page_multiple_scenarios.png and b/packages/golden_toolkit/example/test/goldens/flutter_demo_page_multiple_scenarios.png differ diff --git a/packages/golden_toolkit/example/test/goldens/flutter_demo_page_single_scenario.png b/packages/golden_toolkit/example/test/goldens/flutter_demo_page_single_scenario.png index 2a4dc38..a34c55e 100644 Binary files a/packages/golden_toolkit/example/test/goldens/flutter_demo_page_single_scenario.png and b/packages/golden_toolkit/example/test/goldens/flutter_demo_page_single_scenario.png differ diff --git a/packages/golden_toolkit/example/test/goldens/flutter_demo_page_single_scenario_more_devices.png b/packages/golden_toolkit/example/test/goldens/flutter_demo_page_single_scenario_more_devices.png index 4b49f65..817b599 100644 Binary files a/packages/golden_toolkit/example/test/goldens/flutter_demo_page_single_scenario_more_devices.png and b/packages/golden_toolkit/example/test/goldens/flutter_demo_page_single_scenario_more_devices.png differ diff --git a/packages/golden_toolkit/example/test/goldens/weather_image_async_load_correct_duration.phone.png b/packages/golden_toolkit/example/test/goldens/weather_image_async_load_correct_duration.phone.png index 33848ca..96544ea 100644 Binary files a/packages/golden_toolkit/example/test/goldens/weather_image_async_load_correct_duration.phone.png and b/packages/golden_toolkit/example/test/goldens/weather_image_async_load_correct_duration.phone.png differ diff --git a/packages/golden_toolkit/example/test/goldens/weather_types_column.png b/packages/golden_toolkit/example/test/goldens/weather_types_column.png index 56200f7..812769c 100644 Binary files a/packages/golden_toolkit/example/test/goldens/weather_types_column.png and b/packages/golden_toolkit/example/test/goldens/weather_types_column.png differ diff --git a/packages/golden_toolkit/example/test/goldens/weather_types_grid.png b/packages/golden_toolkit/example/test/goldens/weather_types_grid.png index 6bb0ce1..194cffe 100644 Binary files a/packages/golden_toolkit/example/test/goldens/weather_types_grid.png and b/packages/golden_toolkit/example/test/goldens/weather_types_grid.png differ diff --git a/packages/golden_toolkit/lib/src/device_builder.dart b/packages/golden_toolkit/lib/src/device_builder.dart index 7313685..f025413 100644 --- a/packages/golden_toolkit/lib/src/device_builder.dart +++ b/packages/golden_toolkit/lib/src/device_builder.dart @@ -13,12 +13,12 @@ import 'package:flutter/material.dart'; import '../golden_toolkit.dart'; /// Class containing whats required to create a Scenario -class _DeviceScenario { +class DeviceScenario { /// constructs a DeviceScenario - _DeviceScenario({ + DeviceScenario({ required this.key, - this.onCreate, required this.widget, + this.onCreate, }); /// key that references created scenario and specific device @@ -28,7 +28,7 @@ class _DeviceScenario { final OnScenarioCreate? onCreate; /// widget that represents this device/scenario - final _DeviceScenarioWidget widget; + final DeviceScenarioWidget widget; } /// DeviceBuilder builds [Device] size driven layout for its children @@ -53,7 +53,7 @@ class DeviceBuilder { final Color? bgColor; /// list of created DeviceScenarios for each device type - final List<_DeviceScenario> scenarios = []; + final List scenarios = []; List _devicesForScenarios = GoldenToolkit.configuration.defaultDevices; @@ -66,7 +66,7 @@ class DeviceBuilder { _devicesForScenarios = devices; } - /// [addScenario] will add a [_DeviceScenario] for each device listed + /// [addScenario] will add a [DeviceScenario] for each device listed /// under [_devicesForScenarios] /// /// [widget] widget you'd like rendered ad Device sizes @@ -83,10 +83,10 @@ class DeviceBuilder { final key = Key(scenarioName); scenarios.add( - _DeviceScenario( + DeviceScenario( key: key, onCreate: onCreate, - widget: _DeviceScenarioWidget( + widget: DeviceScenarioWidget( key: key, device: dev, widget: widget, @@ -153,8 +153,8 @@ class DeviceBuilder { } } -class _DeviceScenarioWidget extends StatelessWidget { - const _DeviceScenarioWidget({ +class DeviceScenarioWidget extends StatelessWidget { + const DeviceScenarioWidget({ required Key key, required this.device, required this.widget, diff --git a/packages/golden_toolkit/lib/src/testing_tools.dart b/packages/golden_toolkit/lib/src/testing_tools.dart index d1077b3..0b891c1 100644 --- a/packages/golden_toolkit/lib/src/testing_tools.dart +++ b/packages/golden_toolkit/lib/src/testing_tools.dart @@ -49,11 +49,11 @@ extension TestingToolsExtension on WidgetTester { Size surfaceSize = _defaultSize, double textScaleSize = 1.0, }) async { - final _wrapper = wrapper ?? materialAppWrapper(); + final wrap = wrapper ?? materialAppWrapper(); await _pumpAppWidget( this, - _wrapper(widget), + wrap(widget), surfaceSize: surfaceSize, textScaleSize: textScaleSize, ); @@ -123,7 +123,8 @@ Future _pumpAppWidget( await tester.binding.setSurfaceSize(surfaceSize); tester.binding.window.physicalSizeTestValue = surfaceSize; tester.binding.window.devicePixelRatioTestValue = 1.0; - tester.binding.window.textScaleFactorTestValue = textScaleSize; + tester.binding.window.platformDispatcher.textScaleFactorTestValue = + textScaleSize; await tester.pumpWidget( DefaultAssetBundle(bundle: TestAssetBundle(), child: app), diff --git a/packages/golden_toolkit/lib/src/widget_tester_extensions.dart b/packages/golden_toolkit/lib/src/widget_tester_extensions.dart index c593796..350489e 100644 --- a/packages/golden_toolkit/lib/src/widget_tester_extensions.dart +++ b/packages/golden_toolkit/lib/src/widget_tester_extensions.dart @@ -46,9 +46,10 @@ extension WidgetFlutterBindingExtensions on TestWidgetsFlutterBinding { await setSurfaceSize(Size(device.size.width, device.size.height)); this.window.physicalSizeTestValue = device.size; this.window.devicePixelRatioTestValue = device.devicePixelRatio; - this.window.textScaleFactorTestValue = device.textScale; + this.window.platformDispatcher.textScaleFactorTestValue = device.textScale; + this.window.platformDispatcher.platformBrightnessTestValue = + device.brightness; this.window.safeAreaTestValue = device.safeArea; - this.window.platformBrightnessTestValue = device.brightness; } /// Resets any configuration that may be been specified by applyDeviceOverrides @@ -58,9 +59,9 @@ extension WidgetFlutterBindingExtensions on TestWidgetsFlutterBinding { // there is an untested assumption that clearing these specific values is cheaper than // calling binding.window.clearAllTestValues(). this.window.clearDevicePixelRatioTestValue(); - this.window.clearPlatformBrightnessTestValue(); + this.window.platformDispatcher.clearPlatformBrightnessTestValue(); this.window.clearPaddingTestValue(); - this.window.clearTextScaleFactorTestValue(); + this.window.platformDispatcher.clearTextScaleFactorTestValue(); this.window.clearPhysicalSizeTestValue(); await setSurfaceSize(null); } diff --git a/packages/golden_toolkit/pubspec.lock b/packages/golden_toolkit/pubspec.lock index e959c05..053c2aa 100644 --- a/packages/golden_toolkit/pubspec.lock +++ b/packages/golden_toolkit/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.2" + version: "2.9.0" boolean_selector: dependency: transitive description: @@ -21,35 +21,28 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.2.1" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" fake_async: dependency: transitive description: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -61,7 +54,7 @@ packages: name: flutter_lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" flutter_test: dependency: "direct main" description: flutter @@ -73,28 +66,35 @@ packages: name: lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.1" matcher: dependency: transitive description: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.11" + version: "0.12.12" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.5" meta: dependency: "direct main" description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.7.0" + version: "1.8.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.2" sample_dependency: dependency: "direct dev" description: @@ -113,7 +113,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.9.0" stack_trace: dependency: transitive description: @@ -134,34 +134,27 @@ packages: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.1.1" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: "direct dev" description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.3" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.4.12" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.2" sdks: - dart: ">=2.15.0 <3.0.0" + dart: ">=2.18.4 <3.0.0" diff --git a/packages/golden_toolkit/pubspec.yaml b/packages/golden_toolkit/pubspec.yaml index 2ce5464..0e2cd31 100644 --- a/packages/golden_toolkit/pubspec.yaml +++ b/packages/golden_toolkit/pubspec.yaml @@ -1,25 +1,25 @@ name: golden_toolkit description: Common patterns for screenshot-based widget testing using Goldens. -version: 0.13.0 +version: 0.14.0 homepage: https://github.com/eBay/flutter_glove_box/ repository: https://github.com/eBay/flutter_glove_box/tree/master/packages/golden_toolkit issue_tracker: https://github.com/eBay/flutter_glove_box/issues environment: - sdk: ">=2.15.0 <3.0.0" + sdk: ">=2.18.4 <3.0.0" dependencies: flutter: sdk: flutter flutter_test: sdk: flutter - meta: ^1.1.8 + meta: ^1.8.0 dev_dependencies: - flutter_lints: ^1.0.4 + flutter_lints: ^2.0.1 sample_dependency: path: test/sample_dependency - test_api: ^0.4.2 + test_api: ^0.4.12 flutter: fonts: diff --git a/packages/golden_toolkit/test/goldens/enableRealShadows_honored_when_testGoldens_wrapped.png b/packages/golden_toolkit/test/goldens/enableRealShadows_honored_when_testGoldens_wrapped.png index 53b2b66..4629783 100644 Binary files a/packages/golden_toolkit/test/goldens/enableRealShadows_honored_when_testGoldens_wrapped.png and b/packages/golden_toolkit/test/goldens/enableRealShadows_honored_when_testGoldens_wrapped.png differ diff --git a/packages/golden_toolkit/test/goldens/enableRealShadows_ignored_when_testGoldens_not_wrapped.png b/packages/golden_toolkit/test/goldens/enableRealShadows_ignored_when_testGoldens_not_wrapped.png index 783b2e1..f2854fe 100644 Binary files a/packages/golden_toolkit/test/goldens/enableRealShadows_ignored_when_testGoldens_not_wrapped.png and b/packages/golden_toolkit/test/goldens/enableRealShadows_ignored_when_testGoldens_not_wrapped.png differ diff --git a/packages/golden_toolkit/test/goldens/material_fonts.png b/packages/golden_toolkit/test/goldens/material_fonts.png index c25e81b..43e0d52 100644 Binary files a/packages/golden_toolkit/test/goldens/material_fonts.png and b/packages/golden_toolkit/test/goldens/material_fonts.png differ