diff options
author | Peter Yard <peter.yard@nokia.com> | 2010-05-14 00:17:40 (GMT) |
---|---|---|
committer | Peter Yard <peter.yard@nokia.com> | 2010-05-14 00:17:40 (GMT) |
commit | 124e9a761b3cab7414d3ddeaa8e8f2455b6598ad (patch) | |
tree | 518c22b7317c5646d2ce0adc5deb5818b2ea0af6 /tests/auto/declarative/qdeclarativetextinput | |
parent | dcc9a7e72fe4c283df59378d08d75aecfa3b3b05 (diff) | |
parent | ac519ee416e06f4ab471f102da306f94de21c90d (diff) | |
download | Qt-124e9a761b3cab7414d3ddeaa8e8f2455b6598ad.zip Qt-124e9a761b3cab7414d3ddeaa8e8f2455b6598ad.tar.gz Qt-124e9a761b3cab7414d3ddeaa8e8f2455b6598ad.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Conflicts:
examples/declarative/dial/dial-example.qml
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextinput')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml | 12 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 30 |
2 files changed, 39 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml b/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml new file mode 100644 index 0000000..a9b50fe --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/data/geometrySignals.qml @@ -0,0 +1,12 @@ +import Qt 4.7 + +Item { + width: 400; height: 500; + property int bindingWidth: text.width + property int bindingHeight: text.height + + TextEdit { + id: text + anchors.fill: parent + } +} diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 83ebe6c..ac80edb 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -76,6 +76,7 @@ private slots: void focusOutClearSelection(); void echoMode(); + void geometrySignals(); private: void simulateKey(QDeclarativeView *, int key); QDeclarativeView *createView(const QString &filename); @@ -575,6 +576,14 @@ void tst_qdeclarativetextinput::navigation() simulateKey(canvas, Qt::Key_Left); QVERIFY(input->hasFocus() == true); + // Up and Down should NOT do Home/End, even on Mac OS X (QTBUG-10438). + input->setCursorPosition(2); + QCOMPARE(input->cursorPosition(),2); + simulateKey(canvas, Qt::Key_Up); + QCOMPARE(input->cursorPosition(),2); + simulateKey(canvas, Qt::Key_Down); + QCOMPARE(input->cursorPosition(),2); + delete canvas; } @@ -734,8 +743,6 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() view.viewport()->setInputContext(&ic); QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); - if ((behavior != QStyle::RSIP_OnMouseClick)) - QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); QDeclarativeTextInput input; input.setText("Hello world"); input.setPos(0, 0); @@ -747,7 +754,14 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); + if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { + QCOMPARE(ic.softwareInputPanelEventReceived, false); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } else if (behavior == QStyle::RSIP_OnMouseClick) { + QCOMPARE(ic.softwareInputPanelEventReceived, true); + } } class MyTextInput : public QDeclarativeTextInput @@ -805,6 +819,16 @@ void tst_qdeclarativetextinput::focusOutClearSelection() QTRY_COMPARE(input.selectedText(), QLatin1String("")); } +void tst_qdeclarativetextinput::geometrySignals() +{ + QDeclarativeComponent component(&engine, SRCDIR "/data/geometrySignals.qml"); + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("bindingWidth").toInt(), 400); + QCOMPARE(o->property("bindingHeight").toInt(), 500); + delete o; +} + QTEST_MAIN(tst_qdeclarativetextinput) #include "tst_qdeclarativetextinput.moc" |