summaryrefslogtreecommitdiff
path: root/test.sh
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2023-12-29 14:54:17 +0100
committerPřemysl Eric Janouch <p@janouch.name>2023-12-29 14:54:17 +0100
commit644bcefd71339d58483f1a7c4a94ac7ff9c4dc75 (patch)
treee0f301d4f7ec676219c917ad5e5c2b747a5f20e7 /test.sh
parent19db1b17c184cca2073bf395568a4841953d2629 (diff)
downloadgallery-original.tar.gz
gallery-original.tar.xz
gallery-original.zip
Resolve issuesoriginal
Diffstat (limited to 'test.sh')
-rwxr-xr-xtest.sh50
1 files changed, 43 insertions, 7 deletions
diff --git a/test.sh b/test.sh
index 844148c..2f12d07 100755
--- a/test.sh
+++ b/test.sh
@@ -1,17 +1,53 @@
#!/bin/sh -xe
cd "$(dirname "$0")"
make gallery
-target=/tmp/G input=/tmp/G/Images
+target=/tmp/G input=/tmp/G/Test
rm -rf $target
-mkdir -p $target $input
-# TODO: Generate something in there.
+mkdir -p $target $input/Test $input/Empty
+gen() { magick "$@"; sha1=$(sha1sum "$(eval echo \$\{$#\})" | cut -d' ' -f1); }
+
+gen wizard: $input/wizard.webp
+gen -seed 10 -size 256x256 plasma:fractal \
+ $input/Test/dhash.jpg
+gen -seed 10 -size 256x256 plasma:fractal \
+ $input/Test/dhash.png
+sha1duplicate=$sha1
+cp $input/Test/dhash.png \
+ $input/Test/multiple-paths.png
+
+gen -seed 20 -size 160x128 plasma:fractal \
+ -bordercolor transparent -border 64 \
+ $input/Test/transparent-wide.png
+gen -seed 30 -size 1024x256 plasma:fractal \
+ -alpha set -channel A -evaluate multiply 0.2 \
+ $input/Test/translucent-superwide.png
+
+gen -size 96x96 -delay 10 -loop 0 \
+ -seed 111 plasma:fractal \
+ -seed 222 plasma:fractal \
+ -seed 333 plasma:fractal \
+ -seed 444 plasma:fractal \
+ -seed 555 plasma:fractal \
+ -seed 666 plasma:fractal \
+ $input/Test/animation-small.gif
+sha1animated=$sha1
+gen $input/Test/animation-small.gif \
+ $input/Test/video.mp4
./gallery init $target
./gallery sync $target $input "$@"
./gallery thumbnail $target
./gallery dhash $target
-./gallery tag $target test "Test space" < /dev/null
+./gallery tag $target test "Test space" <<-END
+ $sha1duplicate foo 1.0
+ $sha1duplicate bar 0.5
+ $sha1animated foo 0.8
+END
+
+# TODO: Test all the various possible sync transitions.
+mv $input/Test $input/Plasma
+./gallery sync $target $input
./gallery web $target :8080 &
web=$!
@@ -20,10 +56,10 @@ sleep 0.25
call() (curl http://localhost:8080/api/$1 -X POST --data-binary @-)
+# TODO: Verify that things are how we expect them to be.
echo '{"path":"'"$(basename "$input")"'"}' | call browse
echo '{}' | call tags
echo '{}' | call duplicates
echo '{}' | call orphans
-# TODO: Use hashes of generated images.
-echo '{"sha1":"d53fc82162fd19a6e7b92b401b08b7505dbf3dfd"}' | call info
-echo '{"sha1":"9539d9895ab8c25d76c321b23b8a327801a496bb"}' | call similar
+echo '{"sha1":"'"$sha1duplicate"'"}' | call info
+echo '{"sha1":"'"$sha1duplicate"'"}' | call similar