-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
flutter/test/integrations/screenshot_integration_test.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:sentry_flutter/sentry_flutter.dart'; | ||
import 'package:sentry_flutter/src/integrations/screenshot_integration.dart'; | ||
import 'package:sentry_flutter/src/integrations/widgets_binding_integration.dart'; | ||
import 'package:sentry_flutter/src/screenshot/screenshot_attachment_processor.dart'; | ||
|
||
import '../mocks.mocks.dart'; | ||
|
||
/// Tests that require `WidgetsFlutterBinding.ensureInitialized();` not | ||
/// being called at all. | ||
void main() { | ||
late Fixture fixture; | ||
|
||
setUp(() { | ||
fixture = Fixture(); | ||
}); | ||
|
||
test('screenshotIntegration creates screenshot processor', () async { | ||
final integration = ScreenshotIntegration(); | ||
|
||
await integration(fixture.hub, fixture.options); | ||
|
||
expect( | ||
// ignore: invalid_use_of_internal_member | ||
fixture.options.clientAttachmentProcessor | ||
is ScreenshotAttachmentProcessor, | ||
true); | ||
}); | ||
|
||
test('screenshotIntegration close resets processor', () async { | ||
final integration = ScreenshotIntegration(); | ||
|
||
await integration(fixture.hub, fixture.options); | ||
await integration.close(); | ||
|
||
expect( | ||
// ignore: invalid_use_of_internal_member | ||
fixture.options.clientAttachmentProcessor | ||
is ScreenshotAttachmentProcessor, | ||
false); | ||
}); | ||
} | ||
|
||
class Fixture { | ||
final hub = MockHub(); | ||
final options = SentryFlutterOptions(); | ||
} |