1
0

avatar.feature 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. # SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  2. # SPDX-License-Identifier: AGPL-3.0-or-later
  3. Feature: avatar
  4. Background:
  5. Given user "user0" exists
  6. Scenario: get default user avatar
  7. When user "user0" gets avatar for user "user0"
  8. Then The following headers should be set
  9. | Content-Type | image/png |
  10. | X-NC-IsCustomAvatar | 0 |
  11. And last avatar is a square of size 512
  12. And last avatar is not a single color
  13. Scenario: get default user avatar as an anonymous user
  14. When user "anonymous" gets avatar for user "user0"
  15. Then The following headers should be set
  16. | Content-Type | image/png |
  17. | X-NC-IsCustomAvatar | 0 |
  18. And last avatar is a square of size 512
  19. And last avatar is not a single color
  20. Scenario: get temporary non-square user avatar before cropping it
  21. Given Logging in using web as "user0"
  22. And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
  23. When logged in user gets temporary avatar
  24. Then The following headers should be set
  25. | Content-Type | image/png |
  26. # "last avatar" also includes the last temporary avatar
  27. And last avatar is not a square
  28. And last avatar is not a single color
  29. Scenario: get non-square user avatar before cropping it
  30. Given Logging in using web as "user0"
  31. And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
  32. # Avatar needs to be cropped to finish setting it
  33. When user "user0" gets avatar for user "user0"
  34. Then The following headers should be set
  35. | Content-Type | image/png |
  36. | X-NC-IsCustomAvatar | 0 |
  37. And last avatar is a square of size 512
  38. And last avatar is not a single color
  39. Scenario: set square user avatar from file
  40. Given Logging in using web as "user0"
  41. When logged in user posts temporary avatar from file "data/green-square-256.png"
  42. And user "user0" gets avatar for user "user0"
  43. And The following headers should be set
  44. | Content-Type | image/png |
  45. | X-NC-IsCustomAvatar | 1 |
  46. # Last avatar size is 512 by default when getting avatar without size parameter
  47. And last avatar is a square of size 512
  48. And last avatar is a single "#00FF00" color
  49. And user "anonymous" gets avatar for user "user0"
  50. And The following headers should be set
  51. | Content-Type | image/png |
  52. | X-NC-IsCustomAvatar | 1 |
  53. And last avatar is a square of size 512
  54. And last avatar is a single "#00FF00" color
  55. Scenario: set square user avatar from internal path
  56. Given user "user0" uploads file "data/green-square-256.png" to "/internal-green-square-256.png"
  57. And Logging in using web as "user0"
  58. When logged in user posts temporary avatar from internal path "internal-green-square-256.png"
  59. And user "user0" gets avatar for user "user0" with size "64"
  60. And The following headers should be set
  61. | Content-Type | image/png |
  62. | X-NC-IsCustomAvatar | 1 |
  63. And last avatar is a square of size 64
  64. And last avatar is a single "#00FF00" color
  65. And user "anonymous" gets avatar for user "user0" with size "64"
  66. And The following headers should be set
  67. | Content-Type | image/png |
  68. | X-NC-IsCustomAvatar | 1 |
  69. And last avatar is a square of size 64
  70. And last avatar is a single "#00FF00" color
  71. Scenario: set non-square user avatar from file
  72. Given Logging in using web as "user0"
  73. When logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
  74. And logged in user crops temporary avatar
  75. | x | 384 |
  76. | y | 256 |
  77. | w | 128 |
  78. | h | 128 |
  79. Then logged in user gets temporary avatar with 404
  80. And user "user0" gets avatar for user "user0"
  81. And The following headers should be set
  82. | Content-Type | image/png |
  83. | X-NC-IsCustomAvatar | 1 |
  84. And last avatar is a square of size 512
  85. And last avatar is a single "#FF0000" color
  86. And user "anonymous" gets avatar for user "user0"
  87. And The following headers should be set
  88. | Content-Type | image/png |
  89. | X-NC-IsCustomAvatar | 1 |
  90. And last avatar is a square of size 512
  91. And last avatar is a single "#FF0000" color
  92. Scenario: set non-square user avatar from internal path
  93. Given user "user0" uploads file "data/coloured-pattern-non-square.png" to "/internal-coloured-pattern-non-square.png"
  94. And Logging in using web as "user0"
  95. When logged in user posts temporary avatar from internal path "internal-coloured-pattern-non-square.png"
  96. And logged in user crops temporary avatar
  97. | x | 704 |
  98. | y | 320 |
  99. | w | 64 |
  100. | h | 64 |
  101. Then logged in user gets temporary avatar with 404
  102. And user "user0" gets avatar for user "user0" with size "64"
  103. And The following headers should be set
  104. | Content-Type | image/png |
  105. | X-NC-IsCustomAvatar | 1 |
  106. And last avatar is a square of size 64
  107. And last avatar is a single "#00FF00" color
  108. And user "anonymous" gets avatar for user "user0" with size "64"
  109. And The following headers should be set
  110. | Content-Type | image/png |
  111. | X-NC-IsCustomAvatar | 1 |
  112. And last avatar is a square of size 64
  113. And last avatar is a single "#00FF00" color
  114. Scenario: cropped user avatar needs to be squared
  115. Given Logging in using web as "user0"
  116. And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
  117. When logged in user crops temporary avatar with 400
  118. | x | 384 |
  119. | y | 256 |
  120. | w | 192 |
  121. | h | 128 |
  122. Scenario: delete user avatar
  123. Given Logging in using web as "user0"
  124. And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
  125. And logged in user crops temporary avatar
  126. | x | 384 |
  127. | y | 256 |
  128. | w | 128 |
  129. | h | 128 |
  130. And user "user0" gets avatar for user "user0"
  131. And The following headers should be set
  132. | Content-Type | image/png |
  133. | X-NC-IsCustomAvatar | 1 |
  134. And last avatar is a square of size 512
  135. And last avatar is a single "#FF0000" color
  136. And user "anonymous" gets avatar for user "user0"
  137. And The following headers should be set
  138. | Content-Type | image/png |
  139. | X-NC-IsCustomAvatar | 1 |
  140. And last avatar is a square of size 512
  141. And last avatar is a single "#FF0000" color
  142. When logged in user deletes the user avatar
  143. Then user "user0" gets avatar for user "user0"
  144. And The following headers should be set
  145. | Content-Type | image/png |
  146. | X-NC-IsCustomAvatar | 0 |
  147. And last avatar is a square of size 512
  148. And last avatar is not a single color
  149. And user "anonymous" gets avatar for user "user0"
  150. And The following headers should be set
  151. | Content-Type | image/png |
  152. | X-NC-IsCustomAvatar | 0 |
  153. And last avatar is a square of size 512
  154. And last avatar is not a single color
  155. Scenario: get user avatar with a larger size than the original one
  156. Given Logging in using web as "user0"
  157. And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
  158. And logged in user crops temporary avatar
  159. | x | 384 |
  160. | y | 256 |
  161. | w | 128 |
  162. | h | 128 |
  163. When user "user0" gets avatar for user "user0" with size "192"
  164. Then The following headers should be set
  165. | Content-Type | image/png |
  166. | X-NC-IsCustomAvatar | 1 |
  167. And last avatar is a square of size 512
  168. And last avatar is a single "#FF0000" color
  169. Scenario: get user avatar with a smaller size than the original one
  170. Given Logging in using web as "user0"
  171. And logged in user posts temporary avatar from file "data/coloured-pattern-non-square.png"
  172. And logged in user crops temporary avatar
  173. | x | 384 |
  174. | y | 256 |
  175. | w | 128 |
  176. | h | 128 |
  177. When user "user0" gets avatar for user "user0" with size "96"
  178. Then The following headers should be set
  179. | Content-Type | image/png |
  180. | X-NC-IsCustomAvatar | 1 |
  181. And last avatar is a square of size 512
  182. And last avatar is a single "#FF0000" color
  183. Scenario: get default guest avatar
  184. When user "user0" gets avatar for guest "guest0"
  185. Then The following headers should be set
  186. | Content-Type | image/png |
  187. And last avatar is a square of size 512
  188. And last avatar is not a single color
  189. Scenario: get default guest avatar as an anonymous user
  190. When user "anonymous" gets avatar for guest "guest0"
  191. Then The following headers should be set
  192. | Content-Type | image/png |
  193. And last avatar is a square of size 512
  194. And last avatar is not a single color