summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-09-07 01:28:23 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-09-07 01:28:23 (GMT)
commitef5eabdd58a9f584cff8b4e70b7eea583957114c (patch)
treecc42c5a4bb3201c552c465176bcbca8ae77fcea5 /tests/auto
parent00ffa83f2dbe3b3019dc564d6b4447f83b5d655f (diff)
parent7253fe0cb58699d911f7f5b2dca28dd7182b1ef9 (diff)
downloadQt-ef5eabdd58a9f584cff8b4e70b7eea583957114c.zip
Qt-ef5eabdd58a9f584cff8b4e70b7eea583957114c.tar.gz
Qt-ef5eabdd58a9f584cff8b4e70b7eea583957114c.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Dragging in nested views no longer works as expected Fix implicit height not growing when pre-edit text wraps. Fix leak in State element. Fix leak in bindings created by PropertyChanges.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index fde0588..33f74a9 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -147,6 +147,8 @@ private slots:
void pastingRichText_QTBUG_14003();
void implicitSize_data();
void implicitSize();
+ void implicitSizePreedit_data();
+ void implicitSizePreedit();
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
@@ -2368,6 +2370,48 @@ void tst_qdeclarativetextedit::implicitSize()
QVERIFY(textObject->height() == textObject->implicitHeight());
}
+void tst_qdeclarativetextedit::implicitSizePreedit_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("wrap");
+ QTest::addColumn<bool>("wrapped");
+ QTest::newRow("plain") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.NoWrap" << false;
+ QTest::newRow("plain_wrap") << "The quick red fox jumped over the lazy brown dog" << "TextEdit.Wrap" << true;
+
+}
+
+void tst_qdeclarativetextedit::implicitSizePreedit()
+{
+ QFETCH(QString, text);
+ QFETCH(QString, wrap);
+ QFETCH(bool, wrapped);
+
+ QString componentStr = "import QtQuick 1.1\nTextEdit { focus: true; width: 50; wrapMode: " + wrap + " }";
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create());
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ scene.addItem(textObject);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QInputMethodEvent event(text, QList<QInputMethodEvent::Attribute>());
+ QCoreApplication::sendEvent(&view, &event);
+
+ QVERIFY(textObject->width() < textObject->implicitWidth());
+ QVERIFY(textObject->height() == textObject->implicitHeight());
+ qreal wrappedHeight = textObject->height();
+
+ textObject->resetWidth();
+ QVERIFY(textObject->width() == textObject->implicitWidth());
+ QVERIFY(textObject->height() == textObject->implicitHeight());
+ QCOMPARE(textObject->height() < wrappedHeight, wrapped);
+}
+
void tst_qdeclarativetextedit::testQtQuick11Attributes()
{
QFETCH(QString, code);