3 name = "lomiri-gallery-app-standalone";
4 meta.maintainers = lib.teams.lomiri.members;
9 imports = [ ./common/x11.nix ];
11 services.xserver.enable = true;
17 ffmpeg # make a video from the image
18 (imagemagick.override { ghostscriptSupport = true; }) # example image creation
19 mpv # URI dispatching for video support
20 xdotool # mouse movement
22 ++ (with pkgs.lomiri; [
25 lomiri-thumbnailer # finds new images & generates thumbnails
28 UITK_ICON_THEME = "suru";
32 i18n.supportedLocales = [ "all" ];
35 packages = with pkgs; [
36 # Intended font & helps with OCR
51 with subtest("lomiri gallery launches"):
52 machine.succeed("lomiri-gallery-app >&2 &")
54 machine.wait_for_text(r"(Albums|Events|Photos)")
55 machine.screenshot("lomiri-gallery_open")
57 machine.succeed("pkill -f lomiri-gallery-app")
59 machine.succeed("mkdir /root/Pictures /root/Videos")
60 # Setup example data, OCR-friendly:
61 # - White square, black text
62 # - uppercase extension
63 machine.succeed("magick -size 500x500 -background white -fill black canvas:white -pointsize 70 -annotate +100+300 '${imageLabel}' /root/Pictures/output.PNG")
65 # Different image formats
66 machine.succeed("magick /root/Pictures/output.PNG /root/Pictures/output.JPG")
67 machine.succeed("magick /root/Pictures/output.PNG /root/Pictures/output.BMP")
68 machine.succeed("magick /root/Pictures/output.PNG /root/Pictures/output.GIF")
70 # Video for dispatching
71 machine.succeed("ffmpeg -loop 1 -r 1 -i /root/Pictures/output.PNG -t 100 -pix_fmt yuv420p /root/Videos/output.MP4")
73 with subtest("lomiri gallery handles files"):
74 machine.succeed("lomiri-gallery-app >&2 &")
76 machine.wait_for_text(r"(Albums|Events|Photos|${imageLabel})")
78 machine.succeed("xdotool mousemove 30 40 click 1") # burger menu for categories
80 machine.succeed("xdotool mousemove 30 180 click 1") # photos
82 machine.wait_for_text("${imageLabel}") # should see thumbnail of at least one of them
83 machine.screenshot("lomiri-gallery_photos")
85 machine.succeed("xdotool mousemove 80 140 click 1") # select newest one
87 machine.succeed("xdotool mousemove 80 140 click 1") # enable top-bar
90 with subtest("lomiri gallery handles mp4"):
91 machine.succeed("xdotool mousemove 870 50 click 1") # open media information
93 machine.wait_for_text("MP4") # make sure we're looking at the right file
94 machine.screenshot("lomiri-gallery_mp4_info")
95 machine.send_key("esc")
97 machine.wait_for_text("${imageLabel}") # make sure thumbnail rendering worked
99 machine.succeed("xdotool mousemove 450 350 click 1") # dispatch to system's video handler
100 machine.wait_until_succeeds("pgrep -u root -f mpv") # wait for video to start
102 machine.succeed("pgrep -u root -f mpv") # should still be playing
103 machine.screenshot("lomiri-gallery_mp4_dispatch")
105 machine.send_key("q")
106 machine.wait_until_fails("pgrep mpv") # wait for video to stop
108 machine.send_key("right")
110 with subtest("lomiri gallery handles gif"):
111 machine.succeed("xdotool mousemove 870 50 click 1") # open media information
113 machine.wait_for_text("GIF") # make sure we're looking at the right file
114 machine.screenshot("lomiri-gallery_gif_info")
115 machine.send_key("esc")
117 machine.wait_for_text("${imageLabel}") # make sure media shows fine
118 machine.send_key("right")
120 with subtest("lomiri gallery handles bmp"):
121 machine.succeed("xdotool mousemove 840 50 click 1") # open media information (extra icon, different location)
123 machine.wait_for_text("BMP") # make sure we're looking at the right file
124 machine.screenshot("lomiri-gallery_bmp_info")
125 machine.send_key("esc")
127 machine.wait_for_text("${imageLabel}") # make sure media shows fine
128 machine.send_key("right")
130 with subtest("lomiri gallery handles jpg"):
131 machine.succeed("xdotool mousemove 840 50 click 1") # open media information (extra icon, different location)
133 machine.wait_for_text("JPG") # make sure we're looking at the right file
134 machine.screenshot("lomiri-gallery_jpg_info")
135 machine.send_key("esc")
137 machine.wait_for_text("${imageLabel}") # make sure media shows fine
138 machine.send_key("right")
140 with subtest("lomiri gallery handles png"):
141 machine.succeed("xdotool mousemove 840 50 click 1") # open media information (extra icon, different location)
143 machine.wait_for_text("PNG") # make sure we're looking at the right file
144 machine.screenshot("lomiri-gallery_png_info")
145 machine.send_key("esc")
147 machine.wait_for_text("${imageLabel}") # make sure media shows fine
149 machine.succeed("pkill -f lomiri-gallery-app")
151 with subtest("lomiri gallery localisation works"):
152 machine.succeed("env LANG=de_DE.UTF-8 lomiri-gallery-app >&2 &")
153 machine.wait_for_text(r"(Alben|Ereignisse|Fotos)")
154 machine.screenshot("lomiri-gallery_localised")