Skip to content

Commit

Permalink
Fix test failure in 3.7_get_screenshot
Browse files Browse the repository at this point in the history
  • Loading branch information
thevindu-w committed Apr 27, 2024
1 parent 52e6c42 commit 09ee90f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions tests/scripts/common/get_screenshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,31 @@ if [ "${responseDump::len_expected_header}" != "$expected_proto_method_ack" ]; t
exit 1
fi

length="$((16#${responseDump:len_expected_header:16}))"
responseDump="${responseDump:len_expected_header}"

if [ ! -z "$disp" ]; then
if [ "${responseDump::2}" != "$METHOD_OK" ]; then
showStatus info 'Incorrect display ack.'
echo 'Expected:' "$METHOD_OK"
echo 'Received:' "${responseDump::2}"
exit 1
fi
responseDump="${responseDump:2}"
fi

length="$((16#${responseDump::16}))"
responseDump="${responseDump:16}"

if [ "$length" -le '512' ]; then
if [ "$length" -le '512' ] || [ "$length" != "$((${#responseDump} / 2))" ]; then
echo "$length" "${#responseDump}"
showStatus info 'Invalid image length.'
exit 1
fi

len_expected_header="$((len_expected_header + 16))"

expected_png_header="$(printf '\x89PNG\r\n\x1a\n' | bin2hex)"
png_header="${responseDump:len_expected_header:${#expected_png_header}}"
png_header="${responseDump::${#expected_png_header}}"

if [ "$png_header" != "$expected_png_header" ]; then
showStatus info 'Invalid image header.'
Expand Down

0 comments on commit 09ee90f

Please sign in to comment.