MM-12007 Add max dimensions to emoji images (5.3) (#9407)
Этот коммит содержится в:
коммит произвёл
Carlos Tadeu Panato Junior
родитель
7d60bc8cf5
Коммит
fd21e53365
@@ -9,6 +9,7 @@ import (
|
||||
_ "image/gif"
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost-server/app"
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/utils"
|
||||
|
||||
@@ -105,16 +106,26 @@ func TestCreateEmoji(t *testing.T) {
|
||||
t.Fatal("create with wrong name")
|
||||
}
|
||||
|
||||
// try to create an emoji that's too wide
|
||||
emoji = &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
Name: model.NewId(),
|
||||
}
|
||||
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, app.MaxEmojiOriginalWidth+1), "image.gif")
|
||||
if resp.Error == nil {
|
||||
t.Fatal("should fail - emoji is too wide")
|
||||
}
|
||||
|
||||
// try to create an emoji that's too tall
|
||||
emoji = &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
Name: model.NewId(),
|
||||
}
|
||||
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 1000), "image.gif")
|
||||
CheckNoError(t, resp)
|
||||
if newEmoji.Name != emoji.Name {
|
||||
t.Fatal("create with wrong name")
|
||||
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, app.MaxEmojiOriginalHeight+1, 10), "image.gif")
|
||||
if resp.Error == nil {
|
||||
t.Fatal("should fail - emoji is too tall")
|
||||
}
|
||||
|
||||
// try to create an emoji that's too large
|
||||
|
||||
Ссылка в новой задаче
Block a user