generateScreenshotOverview.sh 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/bash
  2. #
  3. # Nextcloud Android client application
  4. #
  5. # @author Tobias Kaminsky
  6. # Copyright (C) 2021 Tobias Kaminsky
  7. # Copyright (C) 2021 Nextcloud GmbH
  8. #
  9. # This program is free software: you can redistribute it and/or modify
  10. # it under the terms of the GNU Affero General Public License as published by
  11. # the Free Software Foundation, either version 3 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This program is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU Affero General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Affero General Public License
  20. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. #
  22. error=0
  23. total=0
  24. cp scripts/screenshotCombinations scripts/screenshotCombinations_
  25. grep -v "#" scripts/screenshotCombinations_ > scripts/screenshotCombinations
  26. rm scripts/screenshotCombinations_
  27. echo '<!DOCTYPE html>
  28. <html lang="de">
  29. <head>
  30. <meta charset="utf-8"/>
  31. </head>'
  32. echo "<table>"
  33. echo "<tr><td style='width:150px'>Original</td>"
  34. while read line; do
  35. echo "<td style='width:150px'>$line</td>"
  36. done < scripts/screenshotCombinations
  37. echo "</tr>"
  38. #for image in ./build/reports/shot/verification/images/*.png ; do
  39. for image in $(/bin/ls -1 ./screenshots/gplay/debug/*.png | grep -v _dark_ | grep -v _light_) ; do
  40. cp $image app/build/screenshotSummary/images/
  41. echo "<tr style='height:200px'>"
  42. echo "<td><a target='_blank' href=\"images/$(basename $image)\"><img width=100px src=\"images/$(basename $image)\"/></a></td>"
  43. while read line; do
  44. echo "<td>"
  45. mode=$(echo $line | cut -d" " -f1)
  46. color=$(echo $line | cut -d" " -f2)
  47. total=$((total + 1))
  48. if [ $mode = "light" -a $color = "blue" ]; then
  49. name=$(basename $image)
  50. else
  51. name=$(basename $image| sed s"/\.png/_${mode}_$color\.png/")
  52. fi
  53. # if image does not exist
  54. if [ ! -e ./app/build/reports/shot/verification/images/$name ]; then
  55. echo "<span style='color: red'>✘</span>"
  56. error=$((error + 1))
  57. elif [ -e ./app/build/reports/shot/verification/images/diff_$name ]; then
  58. # file with "diff_" prefix
  59. cp ./app/build/reports/shot/verification/images/diff_$name build/screenshotSummary/images/
  60. echo "<a target='_blank' href=\"images/diff_$name\"><img width=100px src=\"images/diff_$name\"/></a>"
  61. error=$((error + 1))
  62. else
  63. echo "✔"
  64. fi
  65. echo "</td>"
  66. done < scripts/screenshotCombinations
  67. echo "</tr>"
  68. done
  69. echo "</table>"
  70. echo "ERROR: $error / $total"
  71. echo "</html>"