avatar.feature 8.4 KB

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