Test the other aspect ratio else
commit7dc20012a99f454e812f63e546b579aab6e7812e
authorAlbert Astals <albert.astals@canonical.com>
dateFri 31 Oct 2014, 15:35 (12 years ago)
parent92d6fcc
plugins/Dash/croppedimagesizer.cpp+1−1
@@ -99,7 +99,7 @@ void CroppedImageSizer::requestFinished()
9999 if (imageSize.isValid()) {
100100 if (m_height > 0 && imageSize.height() > 0) {
101101 const qreal ar = m_width / m_height;
102− const qreal ssar = imageSize.width() / imageSize.height();
102+ const qreal ssar = imageSize.width() / (qreal)imageSize.height();
103103 if (ar > ssar) {
104104 m_sourceSize = QSize(m_width, 0);
105105 } else {
tests/plugins/Dash/tst_CroppedImageMinimumSourceSize.qml+5
@@ -41,8 +41,13 @@ Rectangle {
4141 when: windowShown
4242
4343 function test_croppedSource() {
44+ cimss.width = 100;
4445 tryCompare(cimss.image.sourceSize, "width", 100);
4546 tryCompare(cimss.image.sourceSize, "height", 0);
47+
48+ cimss.width = 40;
49+ tryCompare(cimss.image.sourceSize, "width", 0);
50+ tryCompare(cimss.image.sourceSize, "height", 100);
4651 }
4752 }
4853}