Feature: Small input images are not enlarged for thumbnails.
If the input file is smaller than the requested thumb size,
the biggest XDG size which is bigger than the input file is returned.
The actual thumb image will have the same dimensions as the input file.
Remember, the thumb edge sizes for the XDG sizes are:
* 128 (normal)
* 256 (large)
* 512 (x-large)
* 1024 (xx-large)
Example:
Given an input image with a maximum edge length of 200 pixels,
When we request an x-large thumbnail, the requested thumbnail edge
length is 512 and therewith greater than the edge length of the input image.
As a result, AMT will return the smallest XDG size which is bigger than the
input image. In this case "large", because "large" has a max. edge length of 256,
which is still bigger than the edge length of the input file, but there is no smaller
XDG size which fulfills this criterion.
Even though the returned thumbnail has XDG size "large", the actual thumbnail image
has the original dimension of the input file. It's not scaled up.
The `-F` switch changes this behavior a little.
With the `-F` switch, the returned XDG size will always be the one requested.
So, in the above example, AMT will return the path to the x-large thumb.
However, the dimensions of the thumbnail will still be the same as the dimensions
of the original file.
The `-F` switch is just for compatibility reasons. In case some client checks the path,
this will always return a path that matches the requested size.
However, clients shouldn't mess with the thumbnail logic and just accept the path returned
by AMT (or any other XDG-thumbnail wrapper).
_Not_ using `-F` saves unnecessary computation and disk space.
Scenario Outline: Input smaller than thumb
Given a JPEG image with edge size as input
And no thumbs exist
When allmytoes is started with arguments
Then the path to the thumb is returned
And the thumb is a PNG image with max size
And no thumb exists for sizes other than
Examples: Small 100px image, without `-F` switch
| input size | argument | XDG thumb size | thumb pixel size |
| 100 | -sn | normal | 100 |
| 100 | -sl | normal | 100 |
Examples: Medium 500px image, without `-F` switch
| input size | argument | XDG thumb size | thumb pixel size |
| 500 | -sn | normal | 128 |
| 500 | -sl | large | 256 |
| 500 | -sx | x-large | 500 |
| 500 | -sxx | x-large | 500 |
Examples: Small 100px image, with `-F` switch
| input size | argument | XDG thumb size | thumb pixel size |
| 100 | -Fsn | normal | 100 |
| 100 | -Fsl | large | 100 |
Examples: Medium 500px image, with `-F` switch
| input size | argument | XDG thumb size | thumb pixel size |
| 500 | -Fsn | normal | 128 |
| 500 | -Fsl | large | 256 |
| 500 | -Fsx | x-large | 500 |
| 500 | -Fsxx | xx-large | 500 |
Scenario: Requested size is not feasible but exists
Given a JPEG image with edge size 100 as input
# Which is smaller than any thumb size
And a thumb for size x-large exists for the input in standard DB
# Which is way too big; "normal" size would be feasible
When allmytoes is started with arguments -sx
# Which is asking for the too big but existing thumb
Then the path to the x-large thumb is returned
And no thumb exists for sizes other than x-large
And the thumbs have not been changed
Scenario: Requested size does not exist but feasible size does
Given a JPEG image with edge size 100 as input
# Which is smaller than any thumb size
And a thumb for size normal exists for the input in standard DB
# Which is the feasible size
When allmytoes is started with arguments -sx
# Which is asking for a unnecessary big thumb
Then the path to the normal thumb is returned
And no thumb exists for sizes other than normal
And the thumbs have not been changed
# After AMT has not found the requested size, it has checked for the feasible one and returns it