Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Merge upstream and trim Discover sort coverage

r4khul0f9c5d7c707a
diff --cc mobile/apps/photos/lib/ui/viewer/search/result/search_thumbnail_widget.dart
index 8279ba638d,9c9f012266..3fcf8ced5b
--- a/mobile/apps/photos/lib/ui/viewer/search/result/search_thumbnail_widget.dart
+++ b/mobile/apps/photos/lib/ui/viewer/search/result/search_thumbnail_widget.dart
@@@ -27,12 -27,15 +27,16 @@@ class SearchThumbnailWidget extends Sta
@override
Widget build(BuildContext context) {
+ final isLocation =
+ searchResult?.type() == ResultType.location ||
+ searchResult?.type() == ResultType.locationSuggestion;
++ final hasCover = isLocation || searchResult?.type() == ResultType.magic;
return Hero(
- tag: tagPrefix + (file?.tag ?? ""),
- createRectTween: searchResult?.type() == ResultType.magic
+ tag: isLocation ? tagPrefix : tagPrefix + (file?.tag ?? ""),
- createRectTween: isLocation
++ createRectTween: hasCover
? (begin, end) => RectTween(begin: begin, end: end)
: null,
- transitionOnUserGestures: searchResult?.type() == ResultType.magic,
- transitionOnUserGestures: isLocation,
++ transitionOnUserGestures: hasCover,
child: SizedBox(
height: size,
width: size,
diff --cc mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
index 81be36ce3d,906a59cca4..8f889cf5bb
--- a/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
+++ b/mobile/apps/photos/test/ui/viewer/gallery/collection_page_cover_test.dart
@@@ -135,58 -134,6 +135,50 @@@ void main()
await tempDir.delete(recursive: true);
});
- testWidgets("keeps the discovery cover stable while switching sort order", (
- tester,
- ) async {
++ testWidgets("sorts Discover photos using the shared sheet", (tester) async {
+ final files = [_file(1), _file(3), _file(2)];
+ final originalOrder = List<EnteFile>.of(files);
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: lightThemeData,
+ localizationsDelegates: StringsLocalizations.localizationsDelegates,
+ supportedLocales: StringsLocalizations.supportedLocales,
+ home: MagicResultScreen(
+ files,
+ name: "Discovery",
+ heroTag: "discovery",
+ magicFilter: MagicFilter(filterName: "Discovery", occurrence: 3),
+ ),
+ ),
+ );
+ await _expectCover(tester, files.first, count: 3);
- final header = tester.element(find.byType(AlbumCoverAppBar));
+ for (final (current, next, expected) in [
+ ("Most relevant", "Most recent", [files[1], files[2], files[0]]),
+ ("Most recent", "Most relevant", originalOrder),
+ ]) {
+ await tester.tap(find.byTooltip("Sort"));
+ await tester.pumpAndSettle();
+ expect(find.text("Sort photos"), findsOneWidget);
+ expect(
+ tester
+ .widgetList<MenuComponent>(find.byType(MenuComponent))
+ .singleWhere((choice) => choice.trailing != null)
+ .title,
+ current,
+ );
+ await tester.tap(find.text(next));
+ await _expectCover(tester, expected.first, count: 3);
- expect(tester.element(find.byType(AlbumCoverAppBar)), same(header));
- expect(
- tester.widget<AlbumCoverAppBar>(find.byType(AlbumCoverAppBar)).heroTag,
- "discovery${originalOrder.first.tag}",
- );
+ expect(
+ tester
+ .widget<GalleryFilesState>(find.byType(GalleryFilesState))
+ .galleryFiles,
+ expected,
+ );
- expect(files, originalOrder);
+ }
++ await tester.pump(const Duration(seconds: 4));
+ await _disposeAlbum(tester);
+ });
+
testWidgets("keeps interactive back when the album route fades", (
tester,
) async {