Skip to content

Conversation

Sahil-Simform
Copy link
Collaborator

Description

  • Added test cases for overlay

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

@Sahil-Simform Sahil-Simform force-pushed the testing/overlay_tests branch 2 times, most recently from 860c94b to aa84c53 Compare July 24, 2025 14:01
@Sahil-Simform Sahil-Simform force-pushed the testing/overlay_tests branch from aa84c53 to 6b366eb Compare July 24, 2025 14:23
Copy link
Collaborator

@aditya-css aditya-css left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Additional Note -
    Please cover following cases:
  1. Showcaseview properties applied correctly to the overlay
  2. Only the properties of first showcase is used for the overlay in case of simultaneously showing multiple showcases
  3. The overlay has correct rect cutouts for the target widget

Color reduceOpacity(double opacity) => withAlpha((opacity * 255).round());

/// Safe replacement for deprecated red property
int get safeRed => (0x00ff0000 & _toARGB32()) >> 16;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please mention the reason behind creating this method. In which flutter version did the property got deprecated and in what flutter version it would be safe to remove this and use inbuilt way.


double? findOverlayBlurSigma(WidgetTester tester) {
final filters =
tester.widgetList(find.byType(ImageFiltered)).cast<ImageFiltered?>();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the generic type of widgetList instead of casting.


final match = RegExp(r'ImageFilter\.blur\(\s*([0-9.]+)\s*,\s*([0-9.]+)')
.firstMatch(str);
if (match != null) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use if case.

Comment on lines +61 to +70
setUp(
() {
ShowcaseView.register();
},
);
tearDown(
() {
ShowcaseView.get().unregister();
},
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leverage tear off.

);

testWidgets(
'Overlay renders with default properties',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test and description doesn't match. No overlay properties are checked for default value.

expect(find.byType(Overlay), findsWidgets);

// Explicitly ask to rebuild the overlay
ShowcaseView.get().updateOverlay();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be required.

},
);

testWidgets('Overlay with custom target shape borders',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test and the description doesn't match. The border applied is not checked.

expect(find.byType(Overlay), findsWidgets);
});

testWidgets('Overlay with zero opacity', (WidgetTester tester) async {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can combine this with different opacities tests.

expect(color, Colors.black.reduceOpacity(0.0));
});

testWidgets('Overlay with full opacity', (WidgetTester tester) async {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be combined as well as mentioned for the above test.

});
});

group('Overlay Edge Cases', () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the tests in this group can be combined with the test in the above group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants