aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickflickable
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-07-22 10:49:32 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-08-02 18:34:30 +0200
commit74f0d15e08fe718fd406ac53e691e68f8ef46e11 (patch)
tree9b8b450a1033f065d9646298b3d0faa18a08577f /tests/auto/quick/qquickflickable
parentfa53d4e35433cc59e99b24f16f18c713683c1a80 (diff)
parent6839f03051d2950e4721cbb5ee88fa7b07109588 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: src/quick/items/qquickshadereffect.cpp 5.7 had a bug-fix in code dev has replaced wholesale. src/quick/items/qquickwindow.cpp src/quick/items/qquickwindow_p.h One side changed a method's signature; the other side renamed a method declared adjacent to it and changed some code using it, moving some from the public class to its private partner. tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp One side added a blank line before a comment the other re-wrote. Kept the re-write, killed the stray blank. .qmake.conf Ignore 5.7's change to MODULE_VERSION. src/qml/compiler/qqmltypecompiler.cpp src/qml/compiler/qqmlpropertyvalidator.cpp 5.7 changed code in the former that dev moved to the latter. Reflect 5.7's changes there, adapted to dev's form. src/qml/qml/qqmlobjectcreator.cpp One side added new QVariant types; the other changed how it handled each type of QVariant (without git seeing any conflict); adapted the new stanzas to work the same as the transformed ones. tests/manual/v4/test262 dev had a broken sha1 for it; so used 5.7's 9741ac4655808ac46c127e3d1d8ba3d27ada618e Change-Id: I1fbe2255b97d6ef405cdd1d0cea7fab8dc351d6f
Diffstat (limited to 'tests/auto/quick/qquickflickable')
-rw-r--r--tests/auto/quick/qquickflickable/data/ratios_smallContent.qml19
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp28
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickflickable/data/ratios_smallContent.qml b/tests/auto/quick/qquickflickable/data/ratios_smallContent.qml
new file mode 100644
index 0000000000..07bad683ee
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/ratios_smallContent.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.0
+
+Flickable {
+ property double heightRatioIs: visibleArea.heightRatio
+ property double widthRatioIs: visibleArea.widthRatio
+
+ width: 200
+ height: 200
+ contentWidth: item.width
+ contentHeight: item.height
+ topMargin: 20
+ leftMargin: 40
+
+ Item {
+ id: item
+ width: 100
+ height: 100
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 2742f5c1e2..e1678b9acd 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -90,6 +90,7 @@ private slots:
void movementFromProgrammaticFlick();
void cleanup();
void contentSize();
+ void ratios_smallContent();
private:
void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
@@ -1814,6 +1815,33 @@ void tst_qquickflickable::contentSize()
QCOMPARE(chspy.count(), 1);
}
+// QTBUG-53726
+void tst_qquickflickable::ratios_smallContent()
+{
+ QScopedPointer<QQuickView> window(new QQuickView);
+ window->setSource(testFileUrl("ratios_smallContent.qml"));
+ QTRY_COMPARE(window->status(), QQuickView::Ready);
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
+ window->setTitle(QTest::currentTestFunction());
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window.data()));
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root);
+ QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root);
+ QVERIFY(obj != 0);
+
+ //doublecheck the item, as specified by contentWidth/Height, fits in the view
+ //use tryCompare to allow a bit of stabilization in component's properties
+ QTRY_COMPARE(obj->leftMargin() + obj->contentWidth() + obj->rightMargin() <= obj->width(), true);
+ QTRY_COMPARE(obj->topMargin() + obj->contentHeight() + obj->bottomMargin() <= obj->height(), true);
+
+ //the whole item fits in the flickable, heightRatio should be 1
+ QCOMPARE(obj->property("heightRatioIs").toDouble(), 1.);
+ QCOMPARE(obj->property("widthRatioIs").toDouble(), 1.);
+}
+
+
QTEST_MAIN(tst_qquickflickable)
#include "tst_qquickflickable.moc"