Skip to content

Commit 75ddd62

Browse files
seungsoo47claude
andauthored
[tizen_notification] Add integration tests and fix null check crash in show() (#1062)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 9ce4754 commit 75ddd62

7 files changed

Lines changed: 84 additions & 4 deletions

File tree

packages/tizen_notification/CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
## NEXT
1+
## 0.2.1
22

3+
* Add regression integration tests.
4+
* Fix null check error when calling show() without TizenNotificationDetails.
35
* Update minimum Flutter and Dart version to 3.13 and 3.1.
46
* Update code format.
57

packages/tizen_notification/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ To use this plugin, add `tizen_notification` as a dependency in your `pubspec.ya
1010

1111
```yaml
1212
dependencies:
13-
tizen_notification: ^0.2.0
13+
tizen_notification: ^0.2.1
1414
```
1515
1616
Then you can import `tizen_notification` in your Dart code:
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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+
}

packages/tizen_notification/example/pubspec.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,15 @@ dependencies:
1212
tizen_notification:
1313
path: ../
1414

15+
dev_dependencies:
16+
flutter_driver:
17+
sdk: flutter
18+
flutter_test:
19+
sdk: flutter
20+
integration_test:
21+
sdk: flutter
22+
integration_test_tizen:
23+
path: ../../integration_test/
24+
1525
flutter:
1626
uses-material-design: true
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2013 The Flutter Authors. 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:integration_test/integration_test_driver.dart';
6+
7+
Future<void> main() => integrationDriver();

packages/tizen_notification/lib/tizen_notification.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class TizenNotificationPlugin {
3030

3131
// Set disableAppLaunch automatically if appControl is unset.
3232
if (notificationDetails?.appControl == null) {
33-
final int properties = details['properties']! as int;
33+
final int properties = (details['properties'] as int?) ?? 0;
3434
details['properties'] =
3535
properties | NotificationProperty.disableAppLaunch;
3636
}

packages/tizen_notification/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: tizen_notification
22
description: Tizen notification APIs. Used to show and delete notifications on a Tizen device.
33
homepage: https://github.com/flutter-tizen/plugins
44
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/tizen_notification
5-
version: 0.2.0
5+
version: 0.2.1
66

77
environment:
88
sdk: ">=3.1.0 <4.0.0"

0 commit comments

Comments
 (0)