Skip to content

Commit

Permalink
notif test: Cut now-disused test fakes for old plugin's show
Browse files Browse the repository at this point in the history
  • Loading branch information
gnprice committed Mar 26, 2024
1 parent 8e70933 commit 62e2ec9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 77 deletions.
23 changes: 0 additions & 23 deletions test/model/binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -392,24 +392,6 @@ class FakeFlutterLocalNotificationsPlugin extends Fake implements FlutterLocalNo
}
}

/// Consume the log of calls made to [show].
///
/// This returns a list of the arguments to all calls made
/// to [show] since the last call to this method.
List<FlutterLocalNotificationsPluginShowCall> takeShowCalls() {
final result = _showCalls;
_showCalls = [];
return result;
}
List<FlutterLocalNotificationsPluginShowCall> _showCalls = [];

@override
Future<void> show(int id, String? title, String? body,
NotificationDetails? notificationDetails, {String? payload}) async {
assert(initializationSettings != null);
_showCalls.add((id, title, body, notificationDetails, payload: payload));
}

/// The value to be returned by [getNotificationAppLaunchDetails].
NotificationAppLaunchDetails? appLaunchDetails;

Expand All @@ -425,11 +407,6 @@ class FakeFlutterLocalNotificationsPlugin extends Fake implements FlutterLocalNo
}
}

typedef FlutterLocalNotificationsPluginShowCall = (
int id, String? title, String? body,
NotificationDetails? notificationDetails, {String? payload}
);

class FakeAndroidFlutterLocalNotificationsPlugin extends Fake implements AndroidFlutterLocalNotificationsPlugin {
/// Consume the log of calls made to [createNotificationChannel].
///
Expand Down
54 changes: 0 additions & 54 deletions test/notifications/display_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,6 @@ extension AndroidNotificationChannelChecks on Subject<AndroidNotificationChannel
Subject<bool> get showBadge => has((x) => x.showBadge, 'showBadge');
}

extension ShowCallChecks on Subject<FlutterLocalNotificationsPluginShowCall> {
Subject<int> get id => has((x) => x.$1, 'id');
Subject<String?> get title => has((x) => x.$2, 'title');
Subject<String?> get body => has((x) => x.$3, 'body');
Subject<NotificationDetails?> get notificationDetails => has((x) => x.$4, 'notificationDetails');
Subject<String?> get payload => has((x) => x.payload, 'payload');
}

extension on Subject<AndroidNotificationHostApiNotifyCall> {
Subject<String?> get tag => has((x) => x.tag, 'tag');
Subject<int> get id => has((x) => x.id, 'id');
Expand All @@ -381,49 +373,3 @@ extension on Subject<PendingIntent> {
Subject<String> get intentPayload => has((x) => x.intentPayload, 'intentPayload');
Subject<int> get flags => has((x) => x.flags, 'flags');
}

extension NotificationDetailsChecks on Subject<NotificationDetails> {
Subject<AndroidNotificationDetails?> get android => has((x) => x.android, 'android');
Subject<DarwinNotificationDetails?> get iOS => has((x) => x.iOS, 'iOS');
Subject<DarwinNotificationDetails?> get macOS => has((x) => x.macOS, 'macOS');
Subject<LinuxNotificationDetails?> get linux => has((x) => x.linux, 'linux');
}

extension AndroidNotificationDetailsChecks on Subject<AndroidNotificationDetails> {
// The upstream [AndroidNotificationDetails] has many more properties
// which only apply to creating a channel, or to notifications before
// channels were introduced in Android 8. We ignore those here.
Subject<String?> get icon => has((x) => x.icon, 'icon');
Subject<String> get channelId => has((x) => x.channelId, 'channelId');
Subject<StyleInformation?> get styleInformation => has((x) => x.styleInformation, 'styleInformation');
Subject<String?> get groupKey => has((x) => x.groupKey, 'groupKey');
Subject<bool> get setAsGroupSummary => has((x) => x.setAsGroupSummary, 'setAsGroupSummary');
Subject<GroupAlertBehavior> get groupAlertBehavior => has((x) => x.groupAlertBehavior, 'groupAlertBehavior');
Subject<bool> get autoCancel => has((x) => x.autoCancel, 'autoCancel');
Subject<bool> get ongoing => has((x) => x.ongoing, 'ongoing');
Subject<Color?> get color => has((x) => x.color, 'color');
Subject<AndroidBitmap<Object>?> get largeIcon => has((x) => x.largeIcon, 'largeIcon');
Subject<bool> get onlyAlertOnce => has((x) => x.onlyAlertOnce, 'onlyAlertOnce');
Subject<bool> get showWhen => has((x) => x.showWhen, 'showWhen');
Subject<int?> get when => has((x) => x.when, 'when');
Subject<bool> get usesChronometer => has((x) => x.usesChronometer, 'usesChronometer');
Subject<bool> get chronometerCountDown => has((x) => x.chronometerCountDown, 'chronometerCountDown');
Subject<bool> get showProgress => has((x) => x.showProgress, 'showProgress');
Subject<int> get maxProgress => has((x) => x.maxProgress, 'maxProgress');
Subject<int> get progress => has((x) => x.progress, 'progress');
Subject<bool> get indeterminate => has((x) => x.indeterminate, 'indeterminate');
Subject<String?> get ticker => has((x) => x.ticker, 'ticker');
Subject<AndroidNotificationChannelAction> get channelAction => has((x) => x.channelAction, 'channelAction');
Subject<NotificationVisibility?> get visibility => has((x) => x.visibility, 'visibility');
Subject<int?> get timeoutAfter => has((x) => x.timeoutAfter, 'timeoutAfter');
Subject<AndroidNotificationCategory?> get category => has((x) => x.category, 'category');
Subject<bool> get fullScreenIntent => has((x) => x.fullScreenIntent, 'fullScreenIntent');
Subject<String?> get shortcutId => has((x) => x.shortcutId, 'shortcutId');
Subject<Int32List?> get additionalFlags => has((x) => x.additionalFlags, 'additionalFlags');
Subject<List<AndroidNotificationAction>?> get actions => has((x) => x.actions, 'actions');
Subject<String?> get subText => has((x) => x.subText, 'subText');
Subject<String?> get tag => has((x) => x.tag, 'tag');
Subject<bool> get colorized => has((x) => x.colorized, 'colorized');
Subject<int?> get number => has((x) => x.number, 'number');
Subject<AudioAttributesUsage> get audioAttributesUsage => has((x) => x.audioAttributesUsage, 'audioAttributesUsage');
}

0 comments on commit 62e2ec9

Please sign in to comment.