Code review comment for lp://qastaging/~chris.gagnon/gallery-app/autopilot-fix-first-photo-in-album-view

Revision history for this message
Leo Arias (elopio) wrote :

21 + first_photo = None
22 + for photo in photos:
23 + if first_photo is None:
24 + first_photo = photo
25 + elif(
26 + photo.globalRect.x < first_photo.globalRect.x and
27 + photo.globalRect.y < first_photo.globalRect.y
28 + ):
29 + first_photo = photo
30 + return first_photo

I think that you can use this instead:

photos = sorted(photos, key=lambda photo: (photo.globalRect.y, photo.globalRect.x))
return photos[0]

19 + photos = self.app.select_many(
20 + "FramePortrait", visible=True, isLoaded=True)

45 + self.app.select_many(
46 + "FramePortrait",
47 + visible=True,
48 + isLoaded=True)

You can make that a method called _get_loaded_frame_portraits.

review: Needs Fixing (code review)

« Back to merge proposal