Add SetMeta filter to store uploaded image sizes
This commit is contained in:
parent
b221d77a6d
commit
ab9eabdf20
5 changed files with 83 additions and 2 deletions
19
test/pleroma/upload/filter/set_meta_test.exs
Normal file
19
test/pleroma/upload/filter/set_meta_test.exs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Upload.Filter.SetMetaTest do
|
||||
use Pleroma.DataCase, async: true
|
||||
alias Pleroma.Upload.Filter.SetMeta
|
||||
|
||||
test "adds the image dimensions" do
|
||||
upload = %Pleroma.Upload{
|
||||
name: "an… image.jpg",
|
||||
content_type: "image/jpeg",
|
||||
path: Path.absname("test/fixtures/image.jpg"),
|
||||
tempfile: Path.absname("test/fixtures/image.jpg")
|
||||
}
|
||||
|
||||
assert {:ok, :filtered, %{width: 1024, height: 768}} = SetMeta.filter(upload)
|
||||
end
|
||||
end
|
||||
|
|
@ -458,7 +458,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
|||
"url" => [
|
||||
%{
|
||||
"mediaType" => "image/png",
|
||||
"href" => "someurl"
|
||||
"href" => "someurl",
|
||||
"width" => 200,
|
||||
"height" => 100
|
||||
}
|
||||
],
|
||||
"blurhash" => "UJJ8X[xYW,%Jtq%NNFbXB5j]IVM|9GV=WHRn",
|
||||
|
|
@ -474,6 +476,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusViewTest do
|
|||
text_url: "someurl",
|
||||
description: nil,
|
||||
pleroma: %{mime_type: "image/png"},
|
||||
meta: %{original: %{width: 200, height: 100, aspect: 2}},
|
||||
blurhash: "UJJ8X[xYW,%Jtq%NNFbXB5j]IVM|9GV=WHRn"
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue