diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-03-09 03:03:10 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-03-09 03:03:10 +0100 |
commit | 08ceb93cf16dcdc771935ac66e6c4b5ce02ec36d (patch) | |
tree | 085eea2609704d84906ca3ab2ac4245653044a2d /tests/auto | |
parent | 1693a19fd557c857ef4f43ab303ea1056790481e (diff) | |
parent | 1ef176b5da8ad8d4993fa9296e64e44ee8de6560 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I34009799fe4016339920a7f0884af4dbe6d71418
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/controls/data/tst_scrollview.qml | 89 | ||||
-rw-r--r-- | tests/auto/controls/data/tst_tooltip.qml | 65 |
2 files changed, 154 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml index 4d5b1e5b..87c39509 100644 --- a/tests/auto/controls/data/tst_scrollview.qml +++ b/tests/auto/controls/data/tst_scrollview.qml @@ -146,6 +146,40 @@ TestCase { } Component { + id: scrollableFlickable + ScrollView { + Flickable { + Item { + width: 100 + height: 100 + } + } + } + } + + Component { + id: scrollableWithContentSize + ScrollView { + contentWidth: 1000 + contentHeight: 1000 + Flickable { + } + } + } + + Component { + id: scrollableAndFlicableWithContentSize + ScrollView { + contentWidth: 1000 + contentHeight: 1000 + Flickable { + contentWidth: 200 + contentHeight: 200 + } + } + } + + Component { id: scrollableTextArea ScrollView { TextArea { @@ -257,6 +291,61 @@ TestCase { compare(control.contentHeight, listview.contentHeight) } + function test_scrollableFlickable() { + // Check that if the application adds a flickable as a child of a + // scrollview, the scrollview doesn't try to calculate and change + // the flickables contentWidth/Height based on the flickables + // children, even if the flickable has an empty or negative content + // size. Some flickables (e.g ListView) sets a negative + // contentWidth on purpose, which should be respected. + var scrollview = createTemporaryObject(scrollableFlickable, testCase) + verify(scrollview) + + var flickable = scrollview.contentItem + verify(flickable.hasOwnProperty("contentX")) + verify(flickable.hasOwnProperty("contentY")) + + compare(flickable.contentWidth, -1) + compare(flickable.contentHeight, -1) + compare(scrollview.contentWidth, -1) + compare(scrollview.contentHeight, -1) + } + + function test_scrollableWithContentSize() { + // Check that if the scrollview has contentWidth/Height set, but + // not the flickable, then those values will be forwarded and used + // by the flickable (rather than trying to calculate the content size + // based on the flickables children). + var scrollview = createTemporaryObject(scrollableWithContentSize, testCase) + verify(scrollview) + + var flickable = scrollview.contentItem + verify(flickable.hasOwnProperty("contentX")) + verify(flickable.hasOwnProperty("contentY")) + + compare(flickable.contentWidth, 1000) + compare(flickable.contentHeight, 1000) + compare(scrollview.contentWidth, 1000) + compare(scrollview.contentHeight, 1000) + } + + function test_scrollableAndFlickableWithContentSize() { + // Check that if both the scrollview and the flickable has + // contentWidth/Height set (which is an inconsistency/fault + // by the app), the content size of the scrollview wins. + var scrollview = createTemporaryObject(scrollableAndFlicableWithContentSize, testCase) + verify(scrollview) + + var flickable = scrollview.contentItem + verify(flickable.hasOwnProperty("contentX")) + verify(flickable.hasOwnProperty("contentY")) + + compare(flickable.contentWidth, 1000) + compare(flickable.contentHeight, 1000) + compare(scrollview.contentWidth, 1000) + compare(scrollview.contentHeight, 1000) + } + function test_flickableWithExplicitContentSize() { var control = createTemporaryObject(emptyFlickable, testCase) verify(control) diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml index 8a855ce0..18911895 100644 --- a/tests/auto/controls/data/tst_tooltip.qml +++ b/tests/auto/controls/data/tst_tooltip.qml @@ -347,4 +347,69 @@ TestCase { verify(tip.visible) tryCompare(tip, "visible", false) } + + Component { + id: timeoutButtonRowComponent + + Row { + Button { + text: "Timeout: 1" + ToolTip.text: text + ToolTip.visible: down + ToolTip.timeout: 1 + } + + Button { + text: "Timeout: -1" + ToolTip.text: text + ToolTip.visible: down + } + } + } + + // QTBUG-74226 + function test_attachedTimeout() { + var row = createTemporaryObject(timeoutButtonRowComponent, testCase) + verify(row) + + // Press the button that has no timeout; it should stay visible. + var button2 = row.children[1] + mousePress(button2) + compare(button2.down, true) + tryCompare(button2.ToolTip.toolTip, "opened", true) + + // Wait a bit to make sure that it's still visible. + wait(50) + compare(button2.ToolTip.toolTip.opened, true) + + // Release and should close. + mouseRelease(button2) + compare(button2.down, false) + tryCompare(button2.ToolTip, "visible", false) + + // Now, press the first button that does have a timeout; it should close on its own eventually. + var button1 = row.children[0] + mousePress(button1) + compare(button1.down, true) + // We use a short timeout to speed up the test, but tryCompare(...opened, true) then + // fails because the dialog has already been hidden by that point, so just check that it's + // immediately visible, which is more or less the same thing. + compare(button1.ToolTip.visible, true) + tryCompare(button1.ToolTip, "visible", false) + mouseRelease(button2) + + // Now, hover over the second button again. It should still stay visible until the mouse is released. + mousePress(button2) + compare(button2.down, true) + tryCompare(button2.ToolTip.toolTip, "opened", true) + + // Wait a bit to make sure that it's still visible. + wait(50) + compare(button2.ToolTip.toolTip.opened, true) + + // Release and should close. + mouseRelease(button2) + compare(button2.down, false) + tryCompare(button2.ToolTip, "visible", false) + } } |