diff options
author | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-05-28 10:01:09 +0200 |
---|---|---|
committer | Richard Moe Gustavsen <richard.gustavsen@qt.io> | 2020-06-02 11:16:30 +0200 |
commit | 257054f2cc6d79e763a12b350ffcc18787d0ac8c (patch) | |
tree | ad7f1b328f140914fb2e9fffb09b13a8acb54385 /tests | |
parent | af2305ec2b3c4233977af0d5bc7b4b25bff57d4b (diff) |
QQuickTextArea: resize background different when inside Flickable
When a TextArea is placed inside a Flickable (using the TextArea.flickable
property), the background is reparented to the Flickable. For this to
look good, the background should have the same size as the Flicable as
well, so it doesn't end up with the size of the TextArea, which can
be many pages tall.
Pick-to: 5.15
Change-Id: I75ead02c712f337c7e743f17aa8810a040519173
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/controls/data/tst_textarea.qml | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml index be889c44..e9e1e2e2 100644 --- a/tests/auto/controls/data/tst_textarea.qml +++ b/tests/auto/controls/data/tst_textarea.qml @@ -75,6 +75,19 @@ TestCase { } Component { + id: flickableCustomBackground + Flickable { + width: 200 + height: 200 + TextArea.flickable: TextArea { + background: Rectangle { + color: "green" + } + } + } + } + + Component { id: signalSpy SignalSpy { } } @@ -324,6 +337,20 @@ TestCase { compare(textArea.cursorPosition, center) // no change } + function test_flickableCustomBackground() { + // Test that the TextArea background item is parented out of the + // TextArea and into the Flicable, and that it has the same size + // as the flickable. + var flickable = createTemporaryObject(flickableCustomBackground, testCase) + verify(flickable) + + var textArea = flickable.TextArea.flickable + verify(textArea) + verify(textArea.background) + compare(textArea.background.width, flickable.width) + compare(textArea.background.height, flickable.height) + } + function test_warning() { ignoreWarning(Qt.resolvedUrl("tst_textarea.qml") + ":55:1: QML TestCase: TextArea must be attached to a Flickable") testCase.TextArea.flickable = null |