generateScreenshotOverview.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/bash
  2. #
  3. # SPDX-FileCopyrightText: 2021-2024 Nextcloud GmbH and Nextcloud contributors
  4. # SPDX-FileCopyrightText: 2021 Tobias Kaminsky <tobias@kaminsky.me>
  5. # SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
  6. error=0
  7. total=0
  8. cp scripts/screenshotCombinations scripts/screenshotCombinations_
  9. grep -v "#" scripts/screenshotCombinations_ > scripts/screenshotCombinations
  10. rm scripts/screenshotCombinations_
  11. echo '<!DOCTYPE html>
  12. <html lang="de">
  13. <head>
  14. <meta charset="utf-8"/>
  15. </head>'
  16. echo "<table>"
  17. echo "<tr><td style='width:150px'>Original</td>"
  18. while read line; do
  19. echo "<td style='width:150px'>$line</td>"
  20. done < scripts/screenshotCombinations
  21. echo "</tr>"
  22. #for image in ./build/reports/shot/verification/images/*.png ; do
  23. for image in $(/bin/ls -1 ./screenshots/gplay/debug/*.png | grep -v _dark_ | grep -v _light_) ; do
  24. cp $image app/build/screenshotSummary/images/
  25. echo "<tr style='height:200px'>"
  26. echo "<td><a target='_blank' href=\"images/$(basename $image)\"><img width=100px src=\"images/$(basename $image)\"/></a></td>"
  27. while read line; do
  28. echo "<td>"
  29. mode=$(echo $line | cut -d" " -f1)
  30. color=$(echo $line | cut -d" " -f2)
  31. total=$((total + 1))
  32. if [ $mode = "light" -a $color = "blue" ]; then
  33. name=$(basename $image)
  34. else
  35. name=$(basename $image| sed s"/\.png/_${mode}_$color\.png/")
  36. fi
  37. # if image does not exist
  38. if [ ! -e ./app/build/reports/shot/verification/images/$name ]; then
  39. echo "<span style='color: red'>✘</span>"
  40. error=$((error + 1))
  41. elif [ -e ./app/build/reports/shot/verification/images/diff_$name ]; then
  42. # file with "diff_" prefix
  43. cp ./app/build/reports/shot/verification/images/diff_$name build/screenshotSummary/images/
  44. echo "<a target='_blank' href=\"images/diff_$name\"><img width=100px src=\"images/diff_$name\"/></a>"
  45. error=$((error + 1))
  46. else
  47. echo "✔"
  48. fi
  49. echo "</td>"
  50. done < scripts/screenshotCombinations
  51. echo "</tr>"
  52. done
  53. echo "</table>"
  54. echo "ERROR: $error / $total"
  55. echo "</html>"