support DivKit network tests

commit_hash:3cfdf8850ecef6debbfd7b263dd1a5f2889acbb0
This commit is contained in:
nt4f04und
2024-09-30 18:05:02 +03:00
parent c9738a7a4d
commit ccf26f568e
81 changed files with 555 additions and 235 deletions
+71 -1
View File
@@ -10769,9 +10769,12 @@
"client/flutter/divkit/test/goldens/framework/enhanced_file_comparator.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/enhanced_file_comparator.dart",
"client/flutter/divkit/test/goldens/framework/flutter_test_config.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/flutter_test_config.dart",
"client/flutter/divkit/test/goldens/framework/framework.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/framework.dart",
"client/flutter/divkit/test/goldens/framework/golden_test_for_ci.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/golden_test_for_ci.dart",
"client/flutter/divkit/test/goldens/framework/mock_images/enable_http.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/mock_images/enable_http.dart",
"client/flutter/divkit/test/goldens/framework/mock_images/mock_and_load_network_images.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/mock_images/mock_and_load_network_images.dart",
"client/flutter/divkit/test/goldens/framework/mock_images/mock_images_utils.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/mock_images/mock_images_utils.dart",
"client/flutter/divkit/test/goldens/framework/screen_matches_golden.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/screen_matches_golden.dart",
"client/flutter/divkit/test/goldens/framework/screen_settings.dart":"divkit/public/client/flutter/divkit/test/goldens/framework/screen_settings.dart",
"client/flutter/divkit/test/goldens/goldens/div-background.scale_stretch.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-background.scale_stretch.png",
"client/flutter/divkit/test/goldens/goldens/div-container.alignment-center-with-paddings.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.alignment-center-with-paddings.png",
"client/flutter/divkit/test/goldens/goldens/div-container.alpha-and-background.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.alpha-and-background.png",
"client/flutter/divkit/test/goldens/goldens/div-container.aspect.fixed-width-wrap-layout_mode-vertical.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.aspect.fixed-width-wrap-layout_mode-vertical.png",
@@ -10808,20 +10811,36 @@
"client/flutter/divkit/test/goldens/goldens/div-container.fixed-size-with-paddings.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.fixed-size-with-paddings.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-match-parent-inside-wrap-content-on-both-axis.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-match-parent-inside-wrap-content-on-both-axis.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-alignments.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-alignments.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-bottom-horizontal-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-bottom-horizontal-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-bottom-vertical-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-bottom-vertical-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-center-horizontal-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-center-horizontal-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-center-vertical-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-center-vertical-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-fixed-child.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-fixed-child.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-min-size.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-min-size.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-space-around-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-space-around-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-space-between-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-space-between-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-space-evenly-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation-space-evenly-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.horizontal-orientation.png",
"client/flutter/divkit/test/goldens/goldens/div-container.match-parent-lesser-than-paddings.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.match-parent-lesser-than-paddings.png",
"client/flutter/divkit/test/goldens/goldens/div-container.match-parent-with-padding.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.match-parent-with-padding.png",
"client/flutter/divkit/test/goldens/goldens/div-container.no-scale-background.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.no-scale-background.png",
"client/flutter/divkit/test/goldens/goldens/div-container.overlap-container-child-wrap-containers.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.overlap-container-child-wrap-containers.png",
"client/flutter/divkit/test/goldens/goldens/div-container.overlap-orientation-min-size.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.overlap-orientation-min-size.png",
"client/flutter/divkit/test/goldens/goldens/div-container.overlap-orientation.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.overlap-orientation.png",
"client/flutter/divkit/test/goldens/goldens/div-container.overlap-with-match-parent-child.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.overlap-with-match-parent-child.png",
"client/flutter/divkit/test/goldens/goldens/div-container.overlap-with-match-parent-in-match-parent.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.overlap-with-match-parent-in-match-parent.png",
"client/flutter/divkit/test/goldens/goldens/div-container.size_unit.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.size_unit.png",
"client/flutter/divkit/test/goldens/goldens/div-container.space-evenly-alignment-with-gone-items.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.space-evenly-alignment-with-gone-items.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-composite-background.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-composite-background.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-custom-margins.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-custom-margins.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-custom-paddings.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-custom-paddings.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-center-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-center-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-fixed-height.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-fixed-height.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-match_parent-child.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-match_parent-child.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-min-size.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-min-size.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-space-around-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-space-around-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-space-between-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-space-between-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-space-evenly-alignment.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation-space-evenly-alignment.png",
"client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.vertical-orientation.png",
"client/flutter/divkit/test/goldens/goldens/div-container.wrap.baseline.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.wrap.baseline.png",
"client/flutter/divkit/test/goldens/goldens/div-container.wrap.horizontal-orientation-alignments-center-bottom.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-container.wrap.horizontal-orientation-alignments-center-bottom.png",
@@ -10881,6 +10900,40 @@
"client/flutter/divkit/test/goldens/goldens/div-gallery.horizontal-grid-gallery-wrapped-item-spacing.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-gallery.horizontal-grid-gallery-wrapped-item-spacing.png",
"client/flutter/divkit/test/goldens/goldens/div-gallery.rtl_gallery.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-gallery.rtl_gallery.png",
"client/flutter/divkit/test/goldens/goldens/div-gallery.vertical-gallery-height-wrap-content.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-gallery.vertical-gallery-height-wrap-content.png",
"client/flutter/divkit/test/goldens/goldens/div-image.aspect-fixed.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.aspect-fixed.png",
"client/flutter/divkit/test/goldens/goldens/div-image.aspect-match_parent.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.aspect-match_parent.png",
"client/flutter/divkit/test/goldens/goldens/div-image.aspect-wrap_content.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.aspect-wrap_content.png",
"client/flutter/divkit/test/goldens/goldens/div-image.blur-with-big-radius.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.blur-with-big-radius.png",
"client/flutter/divkit/test/goldens/goldens/div-image.blur.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.blur.png",
"client/flutter/divkit/test/goldens/goldens/div-image.border-with-stroke.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.border-with-stroke.png",
"client/flutter/divkit/test/goldens/goldens/div-image.composite-background.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.composite-background.png",
"client/flutter/divkit/test/goldens/goldens/div-image.content-horizontal-alignment-end.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.content-horizontal-alignment-end.png",
"client/flutter/divkit/test/goldens/goldens/div-image.content-horizontal-alignment-start.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.content-horizontal-alignment-start.png",
"client/flutter/divkit/test/goldens/goldens/div-image.corner-radius.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.corner-radius.png",
"client/flutter/divkit/test/goldens/goldens/div-image.corners_radius.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.corners_radius.png",
"client/flutter/divkit/test/goldens/goldens/div-image.custom-alpha.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.custom-alpha.png",
"client/flutter/divkit/test/goldens/goldens/div-image.custom-height.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.custom-height.png",
"client/flutter/divkit/test/goldens/goldens/div-image.custom-margins.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.custom-margins.png",
"client/flutter/divkit/test/goldens/goldens/div-image.custom-paddings.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.custom-paddings.png",
"client/flutter/divkit/test/goldens/goldens/div-image.custom-tint-color.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.custom-tint-color.png",
"client/flutter/divkit/test/goldens/goldens/div-image.custom-width.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.custom-width.png",
"client/flutter/divkit/test/goldens/goldens/div-image.no_scale.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.no_scale.png",
"client/flutter/divkit/test/goldens/goldens/div-image.no_scale_bottom_right.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.no_scale_bottom_right.png",
"client/flutter/divkit/test/goldens/goldens/div-image.no_scale_top_left.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.no_scale_top_left.png",
"client/flutter/divkit/test/goldens/goldens/div-image.rtl-filter.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.rtl-filter.png",
"client/flutter/divkit/test/goldens/goldens/div-image.rtl-image-content-horizontal-alignment-end.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.rtl-image-content-horizontal-alignment-end.png",
"client/flutter/divkit/test/goldens/goldens/div-image.rtl-image-content-horizontal-alignment-start.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.rtl-image-content-horizontal-alignment-start.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_fill.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_fill.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_fill_bottom.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_fill_bottom.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_fill_right.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_fill_right.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_fit.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_fit.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_fit_bottom.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_fit_bottom.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_fit_left.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_fit_left.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_fit_right.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_fit_right.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_fit_top.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_fit_top.png",
"client/flutter/divkit/test/goldens/goldens/div-image.scale_stretch.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.scale_stretch.png",
"client/flutter/divkit/test/goldens/goldens/div-image.shadow.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.shadow.png",
"client/flutter/divkit/test/goldens/goldens/div-image.wrap-content-width-by-height.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-image.wrap-content-width-by-height.png",
"client/flutter/divkit/test/goldens/goldens/div-input.all-attributes.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-input.all-attributes.png",
"client/flutter/divkit/test/goldens/goldens/div-input.min-height.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-input.min-height.png",
"client/flutter/divkit/test/goldens/goldens/div-input.rtl-input.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-input.rtl-input.png",
@@ -10905,6 +10958,10 @@
"client/flutter/divkit/test/goldens/goldens/div-pager.vertical-pager-match-parent-width-with-paddings.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-pager.vertical-pager-match-parent-width-with-paddings.png",
"client/flutter/divkit/test/goldens/goldens/div-pager.vertical-pager-resizable-height.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-pager.vertical-pager-resizable-height.png",
"client/flutter/divkit/test/goldens/goldens/div-pager.vertical-pager-wrap-content-width-with-paddings.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-pager.vertical-pager-wrap-content-width-with-paddings.png",
"client/flutter/divkit/test/goldens/goldens/div-shadow.shadow-with-alpha.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-shadow.shadow-with-alpha.png",
"client/flutter/divkit/test/goldens/goldens/div-shadow.shadow-with-blur.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-shadow.shadow-with-blur.png",
"client/flutter/divkit/test/goldens/goldens/div-shadow.shadow-with-color.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-shadow.shadow-with-color.png",
"client/flutter/divkit/test/goldens/goldens/div-shadow.shadow-with-offset.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-shadow.shadow-with-offset.png",
"client/flutter/divkit/test/goldens/goldens/div-size.wrap-content.text-min-max-constrained-false-layout-mode-wrap-horizontal.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-size.wrap-content.text-min-max-constrained-false-layout-mode-wrap-horizontal.png",
"client/flutter/divkit/test/goldens/goldens/div-size.wrap-content.text-min-max-constrained-false-layout-mode-wrap-vertical.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-size.wrap-content.text-min-max-constrained-false-layout-mode-wrap-vertical.png",
"client/flutter/divkit/test/goldens/goldens/div-size.wrap-content.text-min-max-constrained-false-vertical.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-size.wrap-content.text-min-max-constrained-false-vertical.png",
@@ -10913,6 +10970,7 @@
"client/flutter/divkit/test/goldens/goldens/div-text.auto-ellipsize-by-max-lines.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.auto-ellipsize-by-max-lines.png",
"client/flutter/divkit/test/goldens/goldens/div-text.auto-ellipsize-with-line-height-less-than-font-size.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.auto-ellipsize-with-line-height-less-than-font-size.png",
"client/flutter/divkit/test/goldens/goldens/div-text.border-with-stroke.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.border-with-stroke.png",
"client/flutter/divkit/test/goldens/goldens/div-text.composite-background.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.composite-background.png",
"client/flutter/divkit/test/goldens/goldens/div-text.corner-radius-clamp.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.corner-radius-clamp.png",
"client/flutter/divkit/test/goldens/goldens/div-text.corner-radius.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.corner-radius.png",
"client/flutter/divkit/test/goldens/goldens/div-text.corners_radius.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.corners_radius.png",
@@ -10932,6 +10990,7 @@
"client/flutter/divkit/test/goldens/goldens/div-text.font_weight.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.font_weight.png",
"client/flutter/divkit/test/goldens/goldens/div-text.gradient-background.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.gradient-background.png",
"client/flutter/divkit/test/goldens/goldens/div-text.gradient-color-text.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.gradient-color-text.png",
"client/flutter/divkit/test/goldens/goldens/div-text.image-background.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.image-background.png",
"client/flutter/divkit/test/goldens/goldens/div-text.images_hyphenation.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.images_hyphenation.png",
"client/flutter/divkit/test/goldens/goldens/div-text.line-height.multi-line-text-with-image.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.line-height.multi-line-text-with-image.png",
"client/flutter/divkit/test/goldens/goldens/div-text.line-height.multi-line-text-with-text-size-ranges.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.line-height.multi-line-text-with-text-size-ranges.png",
@@ -10955,6 +11014,17 @@
"client/flutter/divkit/test/goldens/goldens/div-text.vertical-alignments.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.vertical-alignments.png",
"client/flutter/divkit/test/goldens/goldens/div-text.visibility-gone.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.visibility-gone.png",
"client/flutter/divkit/test/goldens/goldens/div-text.visibility-invisible.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-text.visibility-invisible.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_identity.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_identity.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_bottom_center.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_bottom_center.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_bottom_left_corner.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_bottom_left_corner.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_bottom_right_corner.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_bottom_right_corner.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_center.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_center.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_left_center.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_left_center.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_right_center.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_right_center.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_top_center.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_top_center.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_top_left_corner.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_top_left_corner.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_top_right_corner.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_45_around_top_right_corner.png",
"client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_90_around_center.png":"divkit/public/client/flutter/divkit/test/goldens/goldens/div-transform.transform_turn_90_around_center.png",
"client/flutter/divkit/test/goldens/main_goldens_test.dart":"divkit/public/client/flutter/divkit/test/goldens/main_goldens_test.dart",
"client/flutter/divkit/test/goldens/models/snapshot_test_model.dart":"divkit/public/client/flutter/divkit/test/goldens/models/snapshot_test_model.dart",
"client/flutter/divkit/test/goldens/models/test_files.dart":"divkit/public/client/flutter/divkit/test/goldens/models/test_files.dart",
+4
View File
@@ -33,3 +33,7 @@ dev_dependencies:
path: ^1.8.2
golden_toolkit: ^0.15.0
fake_async: ^1.3.1
http: ^0.13.5
mocktail_image_network: ^1.2.0
sqflite: ^2.2.5
sqflite_common_ffi: ^2.2.5
@@ -13,6 +13,12 @@ class _SkipTest {
enum _Reason {
divNotSupported,
haveToLoadNetworkImage,
// SVG images crash, or test stucks on forever
// We need to support mocking them
// https://st.yandex-team.ru/YXPRODELIVERY-4382
svgImage,
// One or more sides of the image happened to be 0
invalidImageDimensions,
crashesOnImageDimensions,
crashesOnAspectRatio,
crashesOnRenderFlexOverflow,
@@ -308,31 +314,6 @@ final skippedTests = [
),
),
...[
'test_data/snapshot_test_data/div-container/horizontal-orientation-bottom-horizontal-alignment.json',
'test_data/snapshot_test_data/div-container/horizontal-orientation-bottom-vertical-alignment.json',
'test_data/snapshot_test_data/div-container/horizontal-orientation-center-horizontal-alignment.json',
'test_data/snapshot_test_data/div-container/horizontal-orientation-center-vertical-alignment.json',
'test_data/snapshot_test_data/div-container/horizontal-orientation-space-around-alignment.json',
'test_data/snapshot_test_data/div-container/horizontal-orientation-space-between-alignment.json',
'test_data/snapshot_test_data/div-container/horizontal-orientation-space-evenly-alignment.json',
'test_data/snapshot_test_data/div-container/overlap-orientation.json',
'test_data/snapshot_test_data/div-container/overlap-with-match-parent-child.json',
'test_data/snapshot_test_data/div-container/size_unit.json',
'test_data/snapshot_test_data/div-container/vertical-orientation-center-alignment.json',
'test_data/snapshot_test_data/div-container/vertical-orientation-space-around-alignment.json',
'test_data/snapshot_test_data/div-container/vertical-orientation-space-between-alignment.json',
'test_data/snapshot_test_data/div-container/vertical-orientation-space-evenly-alignment.json',
'test_data/snapshot_test_data/div-background/scale_stretch.json',
'test_data/snapshot_test_data/div-container/no-scale-background.json',
].map(
(e) => _SkipTest(
e,
_Reason.haveToLoadNetworkImage,
'Framework can not load load network images during testing',
),
),
...[
'test_data/snapshot_test_data/div-container/overlap-container-alignment.json',
'test_data/snapshot_test_data/div-container/overlap-orientation-default-alignments.json',
@@ -483,43 +464,8 @@ final skippedTests = [
...[
'test_data/snapshot_test_data/div-image/custom-preview.json',
'test_data/snapshot_test_data/div-image/custom-tint-color.json',
'test_data/snapshot_test_data/div-image/placeholder-color.json',
'test_data/snapshot_test_data/div-image/preview.json',
'test_data/snapshot_test_data/div-image/tint-mode.json',
'test_data/snapshot_test_data/div-image/aspect-fixed.json',
'test_data/snapshot_test_data/div-image/aspect-match_parent.json',
'test_data/snapshot_test_data/div-image/aspect-wrap_content.json',
'test_data/snapshot_test_data/div-image/blur-with-big-radius.json',
'test_data/snapshot_test_data/div-image/blur.json',
'test_data/snapshot_test_data/div-image/border-with-stroke.json',
'test_data/snapshot_test_data/div-image/composite-background.json',
'test_data/snapshot_test_data/div-image/content-horizontal-alignment-end.json',
'test_data/snapshot_test_data/div-image/content-horizontal-alignment-start.json',
'test_data/snapshot_test_data/div-image/corner-radius.json',
'test_data/snapshot_test_data/div-image/corners_radius.json',
'test_data/snapshot_test_data/div-image/custom-alpha.json',
'test_data/snapshot_test_data/div-image/custom-height.json',
'test_data/snapshot_test_data/div-image/custom-margins.json',
'test_data/snapshot_test_data/div-image/custom-paddings.json',
'test_data/snapshot_test_data/div-image/custom-width.json',
'test_data/snapshot_test_data/div-image/no_scale.json',
'test_data/snapshot_test_data/div-image/no_scale_bottom_right.json',
'test_data/snapshot_test_data/div-image/no_scale_top_left.json',
'test_data/snapshot_test_data/div-image/rtl-filter.json',
'test_data/snapshot_test_data/div-image/rtl-image-content-horizontal-alignment-end.json',
'test_data/snapshot_test_data/div-image/rtl-image-content-horizontal-alignment-start.json',
'test_data/snapshot_test_data/div-image/scale_fill.json',
'test_data/snapshot_test_data/div-image/scale_fill_bottom.json',
'test_data/snapshot_test_data/div-image/scale_fill_right.json',
'test_data/snapshot_test_data/div-image/scale_fit.json',
'test_data/snapshot_test_data/div-image/scale_fit_bottom.json',
'test_data/snapshot_test_data/div-image/scale_fit_left.json',
'test_data/snapshot_test_data/div-image/scale_fit_right.json',
'test_data/snapshot_test_data/div-image/scale_fit_top.json',
'test_data/snapshot_test_data/div-image/scale_stretch.json',
'test_data/snapshot_test_data/div-image/shadow.json',
'test_data/snapshot_test_data/div-image/wrap-content-width-by-height.json',
].map(
(e) => _SkipTest(
e,
@@ -527,6 +473,15 @@ final skippedTests = [
),
),
...[
'test_data/snapshot_test_data/div-image/tint-mode.json',
].map(
(e) => _SkipTest(
e,
_Reason.invalidImageDimensions,
),
),
// # div-indicator
...[
@@ -646,20 +601,6 @@ final skippedTests = [
),
),
// # div-shadow
...[
'test_data/snapshot_test_data/div-shadow/shadow-with-alpha.json',
'test_data/snapshot_test_data/div-shadow/shadow-with-blur.json',
'test_data/snapshot_test_data/div-shadow/shadow-with-color.json',
'test_data/snapshot_test_data/div-shadow/shadow-with-offset.json',
].map(
(e) => _SkipTest(
e,
_Reason.haveToLoadNetworkImage,
),
),
// # div-size
...[
@@ -821,19 +762,9 @@ final skippedTests = [
),
const _SkipTest(
'test_data/snapshot_test_data/div-text/blur-background.json',
_Reason.haveToLoadNetworkImage,
_Reason.invalidImageDimensions,
'https://paste.yandex-team.ru/3e965301-f3ac-4ff3-ba62-c81665108399',
),
const _SkipTest(
'test_data/snapshot_test_data/div-text/composite-background.json',
_Reason.haveToLoadNetworkImage,
'https://paste.yandex-team.ru/04b3d5a3-5e4f-49d6-89b5-f5544e6e7242',
),
const _SkipTest(
'test_data/snapshot_test_data/div-text/image-background.json',
_Reason.haveToLoadNetworkImage,
'https://paste.yandex-team.ru/15650b63-7b14-4c08-9259-db6f5b3de7b6',
),
const _SkipTest(
'test_data/snapshot_test_data/div-text/images.json',
_Reason.crashesOnRenderFlexLayout,
@@ -862,29 +793,28 @@ final skippedTests = [
_Reason.divNotSupported,
),
),
...[
'test_data/snapshot_test_data/div-transform/transform_identity.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_bottom_center.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_bottom_left_corner.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_bottom_right_corner.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_center.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_left_center.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_right_center.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_top_center.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_top_left_corner.json',
'test_data/snapshot_test_data/div-transform/transform_turn_45_around_top_right_corner.json',
'test_data/snapshot_test_data/div-transform/transform_turn_90_around_center.json',
_SkipTest(
'test_data/snapshot_test_data/div-text/custom-image-tint-color.json',
'test_data/snapshot_test_data/div-text/custom-text-alignment-with-attachments.json',
'test_data/snapshot_test_data/div-text/ellipsis-with-image.json',
'test_data/snapshot_test_data/div-text/all_attributes.json',
'test_data/snapshot_test_data/div-container/vertical-composite-background.json',
].map(
(e) => _SkipTest(
e,
_Reason.haveToLoadNetworkImage,
),
_Reason.divNotSupported,
'https://a.yandex-team.ru/review/6756853/files/5#comment-9971090',
),
_SkipTest(
'test_data/snapshot_test_data/div-text/custom-text-alignment-with-attachment.json',
_Reason.divNotSupported,
'https://a.yandex-team.ru/review/6756853/files/5#comment-9971092',
),
_SkipTest(
'test_data/snapshot_test_data/div-text/ellipsis-with-image.json',
_Reason.divNotSupported,
'https://a.yandex-team.ru/review/6756853/details#comment-9971095',
),
_SkipTest(
'test_data/snapshot_test_data/div-text/all_attributes.json',
_Reason.divNotSupported,
'https://a.yandex-team.ru/review/6756853/details#comment-9971087',
),
// # div-svg
...[
'test_data/snapshot_test_data/div-svg/svg_background.json',
@@ -894,7 +824,8 @@ final skippedTests = [
].map(
(e) => _SkipTest(
e,
_Reason.haveToLoadNetworkImage,
_Reason.svgImage,
'https://paste.yandex-team.ru/db093d74-d606-40ab-9649-94ec071e12eb',
),
),
];
@@ -10,19 +10,23 @@ void makeGoldenTest({
CustomPump? customPump,
}) {
testGoldens(description, (tester) async {
await tester.pumpAutoSizeWidgetBuilder(
builder: builder,
afterBuild: () => enhancedScreenMatchesGolden(
tester,
fileName,
customPump: customPump,
),
device: Devices.phone375x500,
wrapper: (child) => MaterialApp(
supportedLocales: const [Locale('en')],
debugShowCheckedModeBanner: false,
home: child,
await loadAllNetworkImages(
tester,
builder: () async => tester.pumpAutoSizeWidgetBuilder(
builder: builder,
device: Devices.phone375x500,
wrapper: (child) => MaterialApp(
supportedLocales: const [Locale('en')],
debugShowCheckedModeBanner: false,
home: child,
),
),
);
await enhancedScreenMatchesGolden(
tester,
fileName,
customPump: customPump,
);
await cleanUpNetworkImageMocks(tester);
});
}
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_toolkit/golden_toolkit.dart';
@@ -7,7 +6,6 @@ extension AutoSizeWidgetTesterExtension on WidgetTester {
/// Pumps a widget and adjusts screen size to its size.
Future<void> pumpAutoSizeWidgetBuilder({
required ValueGetter<Widget> builder,
required AsyncCallback afterBuild,
WidgetWrapper? wrapper,
Device? device,
}) async {
@@ -35,7 +33,17 @@ extension AutoSizeWidgetTesterExtension on WidgetTester {
),
),
),
wrapper: wrapper,
wrapper: (child) => Builder(
builder: (context) {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
// A hack, until https://github.com/eBay/flutter_glove_box/pull/193 is merged
binding.window.devicePixelRatioTestValue =
device?.devicePixelRatio ?? 1;
});
return wrapper?.call(child) ?? materialAppWrapper()(child);
},
),
);
await pumpAndSettle();
@@ -43,19 +51,14 @@ extension AutoSizeWidgetTesterExtension on WidgetTester {
find.firstDescendant(of: find.byKey(childKey)),
);
try {
await binding.setSurfaceSize(childSize);
binding.window.physicalSizeTestValue = childSize;
if (device != null) {
binding.window.devicePixelRatioTestValue = device.devicePixelRatio;
}
await afterBuild();
} finally {
addTearDown(() async {
await binding.setSurfaceSize(null);
binding.window.clearPhysicalSizeTestValue();
binding.window.clearDevicePixelRatioTestValue();
}
});
await binding.setSurfaceSize(childSize);
binding.window.physicalSizeTestValue = childSize;
}
}
@@ -1,5 +1,6 @@
export 'package:golden_toolkit/golden_toolkit.dart';
export 'mock_images/mock_and_load_network_images.dart';
export 'auto_size_widget_tester_extension.dart';
export 'enhanced_file_comparator.dart';
export 'flutter_test_config.dart';
@@ -1,87 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:golden_toolkit/golden_toolkit.dart';
import 'package:meta/meta.dart';
import 'screen_matches_golden.dart';
@isTest
Future<void> goldenTestForCI({
required String description,
required String testFileName,
required Device device,
required ValueGetter<Widget> builder,
}) async {
testGoldens(
description,
(WidgetTester tester) async {
final constraints = BoxConstraints(
maxHeight: device.size.height,
maxWidth: device.size.width,
);
final childKey = UniqueKey();
await tester.pumpWidgetBuilder(
Center(
child: OverflowBox(
minWidth: constraints.minWidth,
minHeight: constraints.minHeight,
maxWidth: constraints.maxWidth,
maxHeight: constraints.maxHeight,
child: Center(
child: KeyedSubtree(
key: childKey,
child: builder(),
),
),
),
),
wrapper: (child) => MaterialApp(
supportedLocales: const [Locale('en')],
debugShowCheckedModeBanner: false,
home: child,
),
);
await tester.pumpAndSettle();
final childSize = tester.getSize(
find.firstDescendant(of: find.byKey(childKey)),
);
try {
await tester.binding.setSurfaceSize(childSize);
tester.binding.window.physicalSizeTestValue = childSize;
tester.binding.window.devicePixelRatioTestValue =
device.devicePixelRatio;
await enhancedScreenMatchesGolden(
tester,
testFileName,
);
} finally {
await tester.binding.setSurfaceSize(null);
tester.binding.window.clearPhysicalSizeTestValue();
tester.binding.window.clearDevicePixelRatioTestValue();
}
},
);
}
extension on CommonFinders {
Finder firstDescendant({
required Finder of,
bool skipOffstage = true,
}) {
final acenstor = of;
final Iterable<Element> ancestorElements = acenstor.evaluate();
final List<Element> candidates = ancestorElements
.expand<Element>(
(Element element) =>
collectAllElementsFrom(element, skipOffstage: skipOffstage),
)
.toSet()
.toList();
final builtChild = candidates.first;
return find.byElementPredicate((element) => element == builtChild);
}
}
@@ -0,0 +1,11 @@
import 'dart:io';
/// Enables network calls in tests with the [body].
///
/// Will not work if [body] itself creates other overrides.
R enableHttpInTests<R>(R Function() body) => HttpOverrides.runWithHttpOverrides(
body,
_MyHttpOverrides(),
);
class _MyHttpOverrides extends HttpOverrides {}
@@ -0,0 +1,335 @@
import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'dart:ui' as ui;
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:http/http.dart' as http;
import 'package:mocktail_image_network/mocktail_image_network.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'enable_http.dart';
import 'mock_images_utils.dart';
/// Loads all network image ([CachedNetworkImage] as well).
///
/// Enables HTTP locally for this operation.
///
/// You must call [cleanUpNetworkImageMocks] in the very end of the test, if you use
/// this function.
Future<void> loadAllNetworkImages(
WidgetTester tester, {
required AsyncCallback builder,
}) =>
_mockAllNetworkImages(
tester,
builder,
_downloadImage,
);
/// Must be called in the very end of the test, whenever
/// this test contained calls to [loadAllNetworkImages] or [mockAllNetworkImages].
///
/// This contract is needed, because this clean up has to occur
/// before the test ends and thus cannot be done in [tearDown].
Future<void> cleanUpNetworkImageMocks(WidgetTester tester) =>
_CleanUpRegistry.instance.cleanUp(tester);
class _CleanUpRegistry {
static final instance = _CleanUpRegistry();
final _testerCleanedUpData = <WidgetTester, bool>{};
void register(WidgetTester tester) {
_testerCleanedUpData[tester] = false;
addTearDown(() {
_verifyCleanedUp(tester);
});
}
Future<void> cleanUp(WidgetTester tester) async {
final cleanedUp = _testerCleanedUpData[tester];
if (cleanedUp != true) {
await tester.runAsync<void>(pumpEventQueue);
await tester.binding.delayed(const Duration(days: 999));
_testerCleanedUpData[tester] = true;
}
}
void _verifyCleanedUp(WidgetTester tester) {
final cleanedUp = _testerCleanedUpData.remove(tester);
assert(
cleanedUp != null,
'verifyCleanedUp called without register, or cleanUp has failed',
);
if (cleanedUp != true) {
fail('cleanUpNetworkImageMocks must be called in the end of test');
}
}
}
Future<void> _mockAllNetworkImages(
WidgetTester tester,
AsyncCallback builder,
_ImageBuilder imageBuilder,
) async {
_CleanUpRegistry.instance.register(tester);
_mockPlatformChannels(tester);
// Additionally wrap into to mock requests from initial pump
// and be sure they don't turn into errors.
await mockNetworkImages(() async {
await builder();
});
tester.binding.imageCache.clear();
tester.binding.imageCache.clearLiveImages();
await _mockAllNetworkImageWidgets(tester, imageBuilder);
await _mockAllCachedNetworkImages(tester, imageBuilder);
await tester.pumpWidget(const SizedBox());
await builder();
}
void _mockPlatformChannels(WidgetTester tester) {
final tempRelativePath = './temp${Random().nextInt(10000)}';
final dir = Directory(tempRelativePath);
tester.binding.defaultBinaryMessenger.setMockMethodCallHandler(
const MethodChannel('plugins.flutter.io/path_provider'),
(methodCall) async {
if (methodCall.method == 'getTemporaryDirectory' ||
methodCall.method == 'getApplicationSupportDirectory') {
return tempRelativePath;
}
return <dynamic, dynamic>{};
},
);
_mockSqflite();
addTearDown(() {
if (dir.existsSync()) {
dir.deleteSync(recursive: true);
}
});
}
void _mockSqflite() {
databaseFactoryOrNull = databaseFactoryFfi;
}
typedef _ImageBuilder = Future<ui.Image> Function(
String url,
Map<String, String>? headers,
int width,
int height,
);
Future<void> _mockAllCachedNetworkImages(
WidgetTester tester,
_ImageBuilder imageBuilder,
) async {
final imageElements = find.byType(Image, skipOffstage: false).evaluate();
final containerElements =
find.byType(DecoratedBox, skipOffstage: false).evaluate();
final cachedNetworkImageElements =
find.byType(CachedNetworkImage, skipOffstage: false).evaluate().toList();
await tester.runAsync(() async {
for (final cachedNetworkImageElement in cachedNetworkImageElements) {
final widget = cachedNetworkImageElement.widget;
if (widget is CachedNetworkImage) {
ImageProvider imageProvider = CachedNetworkImageProvider(
widget.imageUrl,
cacheKey: widget.cacheKey,
maxWidth: widget.maxWidthDiskCache,
maxHeight: widget.maxHeightDiskCache,
);
imageProvider = ResizeImage.resizeIfNeeded(
widget.memCacheWidth,
widget.memCacheHeight,
imageProvider,
);
final imageConfig =
await extractImageConfig<CachedNetworkImageProvider>(
imageProvider,
cachedNetworkImageElement,
);
if (imageConfig != null) {
final image = await imageBuilder(
widget.imageUrl,
widget.httpHeaders,
imageConfig.width,
imageConfig.height,
);
// There is a problem here.
// Actually CachedNetworkImageProvider hashCode looks like this:
// ```
// Object.hash(cacheKey ?? url, scale, maxHeight, maxWidth)
// ```
// But scale is not a parameter of the widget and we cannot get it here, so
// theoretically this could break at some point in the future.
_mockNetworkImage(tester, imageConfig.cacheKey, image);
}
}
}
for (final imageElement in imageElements) {
final widget = imageElement.widget;
if (widget is Image) {
final imageConfig =
await extractImageConfig<CachedNetworkImageProvider>(
widget.image,
imageElement,
);
if (imageConfig != null) {
final image = await imageBuilder(
imageConfig.image.url,
imageConfig.image.headers,
imageConfig.width,
imageConfig.height,
);
_mockNetworkImage(tester, imageConfig.cacheKey, image);
}
}
}
for (final containerElement in containerElements) {
final widget = containerElement.widget as DecoratedBox;
final decoration = widget.decoration;
if (decoration is BoxDecoration) {
final imageConfig =
await extractImageConfig<CachedNetworkImageProvider>(
decoration.image?.image,
containerElement,
);
if (imageConfig != null) {
final image = await imageBuilder(
imageConfig.image.url,
imageConfig.image.headers,
imageConfig.width,
imageConfig.height,
);
_mockNetworkImage(tester, imageConfig.cacheKey, image);
}
}
}
});
}
Future<void> _mockAllNetworkImageWidgets(
WidgetTester tester,
_ImageBuilder imageBuilder,
) async {
final imageElements = find.byType(Image, skipOffstage: false).evaluate();
final containerElements =
find.byType(DecoratedBox, skipOffstage: false).evaluate();
await tester.runAsync(() async {
for (final imageElement in imageElements) {
final widget = imageElement.widget;
if (widget is Image) {
final imageConfig = await extractImageConfig<NetworkImage>(
widget.image,
imageElement,
);
if (imageConfig != null) {
final image = await imageBuilder(
imageConfig.image.url,
imageConfig.image.headers,
imageConfig.width,
imageConfig.height,
);
_mockNetworkImage(tester, imageConfig.cacheKey, image);
}
}
}
for (final containerElement in containerElements) {
final widget = containerElement.widget as DecoratedBox;
final decoration = widget.decoration;
if (decoration is BoxDecoration) {
final imageConfig = await extractImageConfig<NetworkImage>(
decoration.image?.image,
containerElement,
);
if (imageConfig != null) {
final image = await imageBuilder(
imageConfig.image.url,
imageConfig.image.headers,
imageConfig.width,
imageConfig.height,
);
_mockNetworkImage(tester, imageConfig.cacheKey, image);
}
}
}
});
}
final Map<int, Completer<Uint8List>> _downloadCache = {};
Future<ui.Image> _downloadImage(
String url,
Map<String, String>? headers,
int width,
int height,
) async {
final int cacheKey = Object.hash(url, width, height);
final cached = _downloadCache[cacheKey];
if (cached != null) {
final bytes8List = await cached.future;
return _decodeImageFromListWithSize(bytes8List, width, height);
}
final completer = Completer<Uint8List>();
_downloadCache[cacheKey] = completer;
return enableHttpInTests(
() async {
final httpClient = http.Client();
final req = http.Request('GET', Uri.parse(url));
if (headers != null) {
req.headers.addAll(headers);
}
final httpResponse = await httpClient.send(req);
final response = await http.Response.fromStream(httpResponse);
final bytes8List = Uint8List.fromList(response.bodyBytes);
completer.complete(bytes8List);
return _decodeImageFromListWithSize(bytes8List, width, height);
},
);
}
/// See also [decodeImageFromList].
Future<ui.Image> _decodeImageFromListWithSize(
Uint8List bytes,
int cacheWidth,
int cacheHeight,
) async {
final buffer = await ui.ImmutableBuffer.fromUint8List(bytes);
final codec = await PaintingBinding.instance.instantiateImageCodecFromBuffer(
buffer,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
);
final ui.FrameInfo frameInfo = await codec.getNextFrame();
return frameInfo.image;
}
void _mockNetworkImage(
WidgetTester tester,
Object key,
ui.Image image,
) =>
tester.binding.imageCache.putIfAbsent(
key,
() => OneFrameImageStreamCompleter(
Future.value(ImageInfo(image: image)),
),
);
@@ -0,0 +1,44 @@
import 'package:flutter/widgets.dart';
class _ImageConfig<T extends ImageProvider> {
final int width;
final int height;
final T image;
final Object cacheKey;
_ImageConfig(
this.width,
this.height,
this.image,
this.cacheKey,
);
}
Future<_ImageConfig<T>?> extractImageConfig<T extends ImageProvider>(
ImageProvider? imageProvider,
Element imageElement,
) async {
final renderBox = imageElement.renderObject! as RenderBox;
if (imageProvider is ResizeImage &&
imageProvider.imageProvider is T &&
imageProvider.width != null &&
imageProvider.height != null) {
return _ImageConfig(
imageProvider.width!,
imageProvider.height!,
imageProvider.imageProvider as T,
await imageProvider
.obtainKey(createLocalImageConfiguration(imageElement)),
);
}
if (imageProvider is T) {
return _ImageConfig(
renderBox.size.width.ceil(),
renderBox.size.height.ceil(),
imageProvider,
await imageProvider
.obtainKey(createLocalImageConfiguration(imageElement)),
);
}
return null;
}
@@ -3,14 +3,6 @@ import 'dart:ui';
import 'framework.dart';
abstract class Devices {
static const iphone3 = Device(
name: 'iphone3',
size: Size(
320,
480,
),
devicePixelRatio: 2.0,
);
static const phone375x500 = Device(
name: 'phone375x500',
size: Size(
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 933 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 KiB

@@ -12,9 +12,9 @@ void main() async {
if (kDebugMode) {
print('Running tests...');
print('Will skip ${skippedTests.length} tests');
print('All tests: ${tests.length}');
}
print('All tests: ${tests.length}');
await runTests(tests);
}
}
+18 -6
View File
@@ -1,9 +1,7 @@
#!/bin/bash
INPUT_PATH=$1
GOLDENS_DIR="test/goldens/goldens"
FAILURES_DIR="test/goldens/failures"
TEMP_DIR="temp_extracted_to_replace"
TEMP_DIR="$(dirname $INPUT_PATH)/temp_extracted_to_replace"
TEST_FILE_POSTFIX="_testImage"
ZIP_FILE=false
@@ -31,7 +29,7 @@ if [[ $ZIP_FILE = true ]]; then
unzip -o "$INPUT_PATH" -d $WORK_FOLDER
echo
else
WORK_FOLDER=$FAILURES_DIR
WORK_FOLDER=$INPUT_PATH
fi
function testImageFiles() {
@@ -48,10 +46,24 @@ echo "Found ${#FILES_ARRAY[@]} test files"
echo
for FILE in $FILES; do
# Remove substring to match golden file name
# Here convert string like "/Users/username/Downloads/test/goldens/failures/testName_testImage.png"
# To string like "test/goldens/failures/testName.png"
# And then move it to this path
# Remove "_test" substring to match golden file name
GOLDEN_FILE_NAME=${FILE//$TEST_FILE_POSTFIX/}
# Remove start path, but keep the "test" part, if we have it
TO_KEEP="test/*"
TO_REMOVE_PREFIX="$WORK_FOLDER/"
TO_REMOVE_PREFIX=${TO_REMOVE_PREFIX//$TO_KEEP/}
GOLDENS_DIR=${GOLDEN_FILE_NAME//$TO_REMOVE_PREFIX/}
# Change postfix to "goldens"
TO_REMOVE_POSTFIX="failures/*"
TO_ADD_POSTFIX="goldens/"
GOLDENS_DIR=${GOLDENS_DIR//$TO_REMOVE_POSTFIX/$TO_ADD_POSTFIX}
echo "Moving $GOLDEN_FILE_NAME"
mv "$FILE" "$GOLDEN_FILE_NAME"
cp "$FILE" "$GOLDEN_FILE_NAME"
mkdir -p $GOLDENS_DIR
mv "$GOLDEN_FILE_NAME" $GOLDENS_DIR
done