Skip to content

Commit

Permalink
test(images): enable test for refusal to upscale thumbnail
Browse files Browse the repository at this point in the history
This test should have been enabled when PR lektor#960 was merged.
  • Loading branch information
dairiki committed Sep 11, 2023
1 parent 64e6019 commit aa742df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion tests/demo-project/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ <h1>{{ this.title }}</h1>

{# larger than original#}
{% set t0 = img.thumbnail(400, 600, upscale=True) %}
<img alt="original" src="{{ t0|url }}" width="{{ t0.width }}" height="{{ t0.height }}">
<img alt="upscaled" src="{{ t0|url }}" width="{{ t0.width }}" height="{{ t0.height }}">
{% set t1 = img.thumbnail(400, 600, upscale=False) %}
<img alt="original" src="{{ t1|url }}" width="{{ t1.width }}" height="{{ t1.height }}">
{% endfor %}

{# Not all subpages have a video clip, so we test for that here #}
Expand Down
4 changes: 1 addition & 3 deletions tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,14 @@ def test_thumbnail_quality(builder):
assert image_size < 9200


# TODO: delete this when the thumbnails backwards-compatibility period ends
@pytest.mark.skip(reason="future behaviour")
def test_large_thumbnail_returns_original(builder):
builder.build_all()
with open(
os.path.join(builder.destination_path, "index.html"), encoding="utf-8"
) as f:
html = f.read()

assert '<img alt="original" src="./test.jpg" width="384" height="512">' in html
assert '<img alt="original" src="test.jpg" width="384" height="512">' in html


def test_dimensions():
Expand Down

0 comments on commit aa742df

Please sign in to comment.