diff --git a/packages/tizen_notification/CHANGELOG.md b/packages/tizen_notification/CHANGELOG.md index 6fa1292fb..c87a699c1 100644 --- a/packages/tizen_notification/CHANGELOG.md +++ b/packages/tizen_notification/CHANGELOG.md @@ -1,5 +1,7 @@ -## NEXT +## 0.2.1 +* Add regression integration tests. +* Fix null check error when calling show() without TizenNotificationDetails. * Update minimum Flutter and Dart version to 3.13 and 3.1. * Update code format. diff --git a/packages/tizen_notification/README.md b/packages/tizen_notification/README.md index e0c418df1..781fe03e3 100644 --- a/packages/tizen_notification/README.md +++ b/packages/tizen_notification/README.md @@ -10,7 +10,7 @@ To use this plugin, add `tizen_notification` as a dependency in your `pubspec.ya ```yaml dependencies: - tizen_notification: ^0.2.0 + tizen_notification: ^0.2.1 ``` Then you can import `tizen_notification` in your Dart code: diff --git a/packages/tizen_notification/example/integration_test/tizen_notification_test.dart b/packages/tizen_notification/example/integration_test/tizen_notification_test.dart new file mode 100644 index 000000000..22f6935d1 --- /dev/null +++ b/packages/tizen_notification/example/integration_test/tizen_notification_test.dart @@ -0,0 +1,61 @@ +// Copyright 2026 Samsung Electronics Co., Ltd. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter_test/flutter_test.dart'; +import 'package:integration_test/integration_test.dart'; +import 'package:tizen_notification/tizen_notification.dart'; + +void main() { + IntegrationTestWidgetsFlutterBinding.ensureInitialized(); + + late TizenNotificationPlugin plugin; + + setUp(() { + plugin = TizenNotificationPlugin(); + }); + + tearDown(() async { + await plugin.cancelAll(); + }); + + group('TizenNotificationPlugin', () { + testWidgets('show notification does not throw', + (WidgetTester tester) async { + await plugin.show(1, title: 'Test Title', body: 'Test Body'); + }); + + testWidgets('show notification with default title and body does not throw', + (WidgetTester tester) async { + await plugin.show(2); + }); + + testWidgets('cancel notification does not throw', + (WidgetTester tester) async { + await plugin.show(3, title: 'To Cancel'); + await plugin.cancel(3); + }); + + testWidgets('cancelAll does not throw', (WidgetTester tester) async { + await plugin.show(4, title: 'Notification 1'); + await plugin.show(5, title: 'Notification 2'); + await plugin.cancelAll(); + }); + + testWidgets( + 'show notification with TizenNotificationDetails does not throw', + (WidgetTester tester) async { + final TizenNotificationDetails details = TizenNotificationDetails( + properties: NotificationProperty.disableAutoDelete, + style: NotificationStyle.tray, + ); + await plugin.show( + 6, + title: 'Detailed', + body: 'With details', + notificationDetails: details, + ); + await plugin.cancel(6); + }); + }); +} diff --git a/packages/tizen_notification/example/pubspec.yaml b/packages/tizen_notification/example/pubspec.yaml index 212ca9530..1957782f8 100644 --- a/packages/tizen_notification/example/pubspec.yaml +++ b/packages/tizen_notification/example/pubspec.yaml @@ -12,5 +12,15 @@ dependencies: tizen_notification: path: ../ +dev_dependencies: + flutter_driver: + sdk: flutter + flutter_test: + sdk: flutter + integration_test: + sdk: flutter + integration_test_tizen: + path: ../../integration_test/ + flutter: uses-material-design: true diff --git a/packages/tizen_notification/example/test_driver/integration_test.dart b/packages/tizen_notification/example/test_driver/integration_test.dart new file mode 100644 index 000000000..4f10f2a52 --- /dev/null +++ b/packages/tizen_notification/example/test_driver/integration_test.dart @@ -0,0 +1,7 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:integration_test/integration_test_driver.dart'; + +Future main() => integrationDriver(); diff --git a/packages/tizen_notification/lib/tizen_notification.dart b/packages/tizen_notification/lib/tizen_notification.dart index 3555a66b7..75d9b8e1b 100644 --- a/packages/tizen_notification/lib/tizen_notification.dart +++ b/packages/tizen_notification/lib/tizen_notification.dart @@ -30,7 +30,7 @@ class TizenNotificationPlugin { // Set disableAppLaunch automatically if appControl is unset. if (notificationDetails?.appControl == null) { - final int properties = details['properties']! as int; + final int properties = (details['properties'] as int?) ?? 0; details['properties'] = properties | NotificationProperty.disableAppLaunch; } diff --git a/packages/tizen_notification/pubspec.yaml b/packages/tizen_notification/pubspec.yaml index 26797b185..5ab4bf091 100644 --- a/packages/tizen_notification/pubspec.yaml +++ b/packages/tizen_notification/pubspec.yaml @@ -2,7 +2,7 @@ name: tizen_notification description: Tizen notification APIs. Used to show and delete notifications on a Tizen device. homepage: https://github.com/flutter-tizen/plugins repository: https://github.com/flutter-tizen/plugins/tree/master/packages/tizen_notification -version: 0.2.0 +version: 0.2.1 environment: sdk: ">=3.1.0 <4.0.0"