fix(livetv): explain a guide emptied by the favorites filter
With "Default to Favorite Channels" enabled and no favorites stored — or only favorites left over from a since-rebuilt lineup — the favorites filter reduced the guide to zero channels and GuideTab rendered just the timeline bar: no rows, no message, no sign a filter was active. Users read it as Live TV being broken; the Aug 8 report in #887 shows 44 channels and 447 grid programs loading in the log while the screenshot shows a blank guide and 0 favorite channels. When the filter removes every loaded channel, the guide tab now shows an empty state naming the cause with a "Show All Channels" action that clears the filter. The action stays D-pad reachable: the tab-bar focus handoff falls through to the action's focus node while the empty state replaces GuideTab, and activating it hands focus back to the restored guide content. Favorites that match no loaded channel get the same treatment as an empty favorites list. Verified: flutter test test/screens/livetv/, analyzer parity, clean_translations --check --strict, and slang codegen freshness. Refs #887.
This commit is contained in:
@@ -35,7 +35,7 @@ void main() {
|
||||
await settings.write(SettingsService.liveTvDefaultFavorites, true);
|
||||
});
|
||||
|
||||
testWidgets('loaded empty favorites produces an empty Guide after preserving channels during load', (tester) async {
|
||||
testWidgets('loaded empty favorites shows the favorites empty state and can restore all channels', (tester) async {
|
||||
final harness = await _pumpLiveTvScreen(tester);
|
||||
addTearDown(() async {
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
@@ -48,8 +48,31 @@ void main() {
|
||||
harness.liveTv.favorites.complete(const []);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byIcon(Symbols.star_rounded), findsOneWidget);
|
||||
expect(_guideChannels(tester), isEmpty);
|
||||
expect(find.byType(GuideTab), findsNothing);
|
||||
expect(find.text(t.liveTv.noFavoriteChannels), findsOneWidget);
|
||||
expect(find.text(t.liveTv.showAllChannels), findsOneWidget);
|
||||
|
||||
await tester.tap(find.text(t.liveTv.showAllChannels));
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.text(t.liveTv.noFavoriteChannels), findsNothing);
|
||||
expect(find.byIcon(Symbols.star_outline_rounded), findsOneWidget);
|
||||
expect(_guideChannels(tester).map((channel) => channel.key), ['channel-a']);
|
||||
});
|
||||
|
||||
testWidgets('favorites matching no loaded channel show the favorites empty state', (tester) async {
|
||||
final harness = await _pumpLiveTvScreen(tester);
|
||||
addTearDown(() async {
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
harness.dispose();
|
||||
});
|
||||
|
||||
harness.liveTv.favorites.complete([FavoriteChannel(id: 'channel-gone', source: 'server://server-a/provider-a')]);
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
expect(find.byType(GuideTab), findsNothing);
|
||||
expect(find.text(t.liveTv.noFavoriteChannels), findsOneWidget);
|
||||
expect(find.text(t.liveTv.showAllChannels), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('refresh keeps the favorites filter narrow while favorites reload', (tester) async {
|
||||
|
||||
Reference in New Issue
Block a user