|
| 1 | +// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +import 'package:flutter_test/flutter_test.dart'; |
| 6 | +import 'package:integration_test/integration_test.dart'; |
| 7 | +import 'package:tizen_notification/tizen_notification.dart'; |
| 8 | + |
| 9 | +void main() { |
| 10 | + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); |
| 11 | + |
| 12 | + late TizenNotificationPlugin plugin; |
| 13 | + |
| 14 | + setUp(() { |
| 15 | + plugin = TizenNotificationPlugin(); |
| 16 | + }); |
| 17 | + |
| 18 | + tearDown(() async { |
| 19 | + await plugin.cancelAll(); |
| 20 | + }); |
| 21 | + |
| 22 | + group('TizenNotificationPlugin', () { |
| 23 | + testWidgets('show notification does not throw', |
| 24 | + (WidgetTester tester) async { |
| 25 | + await plugin.show(1, title: 'Test Title', body: 'Test Body'); |
| 26 | + }); |
| 27 | + |
| 28 | + testWidgets('show notification with default title and body does not throw', |
| 29 | + (WidgetTester tester) async { |
| 30 | + await plugin.show(2); |
| 31 | + }); |
| 32 | + |
| 33 | + testWidgets('cancel notification does not throw', |
| 34 | + (WidgetTester tester) async { |
| 35 | + await plugin.show(3, title: 'To Cancel'); |
| 36 | + await plugin.cancel(3); |
| 37 | + }); |
| 38 | + |
| 39 | + testWidgets('cancelAll does not throw', (WidgetTester tester) async { |
| 40 | + await plugin.show(4, title: 'Notification 1'); |
| 41 | + await plugin.show(5, title: 'Notification 2'); |
| 42 | + await plugin.cancelAll(); |
| 43 | + }); |
| 44 | + |
| 45 | + testWidgets( |
| 46 | + 'show notification with TizenNotificationDetails does not throw', |
| 47 | + (WidgetTester tester) async { |
| 48 | + final TizenNotificationDetails details = TizenNotificationDetails( |
| 49 | + properties: NotificationProperty.disableAutoDelete, |
| 50 | + style: NotificationStyle.tray, |
| 51 | + ); |
| 52 | + await plugin.show( |
| 53 | + 6, |
| 54 | + title: 'Detailed', |
| 55 | + body: 'With details', |
| 56 | + notificationDetails: details, |
| 57 | + ); |
| 58 | + await plugin.cancel(6); |
| 59 | + }); |
| 60 | + }); |
| 61 | +} |
0 commit comments