* Add --pin option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add --upload option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add --accept-on-select option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix failing build on MacOS Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Clean up option variable names in main Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Remove missing --path error Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Add tests for action options Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix file extension config option Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix --print-geometry bug Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Replace Qt::endl with "\n" Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix copy/upload task clipboard conflict Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix endless loop when using --raw and --delay Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix bug in upload handling Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Show dialog after upload if --clipboard is set Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com> * Fix failing build on Mac and Win Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
100 lines
3.0 KiB
Bash
100 lines
3.0 KiB
Bash
#!/usr/bin/env sh
|
|
|
|
# Tests for final action options with various flameshot commands
|
|
# Arguments:
|
|
# 1. path to tested flameshot executable
|
|
|
|
# Dependencies:
|
|
# - display command (imagemagick)
|
|
|
|
# HOW TO USE:
|
|
# - Start the script with path to tested flameshot executable as the first
|
|
# argument
|
|
#
|
|
# - Read messages from stdout and see if flameshot sends the right notifications
|
|
#
|
|
# Some commands will pin screenshots to the screen. Check if that is happening
|
|
# correctly. NOTE: the screen command will pin one screenshot over your entire
|
|
# screen, so don't be confused by that.
|
|
#
|
|
# - When the flameshot gui is tested, follow the instructions from the system
|
|
# notifications
|
|
#
|
|
# - Some tests may ask you for confirmation in the CLI before continuing.
|
|
# - Whenever the --raw option is tested, the `display` command is used to open
|
|
# the image from stdout in a window. Just close that window.
|
|
#
|
|
|
|
FLAMESHOT="$1"
|
|
[ -z "$FLAMESHOT" ] && FLAMESHOT="flameshot"
|
|
|
|
# --raw >/dev/null is a hack that makes the subcommand wait for the daemon to
|
|
# finish the pending action
|
|
flameshot() {
|
|
command "$FLAMESHOT" "$@" --raw >/tmp/img.png
|
|
}
|
|
|
|
# Print the given command and run it
|
|
cmd() {
|
|
echo "$*" >&2
|
|
"$@"
|
|
sleep 1
|
|
}
|
|
|
|
wait_for_key() {
|
|
echo "Press Enter to continue..." >&2 && read ____
|
|
}
|
|
|
|
# NOTE: Upload option is intentionally not tested
|
|
|
|
# flameshot full & screen
|
|
# ┗━━━━━━━━━━━━━━━━━━━━━━━━┛
|
|
|
|
for subcommand in full screen
|
|
do
|
|
cmd flameshot "$subcommand" --path /tmp/
|
|
cmd flameshot "$subcommand" --clipboard
|
|
cmd command "$FLAMESHOT" "$subcommand" --raw | display
|
|
[ "$subcommand" = "full" ] && sleep 1
|
|
echo
|
|
done
|
|
|
|
echo "The next command will pin a screenshot over your entire screen."
|
|
echo "Make sure to close it afterwards"
|
|
echo "Press Enter to continue..."
|
|
read ____
|
|
flameshot screen --pin
|
|
sleep 1
|
|
|
|
# flameshot gui
|
|
# ┗━━━━━━━━━━━━━━━┛
|
|
|
|
wait_for_key
|
|
notify-send "GUI Test 1: --path" "Make a selection, then accept"
|
|
cmd flameshot gui --path /tmp/
|
|
wait_for_key
|
|
notify-send "GUI Test 2: Clipboard" "Make a selection, then accept"
|
|
cmd flameshot gui --clipboard
|
|
wait_for_key
|
|
notify-send "GUI Test 3: Print geometry" "Make a selection, then accept"
|
|
cmd command "$FLAMESHOT" gui --print-geometry
|
|
wait_for_key
|
|
notify-send "GUI Test 4: Pin" "Make a selection, then accept"
|
|
cmd flameshot gui --pin
|
|
wait_for_key
|
|
notify-send "GUI Test 5: Print raw" "Make a selection, then accept"
|
|
cmd command "$FLAMESHOT" gui --raw | display
|
|
wait_for_key
|
|
notify-send "GUI Test 6: Copy on select" "Make a selection, flameshot will close automatically"
|
|
cmd flameshot gui --clipboard --accept-on-select
|
|
wait_for_key
|
|
notify-send "GUI Test 7: File dialog on select" "After selecting, a file dialog will open"
|
|
cmd flameshot gui --accept-on-select
|
|
|
|
# All options except for --print-geometry (incompatible with --raw)
|
|
wait_for_key
|
|
notify-send "GUI Test 8: All actions except print-geometry" "Just make a selection"
|
|
cmd command "$FLAMESHOT" gui -p /tmp/ -c -r --pin | display
|
|
|
|
echo '>> All tests done.'
|