aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Jenssen <tim.jenssen@qt.io>2017-09-12 17:12:18 +0200
committerThomas Hartmann <thomas.hartmann@qt.io>2017-09-14 05:20:20 +0000
commit3604cae410f29597c97ba73df6d31a9b54e6d30d (patch)
tree06fa1ec60a5872f1b799023b1a81ebb1fa9d652d /tests
parentbb02a577f0fbf3bd2a273129e6cb57cfc9a338c8 (diff)
QQuickTextEdit: call implicitWidth() even if requireImplicitWidth is true
Before once requireImplicitWidth was set to true by requesting the implicit width, the implicit (and width) was never updated again, even if the text was updated/changed. Adding also a test Task-number: QTBUG-63153 Change-Id: Ie3bac4baeb14c2e69acc43d11a351ac91d5400da Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
index ac57a05176..d58fc6c389 100644
--- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
+++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp
@@ -158,6 +158,7 @@ private slots:
#endif
void implicitSize_data();
void implicitSize();
+ void implicitSize_QTBUG_63153();
void contentSize();
void boundingRect();
void clipRect();
@@ -3388,6 +3389,18 @@ void tst_qquicktextedit::implicitSize()
QCOMPARE(textObject->height(), textObject->implicitHeight());
}
+void tst_qquicktextedit::implicitSize_QTBUG_63153()
+{
+ QString componentStr = "import QtQuick 2.0\nTextEdit { }";
+ QQmlComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create());
+ textObject->setText("short");
+ qreal shortImplicitWidth = textObject->implicitWidth();
+ textObject->setText("in contrast to short this is long");
+ QVERIFY2(shortImplicitWidth < textObject->implicitWidth(), qPrintable(QString("%1 < %2").arg(textObject->implicitWidth()).arg(shortImplicitWidth)));
+}
+
void tst_qquicktextedit::contentSize()
{
QString componentStr = "import QtQuick 2.0\nTextEdit { width: 75; height: 16; font.pixelSize: 10 }";