Modified distance function to keep aspect ratio as close as possible
This new version of the distance function simplifies the
findPreferredImageInPackage method by using the aspect ratio in the
calculation. Now, it won't only search for a wallpaper with the same
aspect ratio, but will also choose one with the closest possible
aspect ratio when a perfect match is not found.
Also, I separated the method that chooses the preferred image
to not use KPackage in order to use it from a test application
that tests the distance algorithm with all possible resolutions.
Test application that tests the Image::findPreferredImage method
The test initializes a list of available wallpaper image sizes,
then a list of screen resolutions, and then executes
Image::findPreferredImage to find out which is the preferred image
in each case.
I tested with different screen resolutions on a virtual machine with
openSUSE Leap 42.2 RC1 and also included a commit that adds a test
application (not built by default) that tests all possible resolutions.
Reviewers: Plasma, mart
Reviewed By: mart
Subscribers: mart, plasma-devel
Differential Revision: https://phabricator.kde.org/D3188