Document and test focus

This commit is contained in:
Lorenz Diener 2018-06-04 21:20:43 +02:00
parent 362767f911
commit 465981ea9a
5 changed files with 2880 additions and 2868 deletions

View File

@ -409,6 +409,7 @@ Media dicts
# May additionally contain an "fps" field giving a videos frames per second (possibly # May additionally contain an "fps" field giving a videos frames per second (possibly
# rounded), and a "length" field giving a videos length in a human-readable format. # rounded), and a "length" field giving a videos length in a human-readable format.
# Note that a video may have an image as preview. # Note that a video may have an image as preview.
# May also contain a 'focus' dict.
} }
# Metadata dicts (image) - all fields are optional: # Metadata dicts (image) - all fields are optional:
@ -429,6 +430,12 @@ Media dicts
'bitrate': # Average bit-rate of the video in bytes per second 'bitrate': # Average bit-rate of the video in bytes per second
} }
# Focus Metadata dict:
{
'x': Focus point x coordinate (between -1 and 1)
'y': Focus point x coordinate (between -1 and 1)
}
Card dicts Card dicts
~~~~~~~~~~ ~~~~~~~~~~
.. _card dict: .. _card dict:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,9 @@ import pytest
def test_media_post(api, sensitive): def test_media_post(api, sensitive):
media = api.media_post( media = api.media_post(
'tests/image.jpg', 'tests/image.jpg',
description="John Lennon doing a funny walk") description="John Lennon doing a funny walk",
focus=(-0.5, 0.3))
assert media assert media
status = api.status_post( status = api.status_post(
@ -21,6 +22,8 @@ def test_media_post(api, sensitive):
assert status['sensitive'] == sensitive assert status['sensitive'] == sensitive
assert status['media_attachments'] assert status['media_attachments']
assert status['media_attachments'][0]['description'] assert status['media_attachments'][0]['description']
assert status['media_attachments'][0]['meta']['focus']['x'] == -0.5
assert status['media_attachments'][0]['meta']['focus']['y'] == 0.3
finally: finally:
api.status_delete(status['id']) api.status_delete(status['id'])