on xenial help sign in
Test the other aspect ratio else
7dc2001Albert Astals
plugins/Dash/croppedimagesizer.cpp+1−1
@@ -99,7 +99,7 @@ void CroppedImageSizer::requestFinished()
99 if (imageSize.isValid()) {
99 if (imageSize.isValid()) {
100 if (m_height > 0 && imageSize.height() > 0) {
100 if (m_height > 0 && imageSize.height() > 0) {
101 const qreal ar = m_width / m_height;
101 const qreal ar = m_width / m_height;
102− const qreal ssar = imageSize.width() / imageSize.height();
102+ const qreal ssar = imageSize.width() / (qreal)imageSize.height();
103 if (ar > ssar) {
103 if (ar > ssar) {
104 m_sourceSize = QSize(m_width, 0);
104 m_sourceSize = QSize(m_width, 0);
105 } else {
105 } else {
tests/plugins/Dash/tst_CroppedImageMinimumSourceSize.qml+5
@@ -41,8 +41,13 @@ Rectangle {
41 when: windowShown
41 when: windowShown
42
42
43 function test_croppedSource() {
43 function test_croppedSource() {
44+ cimss.width = 100;
44 tryCompare(cimss.image.sourceSize, "width", 100);
45 tryCompare(cimss.image.sourceSize, "width", 100);
45 tryCompare(cimss.image.sourceSize, "height", 0);
46 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);
46 }
51 }
47 }
52 }
48}
53}