diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-01-24 06:08:46 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-01-24 06:08:46 (GMT) |
commit | 6f78a6080b84cc3ef96b73a4ff58d1b5a72f08f4 (patch) | |
tree | 7d22096d7c681ed1b8f7111575582f4b48f95f7f /tests/auto/declarative/qdeclarativetextedit | |
parent | 44060d2129b461754f6bd86153889a869f12440a (diff) | |
download | Qt-6f78a6080b84cc3ef96b73a4ff58d1b5a72f08f4.zip Qt-6f78a6080b84cc3ef96b73a4ff58d1b5a72f08f4.tar.gz Qt-6f78a6080b84cc3ef96b73a4ff58d1b5a72f08f4.tar.bz2 |
Expose implicitWidth and implicitHeight properties of Item.
Overridden as readonly for elements that have an inherent implicit size
such as Text, TextEdit, TextInput, positioners, Loader.
Task-number: QTBUG-14957
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextedit')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 89e8fec..582b20f 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -127,6 +127,8 @@ private slots: void openInputPanelOnFocus(); void geometrySignals(); void pastingRichText_QTBUG_14003(); + void implicitSize_data(); + void implicitSize(); private: void simulateKey(QDeclarativeView *, int key); @@ -1447,6 +1449,33 @@ void tst_qdeclarativetextedit::pastingRichText_QTBUG_14003() #endif } +void tst_qdeclarativetextedit::implicitSize_data() +{ + QTest::addColumn<QString>("text"); + QTest::addColumn<QString>("wrap"); + QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.NoWrap"; + QTest::newRow("richtext") << "<b>The quick red fox jumped over the lazy brown dog</b>" << "TextEdit.NoWrap"; + QTest::newRow("plain_wrap") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.Wrap"; + QTest::newRow("richtext_wrap") << "<b>The quick red fox jumped over the lazy brown dog</b>" << "TextEdit.Wrap"; +} + +void tst_qdeclarativetextedit::implicitSize() +{ + QFETCH(QString, text); + QFETCH(QString, wrap); + QString componentStr = "import QtQuick 1.1\nTextEdit { text: \"" + text + "\"; width: 50; wrapMode: " + wrap + " }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create()); + + QVERIFY(textObject->width() < textObject->implicitWidth()); + QVERIFY(textObject->height() == textObject->implicitHeight()); + + textObject->resetWidth(); + QVERIFY(textObject->width() == textObject->implicitWidth()); + QVERIFY(textObject->height() == textObject->implicitHeight()); +} + QTEST_MAIN(tst_qdeclarativetextedit) #include "tst_qdeclarativetextedit.moc" |