mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Some cleanup of cross library test imports (#177029)
There is a lot of cross-library importing in the framework unit tests that I'd like to clean up, see the design doc for more: https://docs.google.com/document/d/1UHxALQqCbmgjnM1RNV9xE2pK3IGyx-UktGX1D7hYCjs/edit?tab=t.0 This PR cleans up a few obvious instances and adds TODOs for others. I created this while doing an investigation for the design doc linked above. I hope that we'll be able to follow up with fixes for all of the problematic tests (tracked in the issue below). Part of https://github.com/flutter/flutter/issues/177028
This commit is contained in:
parent
b5b5935a19
commit
bef11d207f
@ -111,27 +111,19 @@ class TestsCrossImportChecker {
|
||||
'packages/flutter/test/widgets/text_test.dart',
|
||||
'packages/flutter/test/widgets/reorderable_list_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_tester_generate_test_semantics_expression_for_current_semantics_tree_test.dart',
|
||||
'packages/flutter/test/widgets/async_lifecycle_test.dart',
|
||||
'packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart',
|
||||
'packages/flutter/test/widgets/scrollable_restoration_test.dart',
|
||||
'packages/flutter/test/widgets/text_golden_test.dart',
|
||||
'packages/flutter/test/widgets/multi_view_parent_data_test.dart',
|
||||
'packages/flutter/test/widgets/view_test.dart',
|
||||
'packages/flutter/test/widgets/two_dimensional_viewport_test.dart',
|
||||
'packages/flutter/test/widgets/list_view_viewporting_test.dart',
|
||||
'packages/flutter/test/widgets/table_test.dart',
|
||||
'packages/flutter/test/widgets/shortcuts_test.dart',
|
||||
'packages/flutter/test/widgets/ticker_provider_test.dart',
|
||||
'packages/flutter/test/widgets/slotted_render_object_widget_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_2_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_clipping_test.dart',
|
||||
'packages/flutter/test/widgets/reparent_state_test.dart',
|
||||
'packages/flutter/test/widgets/transitions_test.dart',
|
||||
'packages/flutter/test/widgets/restoration_scopes_moving_test.dart',
|
||||
'packages/flutter/test/widgets/linked_scroll_view_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_floating_header_test.dart',
|
||||
'packages/flutter/test/widgets/page_transitions_test.dart',
|
||||
'packages/flutter/test/widgets/parent_data_test.dart',
|
||||
'packages/flutter/test/widgets/editable_text_scribble_test.dart',
|
||||
'packages/flutter/test/widgets/draggable_scrollable_sheet_test.dart',
|
||||
'packages/flutter/test/widgets/autofill_group_test.dart',
|
||||
@ -139,68 +131,47 @@ class TestsCrossImportChecker {
|
||||
'packages/flutter/test/widgets/range_maintaining_scroll_physics_test.dart',
|
||||
'packages/flutter/test/widgets/scroll_position_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_tree_test.dart',
|
||||
'packages/flutter/test/widgets/binding_live_test.dart',
|
||||
'packages/flutter/test/widgets/interactive_viewer_test.dart',
|
||||
'packages/flutter/test/widgets/list_view_fling_test.dart',
|
||||
'packages/flutter/test/widgets/selectable_region_test.dart',
|
||||
'packages/flutter/test/widgets/selectable_text_test.dart',
|
||||
'packages/flutter/test/widgets/editable_text_scribe_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_7_test.dart',
|
||||
'packages/flutter/test/widgets/scrollable_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_debugger_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_test.dart',
|
||||
'packages/flutter/test/widgets/page_route_builder_test.dart',
|
||||
'packages/flutter/test/widgets/opacity_repaint_test.dart',
|
||||
'packages/flutter/test/widgets/two_dimensional_scroll_view_test.dart',
|
||||
'packages/flutter/test/widgets/routes_test.dart',
|
||||
'packages/flutter/test/widgets/listener_test.dart',
|
||||
'packages/flutter/test/widgets/text_selection_test.dart',
|
||||
'packages/flutter/test/widgets/list_view_relayout_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_4_test.dart',
|
||||
'packages/flutter/test/widgets/multi_view_binding_test.dart',
|
||||
'packages/flutter/test/widgets/app_test.dart',
|
||||
'packages/flutter/test/widgets/widget_inspector_test.dart',
|
||||
'packages/flutter/test/widgets/radio_group_test.dart',
|
||||
'packages/flutter/test/widgets/list_view_test.dart',
|
||||
'packages/flutter/test/widgets/binding_deferred_first_frame_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_resizing_header_test.dart',
|
||||
'packages/flutter/test/widgets/navigator_replacement_test.dart',
|
||||
'packages/flutter/test/widgets/scroll_delegate_test.dart',
|
||||
'packages/flutter/test/widgets/implicit_animations_test.dart',
|
||||
'packages/flutter/test/widgets/list_view_correction_test.dart',
|
||||
'packages/flutter/test/widgets/default_text_editing_shortcuts_test.dart',
|
||||
'packages/flutter/test/widgets/page_storage_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_main_axis_group_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_zero_surface_size_test.dart',
|
||||
'packages/flutter/test/widgets/color_filter_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_merge_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_9_test.dart',
|
||||
'packages/flutter/test/widgets/modal_barrier_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_semantics_test.dart',
|
||||
'packages/flutter/test/widgets/slivers_padding_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_constraints_test.dart',
|
||||
'packages/flutter/test/widgets/autocomplete_test.dart',
|
||||
'packages/flutter/test/widgets/icon_data_test.dart',
|
||||
'packages/flutter/test/widgets/expansible_test.dart',
|
||||
'packages/flutter/test/widgets/decorated_sliver_test.dart',
|
||||
'packages/flutter/test/widgets/shape_decoration_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_refactor_regression_test.dart',
|
||||
'packages/flutter/test/widgets/run_app_test.dart',
|
||||
'packages/flutter/test/widgets/animated_opacity_repaint_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_6_test.dart',
|
||||
'packages/flutter/test/widgets/shadow_test.dart',
|
||||
'packages/flutter/test/widgets/routes_transition_test.dart',
|
||||
'packages/flutter/test/widgets/placeholder_test.dart',
|
||||
'packages/flutter/test/widgets/animated_image_filtered_repaint_test.dart',
|
||||
'packages/flutter/test/widgets/route_notification_messages_test.dart',
|
||||
'packages/flutter/test/widgets/animated_cross_fade_test.dart',
|
||||
'packages/flutter/test/widgets/editable_text_shortcuts_test.dart',
|
||||
'packages/flutter/test/widgets/gesture_detector_test.dart',
|
||||
'packages/flutter/test/widgets/tree_shape_test.dart',
|
||||
'packages/flutter/test/widgets/rich_text_test.dart',
|
||||
'packages/flutter/test/widgets/router_test.dart',
|
||||
'packages/flutter/test/widgets/scroll_notification_test.dart',
|
||||
'packages/flutter/test/widgets/sensitive_content_error_handling_test.dart',
|
||||
'packages/flutter/test/widgets/magnifier_test.dart',
|
||||
'packages/flutter/test/widgets/backdrop_filter_test.dart',
|
||||
'packages/flutter/test/widgets/editable_text_test.dart',
|
||||
@ -209,11 +180,6 @@ class TestsCrossImportChecker {
|
||||
'packages/flutter/test/widgets/scrollable_helpers_test.dart',
|
||||
'packages/flutter/test/widgets/slivers_appbar_stretch_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_cross_axis_group_test.dart',
|
||||
'packages/flutter/test/widgets/drag_boundary_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_traversal_test.dart',
|
||||
'packages/flutter/test/widgets/sensitive_content_unknown_test.dart',
|
||||
'packages/flutter/test/widgets/overlay_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_8_test.dart',
|
||||
'packages/flutter/test/widgets/list_wheel_scroll_view_test.dart',
|
||||
'packages/flutter/test/widgets/scrollable_dispose_test.dart',
|
||||
'packages/flutter/test/widgets/pop_scope_test.dart',
|
||||
@ -223,33 +189,23 @@ class TestsCrossImportChecker {
|
||||
'packages/flutter/test/widgets/obscured_animated_image_test.dart',
|
||||
'packages/flutter/test/widgets/platform_menu_bar_test.dart',
|
||||
'packages/flutter/test/widgets/inherited_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_fill_viewport_test.dart',
|
||||
'packages/flutter/test/widgets/wrap_test.dart',
|
||||
'packages/flutter/test/widgets/heroes_test.dart',
|
||||
'packages/flutter/test/widgets/overlay_portal_test.dart',
|
||||
'packages/flutter/test/widgets/slivers_evil_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_11_test.dart',
|
||||
'packages/flutter/test/widgets/container_test.dart',
|
||||
'packages/flutter/test/widgets/drawer_test.dart',
|
||||
'packages/flutter/test/widgets/framework_test.dart',
|
||||
'packages/flutter/test/widgets/ticker_mode_test.dart',
|
||||
'packages/flutter/test/widgets/absorb_pointer_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_role_checks_test.dart',
|
||||
'packages/flutter/test/widgets/binding_first_frame_rasterized_test.dart',
|
||||
'packages/flutter/test/widgets/media_query_test.dart',
|
||||
'packages/flutter/test/widgets/editable_text_cursor_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_fill_remaining_test.dart',
|
||||
'packages/flutter/test/widgets/router_restoration_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_keep_alive_offstage_test.dart',
|
||||
'packages/flutter/test/widgets/editable_text_show_on_screen_test.dart',
|
||||
'packages/flutter/test/widgets/system_context_menu_test.dart',
|
||||
'packages/flutter/test/widgets/error_widget_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_checks_test.dart',
|
||||
'packages/flutter/test/widgets/scrollable_fling_test.dart',
|
||||
'packages/flutter/test/widgets/debug_test.dart',
|
||||
'packages/flutter/test/widgets/banner_test.dart',
|
||||
'packages/flutter/test/widgets/sensitive_content_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_10_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_persistent_header_test.dart',
|
||||
'packages/flutter/test/widgets/transformed_scrollable_test.dart',
|
||||
'packages/flutter/test/widgets/run_app_async_test.dart',
|
||||
@ -263,26 +219,17 @@ class TestsCrossImportChecker {
|
||||
'packages/flutter/test/widgets/spell_check_test.dart',
|
||||
'packages/flutter/test/widgets/slivers_appbar_floating_test.dart',
|
||||
'packages/flutter/test/widgets/toggleable_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_1_test.dart',
|
||||
'packages/flutter/test/widgets/sensitive_content_host_test.dart',
|
||||
'packages/flutter/test/widgets/mouse_region_test.dart',
|
||||
'packages/flutter/test/widgets/draggable_test.dart',
|
||||
'packages/flutter/test/widgets/page_transitions_builder_test.dart',
|
||||
'packages/flutter/test/widgets/selectable_region_context_menu_test.dart',
|
||||
'packages/flutter/test/widgets/default_colors_test.dart',
|
||||
'packages/flutter/test/widgets/multi_view_tree_updates_test.dart',
|
||||
'packages/flutter/test/widgets/sliversemantics_test.dart',
|
||||
'packages/flutter/test/widgets/scroll_activity_test.dart',
|
||||
'packages/flutter/test/widgets/tap_region_test.dart',
|
||||
'packages/flutter/test/widgets/lookup_boundary_test.dart',
|
||||
'packages/flutter/test/widgets/reassemble_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_5_test.dart',
|
||||
'packages/flutter/test/widgets/clip_test.dart',
|
||||
'packages/flutter/test/widgets/independent_widget_layout_test.dart',
|
||||
'packages/flutter/test/widgets/binding_first_frame_developer_test.dart',
|
||||
'packages/flutter/test/widgets/html_element_view_test.dart',
|
||||
'packages/flutter/test/widgets/navigator_test.dart',
|
||||
'packages/flutter/test/widgets/multi_view_no_implicit_view_binding_test.dart',
|
||||
'packages/flutter/test/widgets/text_semantics_test.dart',
|
||||
'packages/flutter/test/widgets/safe_area_test.dart',
|
||||
'packages/flutter/test/widgets/page_view_test.dart',
|
||||
@ -290,15 +237,12 @@ class TestsCrossImportChecker {
|
||||
'packages/flutter/test/widgets/scroll_view_test.dart',
|
||||
'packages/flutter/test/widgets/focus_traversal_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_list_test.dart',
|
||||
'packages/flutter/test/widgets/reparent_state_with_layout_builder_test.dart',
|
||||
'packages/flutter/test/widgets/page_forward_transitions_test.dart',
|
||||
'packages/flutter/test/widgets/context_menu_controller_test.dart',
|
||||
'packages/flutter/test/widgets/semantics_3_test.dart',
|
||||
'packages/flutter/test/widgets/slivers_test.dart',
|
||||
'packages/flutter/test/widgets/navigator_restoration_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_prototype_item_extent_test.dart',
|
||||
'packages/flutter/test/widgets/simple_semantics_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_appbar_opacity_test.dart',
|
||||
'packages/flutter/test/widgets/image_filter_test.dart',
|
||||
'packages/flutter/test/widgets/navigator_on_did_remove_page_test.dart',
|
||||
'packages/flutter/test/widgets/opacity_test.dart',
|
||||
@ -307,15 +251,11 @@ class TestsCrossImportChecker {
|
||||
'packages/flutter/test/widgets/scrollable_semantics_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_visibility_test.dart',
|
||||
'packages/flutter/test/widgets/rotated_box_test.dart',
|
||||
'packages/flutter/test/widgets/sliver_constrained_cross_axis_test.dart',
|
||||
'packages/flutter/test/widgets/single_child_scroll_view_test.dart',
|
||||
'packages/flutter/test/widgets/pinned_header_sliver_test.dart',
|
||||
'packages/flutter/test/widgets/focus_manager_test.dart',
|
||||
'packages/flutter/test/widgets/raw_radio_test.dart',
|
||||
'packages/flutter/test/widgets/syncing_test.dart',
|
||||
'packages/flutter/test/widgets/form_test.dart',
|
||||
'packages/flutter/test/widgets/implicit_semantics_test.dart',
|
||||
'packages/flutter/test/widgets/shrink_wrapping_viewport_test.dart',
|
||||
};
|
||||
|
||||
/// These Cupertino tests are known to have cross imports. These cross imports
|
||||
@ -341,7 +281,6 @@ class TestsCrossImportChecker {
|
||||
'packages/flutter/test/cupertino/magnifier_test.dart',
|
||||
'packages/flutter/test/cupertino/text_field_restoration_test.dart',
|
||||
'packages/flutter/test/cupertino/sheet_test.dart',
|
||||
'packages/flutter/test/cupertino/action_sheet_test.dart',
|
||||
'packages/flutter/test/cupertino/form_row_test.dart',
|
||||
'packages/flutter/test/cupertino/colors_test.dart',
|
||||
'packages/flutter/test/cupertino/text_form_field_row_restoration_test.dart',
|
||||
|
||||
@ -11,7 +11,6 @@ import 'dart:ui';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
@ -1845,9 +1844,8 @@ void main() {
|
||||
await tester.tap(find.text('Go'));
|
||||
await tester.pump();
|
||||
|
||||
// The inherited ScrollBehavior should not apply Scrollbars since they are
|
||||
// The inherited ScrollBehavior should not apply scrollbars since they are
|
||||
// already built in to the widget.
|
||||
expect(find.byType(Scrollbar), findsNothing);
|
||||
expect(find.byType(RawScrollbar), findsNothing);
|
||||
// Built in CupertinoScrollbars should only number 2: one for the actions,
|
||||
// one for the content.
|
||||
@ -2450,7 +2448,7 @@ void main() {
|
||||
|
||||
tester.binding.focusManager.highlightStrategy = FocusHighlightStrategy.alwaysTraditional;
|
||||
|
||||
const Color focusColor = Colors.orange;
|
||||
const focusColor = Color(0xffffaaaa);
|
||||
|
||||
final Color defaultDarkFocusColor = HSLColor.fromColor(
|
||||
focusColor.withOpacity(kCupertinoButtonTintedOpacityDark),
|
||||
|
||||
@ -579,6 +579,8 @@ void main() {
|
||||
debugBrightnessOverride = null;
|
||||
});
|
||||
|
||||
// TODO(justinmc): Cupertino tests should not import Material.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
testWidgets('CupertinoApp creates a Material theme with colors based off of Cupertino theme', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
|
||||
@ -532,6 +532,8 @@ void main() {
|
||||
expect(color.value, dynamicColor.darkHighContrastElevatedColor.value);
|
||||
});
|
||||
|
||||
// TODO(justinmc): Don't test Material interactions in Cupertino tests.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
group('MaterialApp:', () {
|
||||
Color? color;
|
||||
setUp(() {
|
||||
|
||||
@ -2140,6 +2140,8 @@ void main() {
|
||||
handle.dispose();
|
||||
});
|
||||
|
||||
// TODO(justinmc): Don't test Material interactions in Cupertino tests.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
testWidgets('DatePicker adapts to MaterialApp dark mode', (WidgetTester tester) async {
|
||||
Widget buildDatePicker(Brightness brightness) {
|
||||
return MaterialApp(
|
||||
@ -2167,6 +2169,8 @@ void main() {
|
||||
expect(paragraph.text.style!.color.toString().contains('UNRESOLVED'), isFalse);
|
||||
});
|
||||
|
||||
// TODO(justinmc): Don't test Material interactions in Cupertino tests.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
testWidgets('TimerPicker adapts to MaterialApp dark mode', (WidgetTester tester) async {
|
||||
Widget buildTimerPicker(Brightness brightness) {
|
||||
return MaterialApp(
|
||||
|
||||
@ -1846,9 +1846,8 @@ void main() {
|
||||
await tester.tap(find.text('Go'));
|
||||
await tester.pump();
|
||||
|
||||
// The inherited ScrollBehavior should not apply Scrollbars since they are
|
||||
// The inherited ScrollBehavior should not apply scrollbars since they are
|
||||
// already built in to the widget.
|
||||
expect(find.byType(Scrollbar), findsNothing);
|
||||
expect(find.byType(RawScrollbar), findsNothing);
|
||||
// Built in CupertinoScrollbars should only number 2: one for the actions,
|
||||
// one for the content.
|
||||
|
||||
@ -148,6 +148,8 @@ void main() {
|
||||
expect(errorTextStyle.style.color, CupertinoColors.destructiveRed);
|
||||
});
|
||||
|
||||
// TODO(justinmc): Don't test Material interactions in Cupertino tests.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
testWidgets('CupertinoFormRow adapts to MaterialApp dark mode', (WidgetTester tester) async {
|
||||
const Widget prefix = Text('Prefix');
|
||||
const Widget helper = Text('Helper');
|
||||
|
||||
@ -697,6 +697,8 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
// TODO(justinmc): Don't test Material interactions in Cupertino tests.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
testWidgets('Picker adapts to MaterialApp dark mode', (WidgetTester tester) async {
|
||||
Widget buildCupertinoPicker(Brightness brightness) {
|
||||
return MaterialApp(
|
||||
|
||||
@ -555,7 +555,6 @@ void main() {
|
||||
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
|
||||
_LongCupertinoLocalizations.delegate,
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
home: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
|
||||
@ -4,16 +4,18 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
const red = Color(0xffff0000);
|
||||
|
||||
testWidgets('ImageFiltered avoids repainting child as it animates', (WidgetTester tester) async {
|
||||
RenderTestObject.paintCount = 0;
|
||||
await tester.pumpWidget(
|
||||
ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ImageFiltered(
|
||||
imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||
child: const TestWidget(),
|
||||
@ -25,7 +27,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ImageFiltered(
|
||||
imageFilter: ImageFilter.blur(sigmaX: 6, sigmaY: 6),
|
||||
child: const TestWidget(),
|
||||
|
||||
@ -2,11 +2,13 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
const red = Color(0xffff0000);
|
||||
|
||||
testWidgets('RenderAnimatedOpacityMixin does not drop layer when animating to 1', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
@ -19,7 +21,7 @@ void main() {
|
||||
final opacityTween = Tween<double>(begin: 0, end: 1);
|
||||
await tester.pumpWidget(
|
||||
ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: FadeTransition(opacity: controller.drive(opacityTween), child: const TestWidget()),
|
||||
),
|
||||
);
|
||||
@ -55,7 +57,7 @@ void main() {
|
||||
final opacityTween = Tween<double>(begin: 0, end: 0.99); // Layer is dropped at 1
|
||||
await tester.pumpWidget(
|
||||
ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: FadeTransition(opacity: controller.drive(opacityTween), child: const TestWidget()),
|
||||
),
|
||||
);
|
||||
@ -92,7 +94,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: FadeTransition(opacity: controller.drive(opacityTween), child: const TestWidget()),
|
||||
),
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
@ -49,6 +49,9 @@ class InvalidDidUpdateWidgetLifecycleWidgetState
|
||||
}
|
||||
|
||||
void main() {
|
||||
const red = Color(0xffff0000);
|
||||
const green = Color(0xff00ff00);
|
||||
|
||||
testWidgets(
|
||||
'async onInit throws FlutterError',
|
||||
experimentalLeakTesting: LeakTesting.settings
|
||||
@ -65,8 +68,8 @@ void main() {
|
||||
experimentalLeakTesting: LeakTesting.settings
|
||||
.withIgnoredAll(), // leaking by design because of exception
|
||||
(WidgetTester tester) async {
|
||||
await tester.pumpWidget(const InvalidDidUpdateWidgetLifecycleWidget(color: Colors.green));
|
||||
await tester.pumpWidget(const InvalidDidUpdateWidgetLifecycleWidget(color: Colors.red));
|
||||
await tester.pumpWidget(const InvalidDidUpdateWidgetLifecycleWidget(color: green));
|
||||
await tester.pumpWidget(const InvalidDidUpdateWidgetLifecycleWidget(color: red));
|
||||
|
||||
expect(tester.takeException(), isFlutterError);
|
||||
},
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import 'dart:developer' as developer;
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:fake_async/fake_async.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
// This file is for tests for WidgetsBinding that require a `LiveTestWidgetsFlutterBinding`.
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
@Tags(<String>['reduced-test-set'])
|
||||
library;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'test_border.dart' show TestBorder;
|
||||
@ -58,6 +58,11 @@ class NotifyClipper<T> extends CustomClipper<T> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
const black = Color(0xff000000);
|
||||
const white = Color(0xffffffff);
|
||||
const red = Color(0xffff0000);
|
||||
const blue = Color(0xff0000ff);
|
||||
|
||||
testWidgets('ClipRect with a FittedBox child sized to zero works with semantics', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
@ -379,7 +384,7 @@ void main() {
|
||||
Center(
|
||||
child: RepaintBoundary(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(100.0),
|
||||
child: SizedBox(
|
||||
@ -389,13 +394,11 @@ void main() {
|
||||
angle: 1.0, // radians
|
||||
child: ClipRect(
|
||||
child: ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: RepaintBoundary(
|
||||
child: Center(
|
||||
child: Container(color: Colors.black, height: 10.0, width: 10.0),
|
||||
),
|
||||
child: Center(child: Container(color: black, height: 10.0, width: 10.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -421,14 +424,14 @@ void main() {
|
||||
left: 0.0,
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
child: ClipRect(child: Container(color: Colors.blue)),
|
||||
child: ClipRect(child: Container(color: blue)),
|
||||
),
|
||||
Positioned(
|
||||
top: 50.0,
|
||||
left: 50.0,
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
child: Transform.rotate(angle: 1.0, child: Container(color: Colors.red)),
|
||||
child: Transform.rotate(angle: 1.0, child: Container(color: red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -445,7 +448,7 @@ void main() {
|
||||
Center(
|
||||
child: RepaintBoundary(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(100.0),
|
||||
child: SizedBox(
|
||||
@ -461,13 +464,11 @@ void main() {
|
||||
bottomRight: Radius.elliptical(15.0, 6.0),
|
||||
),
|
||||
child: ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: RepaintBoundary(
|
||||
child: Center(
|
||||
child: Container(color: Colors.black, height: 10.0, width: 10.0),
|
||||
),
|
||||
child: Center(child: Container(color: black, height: 10.0, width: 10.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -487,7 +488,7 @@ void main() {
|
||||
Center(
|
||||
child: RepaintBoundary(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(100.0),
|
||||
child: SizedBox(
|
||||
@ -497,13 +498,11 @@ void main() {
|
||||
angle: 1.0, // radians
|
||||
child: ClipOval(
|
||||
child: ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: RepaintBoundary(
|
||||
child: Center(
|
||||
child: Container(color: Colors.black, height: 10.0, width: 10.0),
|
||||
),
|
||||
child: Center(child: Container(color: black, height: 10.0, width: 10.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -523,7 +522,7 @@ void main() {
|
||||
Center(
|
||||
child: RepaintBoundary(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(100.0),
|
||||
child: SizedBox(
|
||||
@ -538,13 +537,11 @@ void main() {
|
||||
),
|
||||
),
|
||||
child: ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: RepaintBoundary(
|
||||
child: Center(
|
||||
child: Container(color: Colors.black, height: 10.0, width: 10.0),
|
||||
),
|
||||
child: Center(child: Container(color: black, height: 10.0, width: 10.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -563,7 +560,7 @@ void main() {
|
||||
return Center(
|
||||
child: RepaintBoundary(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(100.0),
|
||||
child: SizedBox(
|
||||
@ -573,14 +570,12 @@ void main() {
|
||||
angle: 1.0, // radians
|
||||
child: PhysicalModel(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20.0)),
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
clipBehavior: clipBehavior,
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: RepaintBoundary(
|
||||
child: Center(
|
||||
child: Container(color: Colors.black, height: 10.0, width: 10.0),
|
||||
),
|
||||
child: Center(child: Container(color: black, height: 10.0, width: 10.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -625,7 +620,7 @@ void main() {
|
||||
Center(
|
||||
child: RepaintBoundary(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(100.0),
|
||||
child: SizedBox(
|
||||
@ -635,13 +630,11 @@ void main() {
|
||||
angle: 1.0, // radians
|
||||
child: PhysicalModel(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20.0)),
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: RepaintBoundary(
|
||||
child: Center(
|
||||
child: Container(color: Colors.black, height: 10.0, width: 10.0),
|
||||
),
|
||||
child: Center(child: Container(color: black, height: 10.0, width: 10.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -662,7 +655,7 @@ void main() {
|
||||
return Center(
|
||||
child: RepaintBoundary(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(100.0),
|
||||
child: SizedBox(
|
||||
@ -677,13 +670,11 @@ void main() {
|
||||
),
|
||||
),
|
||||
clipBehavior: clipBehavior,
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: RepaintBoundary(
|
||||
child: Center(
|
||||
child: Container(color: Colors.black, height: 10.0, width: 10.0),
|
||||
),
|
||||
child: Center(child: Container(color: black, height: 10.0, width: 10.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -726,7 +717,7 @@ void main() {
|
||||
Center(
|
||||
child: RepaintBoundary(
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(100.0),
|
||||
child: SizedBox(
|
||||
@ -740,13 +731,11 @@ void main() {
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.0)),
|
||||
),
|
||||
),
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: ColoredBox(
|
||||
color: Colors.white,
|
||||
color: white,
|
||||
child: RepaintBoundary(
|
||||
child: Center(
|
||||
child: Container(color: Colors.black, height: 10.0, width: 10.0),
|
||||
),
|
||||
child: Center(child: Container(color: black, height: 10.0, width: 10.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../impeller_test_helpers.dart';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@ -135,6 +135,8 @@ void main() {
|
||||
expect(tester.testTextInput.setClientArgs!['inputAction'], equals(serializedActionName));
|
||||
}
|
||||
|
||||
// TODO(justinmc): Widgets tests should not import Material.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
testWidgets(
|
||||
'Tapping the Live Text button calls onLiveTextInput',
|
||||
(WidgetTester tester) async {
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
/// On web, the context menu (aka toolbar) is provided by the browser.
|
||||
@ -135,7 +135,7 @@ class OverflowWidgetTextEditingController extends TextEditingController {
|
||||
style: style,
|
||||
children: <InlineSpan>[
|
||||
const TextSpan(text: 'Hi'),
|
||||
WidgetSpan(child: Container(color: Colors.redAccent, height: 100.0)),
|
||||
WidgetSpan(child: Container(color: const Color(0xffff0000), height: 100.0)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@ -3,11 +3,13 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
void main() {
|
||||
const red = Color(0xffff0000);
|
||||
|
||||
testWidgets('ErrorWidget displays actual error when throwing during build', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
@ -17,7 +19,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
Container(
|
||||
key: container,
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Builder(
|
||||
builder: (BuildContext context) {
|
||||
@ -53,7 +55,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
Container(
|
||||
key: container,
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
padding: const EdgeInsets.all(10),
|
||||
// This widget throws during build, which causes the construction of an
|
||||
// ErrorWidget with the build error. However, during construction of
|
||||
|
||||
@ -6,7 +6,6 @@ import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
import 'dart:ui' show FlutterView;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
class ScheduledFrameTrackingPlatformDispatcher extends TestPlatformDispatcher {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
const double kHeight = 10.0;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
@ -28,7 +28,7 @@ void main() {
|
||||
final rootWidget = RootWidget(
|
||||
child: View(
|
||||
view: FakeFlutterView(tester.view),
|
||||
child: const ColoredBox(color: Colors.orange),
|
||||
child: const ColoredBox(color: Color(0xfffff3e0)),
|
||||
),
|
||||
);
|
||||
tester.binding.attachToBuildOwner(rootWidget);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'multi_view_testing.dart';
|
||||
|
||||
@ -2,8 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'multi_view_testing.dart';
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'multi_view_testing.dart';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
typedef OnObservation = void Function(Route<dynamic>? route, Route<dynamic>? previousRoute);
|
||||
|
||||
|
||||
@ -2,18 +2,20 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
const red = Color(0xffff0000);
|
||||
|
||||
testWidgets('RenderOpacity avoids repainting and does not drop layer at fully opaque', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
RenderTestObject.paintCount = 0;
|
||||
await tester.pumpWidget(
|
||||
const ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: Opacity(opacity: 0.0, child: TestWidget()),
|
||||
),
|
||||
);
|
||||
@ -22,7 +24,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
const ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: Opacity(opacity: 0.1, child: TestWidget()),
|
||||
),
|
||||
);
|
||||
@ -31,7 +33,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
const ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: Opacity(opacity: 1, child: TestWidget()),
|
||||
),
|
||||
);
|
||||
@ -46,7 +48,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
const ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: Opacity(opacity: 0.5, child: TestWidget()),
|
||||
),
|
||||
);
|
||||
@ -55,7 +57,7 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
const ColoredBox(
|
||||
color: Colors.red,
|
||||
color: red,
|
||||
child: Opacity(opacity: 0.0, child: TestWidget()),
|
||||
),
|
||||
);
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/src/foundation/constants.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
class StateMarker extends StatefulWidget {
|
||||
@ -47,6 +47,8 @@ class DeactivateLoggerState extends State<DeactivateLogger> {
|
||||
}
|
||||
|
||||
void main() {
|
||||
const green = Color(0xff00ff00);
|
||||
|
||||
testWidgets('can reparent state', (WidgetTester tester) async {
|
||||
final GlobalKey left = GlobalKey();
|
||||
final GlobalKey right = GlobalKey();
|
||||
@ -57,11 +59,11 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
children: <Widget>[
|
||||
ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: StateMarker(key: left),
|
||||
),
|
||||
ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: StateMarker(key: right, child: grandchild),
|
||||
),
|
||||
],
|
||||
@ -83,11 +85,11 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
children: <Widget>[
|
||||
ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: StateMarker(key: right, child: newGrandchild),
|
||||
),
|
||||
ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: StateMarker(key: left),
|
||||
),
|
||||
],
|
||||
@ -107,7 +109,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: StateMarker(key: left, child: Container()),
|
||||
),
|
||||
),
|
||||
@ -166,7 +168,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
Center(
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: StateMarker(key: left, child: Container()),
|
||||
),
|
||||
),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
// This is a regression test for https://github.com/flutter/flutter/issues/5840.
|
||||
@ -95,6 +95,8 @@ void main() {
|
||||
var layoutBuilderChild = keyedWidget;
|
||||
Widget deepChild = Container();
|
||||
|
||||
const green = Color(0xff00ff00);
|
||||
|
||||
await tester.pumpWidget(
|
||||
MediaQuery(
|
||||
data: MediaQueryData.fromView(tester.view),
|
||||
@ -112,17 +114,17 @@ void main() {
|
||||
},
|
||||
),
|
||||
ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
childSetState = setState;
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
@ -172,7 +172,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: Center(
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: const Color(0xff00ff00),
|
||||
child: IntrinsicHeight(
|
||||
child: RichText(
|
||||
text: const TextSpan(
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@ -753,6 +753,9 @@ void main() {
|
||||
expect(secondaryAnimationPageOne.parent, kAlwaysDismissedAnimation);
|
||||
});
|
||||
|
||||
// TODO(justinmc): Widgets tests should not import Material/Cupertino. This
|
||||
// test can probably go into Cupertino with a CupertinoApp.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
testWidgets(
|
||||
'delegated transitions are removed when secondary animation is dismissed and next route is removed',
|
||||
(WidgetTester tester) async {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
import 'dart:collection';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'sensitive_content_utils.dart';
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'sensitive_content_utils.dart';
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
import 'dart:async' show Completer;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'sensitive_content_utils.dart';
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import '../rendering/rendering_tester.dart' show TestClipPaintingContext;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
const double VIEWPORT_HEIGHT = 500;
|
||||
|
||||
@ -2,15 +2,15 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('SliverFillViewport control test', (WidgetTester tester) async {
|
||||
final children = List<Widget>.generate(20, (int i) {
|
||||
return ColoredBox(
|
||||
color: Colors.green,
|
||||
color: const Color(0xff00ff00),
|
||||
child: Text('$i', textDirection: TextDirection.ltr),
|
||||
);
|
||||
});
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
typedef Logger = void Function(String caller);
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
@ -667,10 +667,7 @@ void main() {
|
||||
final Animation<double> animation = Tween<double>(begin: 0.0, end: 1.0).animate(controller);
|
||||
final Widget widget = Localizations(
|
||||
locale: const Locale('en', 'us'),
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[
|
||||
DefaultWidgetsLocalizations.delegate,
|
||||
DefaultMaterialLocalizations.delegate,
|
||||
],
|
||||
delegates: const <LocalizationsDelegate<dynamic>>[DefaultWidgetsLocalizations.delegate],
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: MediaQuery(
|
||||
|
||||
@ -4,19 +4,23 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
import 'multi_view_testing.dart';
|
||||
|
||||
void main() {
|
||||
const red = Color(0xffffff00);
|
||||
const green = Color(0xff00ff00);
|
||||
const yellow = Color(0xfffffde7);
|
||||
|
||||
testWidgets('Providing a RenderObjectWidget directly to the RootWidget fails', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
// No render tree exists to attach the RenderObjectWidget to.
|
||||
await tester.pumpWidget(wrapWithView: false, const ColoredBox(color: Colors.red));
|
||||
await tester.pumpWidget(wrapWithView: false, const ColoredBox(color: red));
|
||||
|
||||
expect(
|
||||
tester.takeException(),
|
||||
@ -33,7 +37,7 @@ void main() {
|
||||
testWidgets('Moving a RenderObjectWidget to the RootWidget via GlobalKey fails', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
final Widget globalKeyedWidget = ColoredBox(key: GlobalKey(), color: Colors.red);
|
||||
final Widget globalKeyedWidget = ColoredBox(key: GlobalKey(), color: red);
|
||||
|
||||
await tester.pumpWidget(wrapWithView: false, View(view: tester.view, child: globalKeyedWidget));
|
||||
expect(tester.takeException(), isNull);
|
||||
@ -102,7 +106,7 @@ void main() {
|
||||
final Widget globalKeyedView = View(
|
||||
key: GlobalKey(),
|
||||
view: FakeView(tester.view),
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
);
|
||||
|
||||
await tester.pumpWidget(wrapWithView: false, globalKeyedView);
|
||||
@ -126,7 +130,7 @@ void main() {
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
ViewAnchor(
|
||||
view: const ColoredBox(color: Colors.red),
|
||||
view: const ColoredBox(color: red),
|
||||
child: Container(),
|
||||
),
|
||||
);
|
||||
@ -146,7 +150,7 @@ void main() {
|
||||
testWidgets(
|
||||
'A RenderObject cannot be moved into the view property of a ViewAnchor via GlobalKey',
|
||||
(WidgetTester tester) async {
|
||||
final Widget globalKeyedWidget = ColoredBox(key: GlobalKey(), color: Colors.red);
|
||||
final Widget globalKeyedWidget = ColoredBox(key: GlobalKey(), color: red);
|
||||
|
||||
await tester.pumpWidget(ViewAnchor(child: globalKeyedWidget));
|
||||
expect(tester.takeException(), isNull);
|
||||
@ -216,7 +220,7 @@ void main() {
|
||||
) async {
|
||||
final Widget globalKeyView = View(
|
||||
view: FakeView(tester.view),
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -289,7 +293,7 @@ void main() {
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
wrapWithView: false,
|
||||
const ViewCollection(views: <Widget>[ColoredBox(color: Colors.red)]),
|
||||
const ViewCollection(views: <Widget>[ColoredBox(color: red)]),
|
||||
);
|
||||
|
||||
expect(
|
||||
@ -310,12 +314,12 @@ void main() {
|
||||
final Widget greenView = View(
|
||||
key: GlobalKey(debugLabel: 'green'),
|
||||
view: tester.view,
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
);
|
||||
final Widget redView = View(
|
||||
key: GlobalKey(debugLabel: 'red'),
|
||||
view: FakeView(tester.view),
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
@ -369,21 +373,21 @@ void main() {
|
||||
views: <Widget>[
|
||||
View(
|
||||
view: greenView,
|
||||
child: ColoredBox(color: Colors.green, child: globalKeyChild),
|
||||
child: ColoredBox(color: green, child: globalKeyChild),
|
||||
),
|
||||
View(
|
||||
view: redView,
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.green), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(green), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsNothing,
|
||||
);
|
||||
final RenderObject boxWithGlobalKey = tester.renderObject(find.byKey(globalKeyChild.key!));
|
||||
@ -399,22 +403,22 @@ void main() {
|
||||
views: <Widget>[
|
||||
View(
|
||||
view: greenView,
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
),
|
||||
View(
|
||||
view: redView,
|
||||
child: ColoredBox(color: Colors.red, child: globalKeyChild),
|
||||
child: ColoredBox(color: red, child: globalKeyChild),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.green), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(green), matching: find.byType(SizedBox)),
|
||||
findsNothing,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.renderObject(find.byKey(globalKeyChild.key!)), equals(boxWithGlobalKey));
|
||||
@ -450,21 +454,21 @@ void main() {
|
||||
views: <Widget>[
|
||||
View(
|
||||
view: greenView,
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
),
|
||||
View(
|
||||
view: redView,
|
||||
child: ColoredBox(color: Colors.red, child: globalKeyChild),
|
||||
child: ColoredBox(color: red, child: globalKeyChild),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.green), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(green), matching: find.byType(SizedBox)),
|
||||
findsNothing,
|
||||
);
|
||||
final RenderObject boxWithGlobalKey = tester.renderObject(find.byKey(globalKeyChild.key!));
|
||||
@ -480,22 +484,22 @@ void main() {
|
||||
views: <Widget>[
|
||||
View(
|
||||
view: greenView,
|
||||
child: ColoredBox(color: Colors.green, child: globalKeyChild),
|
||||
child: ColoredBox(color: green, child: globalKeyChild),
|
||||
),
|
||||
View(
|
||||
view: redView,
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsNothing,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.green), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(green), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.renderObject(find.byKey(globalKeyChild.key!)), equals(boxWithGlobalKey));
|
||||
@ -521,22 +525,22 @@ void main() {
|
||||
View(
|
||||
key: greenKey,
|
||||
view: greenView,
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
),
|
||||
View(
|
||||
key: redKey,
|
||||
view: redView,
|
||||
child: ColoredBox(color: Colors.red, child: globalKeyChild),
|
||||
child: ColoredBox(color: red, child: globalKeyChild),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.green), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(green), matching: find.byType(SizedBox)),
|
||||
findsNothing,
|
||||
);
|
||||
final RenderObject boxWithGlobalKey = tester.renderObject(find.byKey(globalKeyChild.key!));
|
||||
@ -549,15 +553,15 @@ void main() {
|
||||
View(
|
||||
key: greenKey,
|
||||
view: greenView,
|
||||
child: ColoredBox(color: Colors.green, child: globalKeyChild),
|
||||
child: ColoredBox(color: green, child: globalKeyChild),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
expect(findsColoredBox(Colors.red), findsNothing);
|
||||
expect(findsColoredBox(red), findsNothing);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.green), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(green), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.renderObject(find.byKey(globalKeyChild.key!)), equals(boxWithGlobalKey));
|
||||
@ -579,22 +583,22 @@ void main() {
|
||||
View(
|
||||
key: greenKey,
|
||||
view: greenView,
|
||||
child: ColoredBox(color: Colors.green, child: globalKeyChild),
|
||||
child: ColoredBox(color: green, child: globalKeyChild),
|
||||
),
|
||||
View(
|
||||
key: redKey,
|
||||
view: redView,
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.green), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(green), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsNothing,
|
||||
);
|
||||
final RenderObject boxWithGlobalKey = tester.renderObject(find.byKey(globalKeyChild.key!));
|
||||
@ -607,15 +611,15 @@ void main() {
|
||||
View(
|
||||
key: redKey,
|
||||
view: redView,
|
||||
child: ColoredBox(color: Colors.red, child: globalKeyChild),
|
||||
child: ColoredBox(color: red, child: globalKeyChild),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
expect(findsColoredBox(Colors.green), findsNothing);
|
||||
expect(findsColoredBox(green), findsNothing);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(tester.renderObject(find.byKey(globalKeyChild.key!)), equals(boxWithGlobalKey));
|
||||
@ -642,7 +646,7 @@ void main() {
|
||||
key: viewKey,
|
||||
view: FakeView(tester.view),
|
||||
child: SizedBox(
|
||||
child: ColoredBox(key: childKey, color: Colors.green),
|
||||
child: ColoredBox(key: childKey, color: green),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
@ -658,7 +662,7 @@ void main() {
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
key: key1,
|
||||
child: ColoredBox(key: childKey, color: Colors.green),
|
||||
child: ColoredBox(key: childKey, color: green),
|
||||
),
|
||||
ViewAnchor(key: key2, child: const SizedBox()),
|
||||
ViewAnchor(
|
||||
@ -681,7 +685,7 @@ void main() {
|
||||
key: viewKey,
|
||||
view: FakeView(tester.view),
|
||||
child: SizedBox(
|
||||
child: ColoredBox(key: childKey, color: Colors.green),
|
||||
child: ColoredBox(key: childKey, color: green),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
@ -714,7 +718,7 @@ void main() {
|
||||
key: viewKey,
|
||||
view: FakeView(tester.view),
|
||||
child: SizedBox(
|
||||
child: ColoredBox(key: childKey, color: Colors.green),
|
||||
child: ColoredBox(key: childKey, color: green),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
@ -737,7 +741,7 @@ void main() {
|
||||
),
|
||||
SizedBox(
|
||||
key: key4,
|
||||
child: ColoredBox(key: childKey, color: Colors.green),
|
||||
child: ColoredBox(key: childKey, color: green),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -753,7 +757,7 @@ void main() {
|
||||
key: viewKey,
|
||||
view: FakeView(tester.view),
|
||||
child: SizedBox(
|
||||
child: ColoredBox(key: childKey, color: Colors.green),
|
||||
child: ColoredBox(key: childKey, color: green),
|
||||
),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
@ -773,26 +777,26 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: ViewAnchor(
|
||||
view: View(
|
||||
view: anchorView,
|
||||
child: ColoredBox(color: Colors.yellow, child: globalKeyChild),
|
||||
child: ColoredBox(color: yellow, child: globalKeyChild),
|
||||
),
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(findsColoredBox(Colors.green), findsOneWidget);
|
||||
expect(findsColoredBox(Colors.yellow), findsOneWidget);
|
||||
expect(findsColoredBox(green), findsOneWidget);
|
||||
expect(findsColoredBox(yellow), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.yellow), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(yellow), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(findsColoredBox(Colors.red), findsOneWidget);
|
||||
expect(findsColoredBox(red), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsNothing,
|
||||
);
|
||||
expect(find.byType(SizedBox), findsOneWidget);
|
||||
@ -800,21 +804,21 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: ViewAnchor(
|
||||
child: ColoredBox(color: Colors.red, child: globalKeyChild),
|
||||
child: ColoredBox(color: red, child: globalKeyChild),
|
||||
),
|
||||
),
|
||||
);
|
||||
expect(findsColoredBox(Colors.green), findsOneWidget);
|
||||
expect(findsColoredBox(Colors.yellow), findsNothing);
|
||||
expect(findsColoredBox(green), findsOneWidget);
|
||||
expect(findsColoredBox(yellow), findsNothing);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.yellow), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(yellow), matching: find.byType(SizedBox)),
|
||||
findsNothing,
|
||||
);
|
||||
expect(findsColoredBox(Colors.red), findsOneWidget);
|
||||
expect(findsColoredBox(red), findsOneWidget);
|
||||
expect(
|
||||
find.descendant(of: findsColoredBox(Colors.red), matching: find.byType(SizedBox)),
|
||||
find.descendant(of: findsColoredBox(red), matching: find.byType(SizedBox)),
|
||||
findsOneWidget,
|
||||
);
|
||||
expect(find.byType(SizedBox), findsOneWidget);
|
||||
@ -828,23 +832,23 @@ void main() {
|
||||
|
||||
await tester.pumpWidget(
|
||||
ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: ViewAnchor(
|
||||
view: View(
|
||||
view: anchorView,
|
||||
child: const ColoredBox(color: Colors.yellow),
|
||||
child: const ColoredBox(color: yellow),
|
||||
),
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final RenderObject box = tester.renderObject(findsColoredBox(Colors.yellow));
|
||||
final RenderObject box = tester.renderObject(findsColoredBox(yellow));
|
||||
|
||||
await tester.pumpWidget(
|
||||
const ColoredBox(
|
||||
color: Colors.green,
|
||||
child: ViewAnchor(child: ColoredBox(color: Colors.red)),
|
||||
color: green,
|
||||
child: ViewAnchor(child: ColoredBox(color: red)),
|
||||
),
|
||||
);
|
||||
|
||||
@ -863,19 +867,19 @@ void main() {
|
||||
views: <Widget>[
|
||||
View(
|
||||
view: redView,
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
),
|
||||
View(
|
||||
view: greenView,
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
expect(findsColoredBox(Colors.green), findsOneWidget);
|
||||
expect(findsColoredBox(Colors.red), findsOneWidget);
|
||||
final RenderObject box = tester.renderObject(findsColoredBox(Colors.green));
|
||||
expect(findsColoredBox(green), findsOneWidget);
|
||||
expect(findsColoredBox(red), findsOneWidget);
|
||||
final RenderObject box = tester.renderObject(findsColoredBox(green));
|
||||
|
||||
await tester.pumpWidget(
|
||||
wrapWithView: false,
|
||||
@ -883,14 +887,14 @@ void main() {
|
||||
views: <Widget>[
|
||||
View(
|
||||
view: redView,
|
||||
child: const ColoredBox(color: Colors.red),
|
||||
child: const ColoredBox(color: red),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
expect(findsColoredBox(Colors.green), findsNothing);
|
||||
expect(findsColoredBox(Colors.red), findsOneWidget);
|
||||
expect(findsColoredBox(green), findsNothing);
|
||||
expect(findsColoredBox(red), findsOneWidget);
|
||||
expect(box.debugDisposed, isTrue);
|
||||
});
|
||||
|
||||
@ -916,7 +920,7 @@ void main() {
|
||||
testWidgets('ViewAnchor with View can be wrapped and unwrapped', (WidgetTester tester) async {
|
||||
final Widget viewAnchor = ViewAnchor(
|
||||
view: View(view: FakeView(tester.view), child: const SizedBox()),
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
);
|
||||
|
||||
await tester.pumpWidget(viewAnchor);
|
||||
@ -924,7 +928,7 @@ void main() {
|
||||
final List<RenderObject> renderViews = tester.renderObjectList(find.byType(View)).toList();
|
||||
final RenderObject renderSizedBox = tester.renderObject(find.byType(SizedBox));
|
||||
|
||||
await tester.pumpWidget(ColoredBox(color: Colors.yellow, child: viewAnchor));
|
||||
await tester.pumpWidget(ColoredBox(color: yellow, child: viewAnchor));
|
||||
|
||||
expect(tester.renderObjectList(find.byType(View)), renderViews);
|
||||
expect(tester.renderObject(find.byType(SizedBox)), same(renderSizedBox));
|
||||
|
||||
@ -4,15 +4,17 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart';
|
||||
|
||||
import 'multi_view_testing.dart';
|
||||
|
||||
void main() {
|
||||
const green = Color(0xff00ff00);
|
||||
|
||||
testWidgets('Widgets running with runApp can find View', (WidgetTester tester) async {
|
||||
FlutterView? viewOf;
|
||||
FlutterView? viewMaybeOf;
|
||||
@ -197,7 +199,7 @@ void main() {
|
||||
ViewAnchor(
|
||||
view: View(
|
||||
view: FakeView(tester.view),
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
),
|
||||
@ -311,7 +313,7 @@ void main() {
|
||||
return ViewAnchor(
|
||||
view: View(
|
||||
view: FakeView(tester.view),
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
),
|
||||
child: const SizedBox(),
|
||||
);
|
||||
@ -411,7 +413,7 @@ void main() {
|
||||
return View(key: viewKey, view: FakeView(tester.view), child: const SizedBox());
|
||||
},
|
||||
),
|
||||
child: const ColoredBox(color: Colors.green),
|
||||
child: const ColoredBox(color: green),
|
||||
),
|
||||
);
|
||||
|
||||
@ -428,7 +430,7 @@ void main() {
|
||||
expect(children, contains(rawViewOwner));
|
||||
|
||||
// Remove that View from the tree.
|
||||
await tester.pumpWidget(const ViewAnchor(child: ColoredBox(color: Colors.green)));
|
||||
await tester.pumpWidget(const ViewAnchor(child: ColoredBox(color: green)));
|
||||
|
||||
expect(rawView.owner, isNull);
|
||||
expect(RendererBinding.instance.renderViews, isNot(contains(rawView)));
|
||||
|
||||
@ -5457,6 +5457,8 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
|
||||
expect(crossAxisAlignment, equals('start'));
|
||||
});
|
||||
|
||||
// TODO(justinmc): Don't test Cupertino interactions in Widgets tests.
|
||||
// https://github.com/flutter/flutter/issues/177028
|
||||
testWidgets('ext.flutter.inspector.getLayoutExplorerNode does not throw StackOverflowError', (
|
||||
WidgetTester tester,
|
||||
) async {
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void verify(WidgetTester tester, List<Offset> answerKey) {
|
||||
@ -15,6 +15,8 @@ void verify(WidgetTester tester, List<Offset> answerKey) {
|
||||
}
|
||||
|
||||
void main() {
|
||||
const green = Color(0xff00ff00);
|
||||
|
||||
testWidgets('Basic Wrap test (LTR)', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const Wrap(
|
||||
@ -976,7 +978,7 @@ void main() {
|
||||
child: Center(
|
||||
child: IntrinsicHeight(
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: Wrap(
|
||||
children: <Widget>[
|
||||
Text('Start', style: TextStyle(height: 1.0, fontSize: 16)),
|
||||
@ -1004,7 +1006,7 @@ void main() {
|
||||
child: Center(
|
||||
child: IntrinsicWidth(
|
||||
child: ColoredBox(
|
||||
color: Colors.green,
|
||||
color: green,
|
||||
child: Wrap(
|
||||
direction: Axis.vertical,
|
||||
children: <Widget>[
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user