diff options
author | Alexis Menard <alexis.menard@nokia.com> | 2010-04-09 01:00:06 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@nokia.com> | 2010-04-09 01:05:25 (GMT) |
commit | 9615dfeca337c9f40d96485d2dd248eb8cefd563 (patch) | |
tree | c5258d8ca18734973f22f35f1e81b0c0633d8326 /tests | |
parent | 411404e5126936d691d5bb2b77d1754902fab5e0 (diff) | |
download | Qt-9615dfeca337c9f40d96485d2dd248eb8cefd563.zip Qt-9615dfeca337c9f40d96485d2dd248eb8cefd563.tar.gz Qt-9615dfeca337c9f40d96485d2dd248eb8cefd563.tar.bz2 |
Make the TextInput element nicer. It has scrolling.
The TextInput has support for scrolling now so it's quite usable.
You can deactivate the auto scrolling with a property if you want to
do crazy animation while scrolling. This commit also fixed several bugs
with the current implementation especially regarding aligments : selection
was broken, moving the cursor also -> fixed. I have also added a tiny fix when
the TextInput lost the focus -> the selection is cleared.
Task-number:QT-2745
Reviewed-by:Michael Brasser
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 2b0b151..dd74c09 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -73,6 +73,7 @@ private slots: void sendRequestSoftwareInputPanelEvent(); void setHAlignClearCache(); + void focusOutClearSelection(); private: void simulateKey(QDeclarativeView *, int key); @@ -725,6 +726,29 @@ void tst_qdeclarativetextinput::setHAlignClearCache() QCOMPARE(input.nbPaint, 2); } +void tst_qdeclarativetextinput::focusOutClearSelection() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + QDeclarativeTextInput input; + QDeclarativeTextInput input2; + input.setText(QLatin1String("Hello world")); + input.setFocus(true); + scene.addItem(&input2); + scene.addItem(&input); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + input.setSelectionStart(2); + input.setSelectionEnd(5); + //The selection should work + QTRY_COMPARE(input.selectedText(), QLatin1String("llo")); + input2.setFocus(true); + QApplication::processEvents(); + //The input lost the focus selection should be cleared + QTRY_COMPARE(input.selectedText(), QLatin1String("")); +} + QTEST_MAIN(tst_qdeclarativetextinput) #include "tst_qdeclarativetextinput.moc" |