avatar.feature 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  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 128
  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 128
  17. And last avatar is not a single color
  18. Scenario: get temporary user avatar before cropping it
  19. Given Logging in using web as "user0"
  20. And logged in user posts temporary avatar from file "data/green-square-256.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 a square of size 256
  26. And last avatar is a single "#00FF00" color
  27. Scenario: get user avatar before cropping it
  28. Given Logging in using web as "user0"
  29. And logged in user posts temporary avatar from file "data/green-square-256.png"
  30. # Avatar needs to be cropped to finish setting it even if it is squared
  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 128
  36. And last avatar is not a single color
  37. Scenario: set user avatar from file
  38. Given Logging in using web as "user0"
  39. When logged in user posts temporary avatar from file "data/coloured-pattern.png"
  40. And logged in user crops temporary avatar
  41. | x | 384 |
  42. | y | 256 |
  43. | w | 128 |
  44. | h | 128 |
  45. Then logged in user gets temporary avatar with 404
  46. And user "user0" gets avatar for user "user0"
  47. And The following headers should be set
  48. | Content-Type | image/png |
  49. | X-NC-IsCustomAvatar | 1 |
  50. And last avatar is a square of size 128
  51. And last avatar is a single "#FF0000" color
  52. And user "anonymous" gets avatar for user "user0"
  53. And The following headers should be set
  54. | Content-Type | image/png |
  55. | X-NC-IsCustomAvatar | 1 |
  56. And last avatar is a square of size 128
  57. And last avatar is a single "#FF0000" color
  58. Scenario: set user avatar from internal path
  59. Given user "user0" uploads file "data/coloured-pattern.png" to "/internal-coloured-pattern.png"
  60. And Logging in using web as "user0"
  61. When logged in user posts temporary avatar from internal path "internal-coloured-pattern.png"
  62. And logged in user crops temporary avatar
  63. | x | 704 |
  64. | y | 320 |
  65. | w | 64 |
  66. | h | 64 |
  67. Then logged in user gets temporary avatar with 404
  68. And user "user0" gets avatar for user "user0" with size "64"
  69. And The following headers should be set
  70. | Content-Type | image/png |
  71. | X-NC-IsCustomAvatar | 1 |
  72. And last avatar is a square of size 64
  73. And last avatar is a single "#00FF00" color
  74. And user "anonymous" gets avatar for user "user0" with size "64"
  75. And The following headers should be set
  76. | Content-Type | image/png |
  77. | X-NC-IsCustomAvatar | 1 |
  78. And last avatar is a square of size 64
  79. And last avatar is a single "#00FF00" color
  80. Scenario: cropped user avatar needs to be squared
  81. Given Logging in using web as "user0"
  82. And logged in user posts temporary avatar from file "data/coloured-pattern.png"
  83. When logged in user crops temporary avatar with 400
  84. | x | 384 |
  85. | y | 256 |
  86. | w | 192 |
  87. | h | 128 |
  88. Scenario: delete user avatar
  89. Given Logging in using web as "user0"
  90. And logged in user posts temporary avatar from file "data/coloured-pattern.png"
  91. And logged in user crops temporary avatar
  92. | x | 384 |
  93. | y | 256 |
  94. | w | 128 |
  95. | h | 128 |
  96. And user "user0" gets avatar for user "user0"
  97. And The following headers should be set
  98. | Content-Type | image/png |
  99. | X-NC-IsCustomAvatar | 1 |
  100. And last avatar is a square of size 128
  101. And last avatar is a single "#FF0000" color
  102. And user "anonymous" gets avatar for user "user0"
  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 128
  107. And last avatar is a single "#FF0000" color
  108. When logged in user deletes the user avatar
  109. Then user "user0" gets avatar for user "user0"
  110. And The following headers should be set
  111. | Content-Type | image/png |
  112. | X-NC-IsCustomAvatar | 0 |
  113. And last avatar is a square of size 128
  114. And last avatar is not a single color
  115. And user "anonymous" gets avatar for user "user0"
  116. And The following headers should be set
  117. | Content-Type | image/png |
  118. | X-NC-IsCustomAvatar | 0 |
  119. And last avatar is a square of size 128
  120. And last avatar is not a single color
  121. Scenario: get user avatar with a larger size than the original one
  122. Given Logging in using web as "user0"
  123. And logged in user posts temporary avatar from file "data/coloured-pattern.png"
  124. And logged in user crops temporary avatar
  125. | x | 384 |
  126. | y | 256 |
  127. | w | 128 |
  128. | h | 128 |
  129. When user "user0" gets avatar for user "user0" with size "192"
  130. Then The following headers should be set
  131. | Content-Type | image/png |
  132. | X-NC-IsCustomAvatar | 1 |
  133. And last avatar is a square of size 192
  134. And last avatar is a single "#FF0000" color
  135. Scenario: get user avatar with a smaller size than the original one
  136. Given Logging in using web as "user0"
  137. And logged in user posts temporary avatar from file "data/coloured-pattern.png"
  138. And logged in user crops temporary avatar
  139. | x | 384 |
  140. | y | 256 |
  141. | w | 128 |
  142. | h | 128 |
  143. When user "user0" gets avatar for user "user0" with size "96"
  144. Then The following headers should be set
  145. | Content-Type | image/png |
  146. | X-NC-IsCustomAvatar | 1 |
  147. And last avatar is a square of size 96
  148. And last avatar is a single "#FF0000" color
  149. Scenario: get default guest avatar
  150. When user "user0" gets avatar for guest "guest0"
  151. Then The following headers should be set
  152. | Content-Type | image/png |
  153. And last avatar is a square of size 128
  154. And last avatar is not a single color
  155. Scenario: get default guest avatar as an anonymous user
  156. When user "anonymous" gets avatar for guest "guest0"
  157. Then The following headers should be set
  158. | Content-Type | image/png |
  159. And last avatar is a square of size 128
  160. And last avatar is not a single color