diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-08 21:41:58 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-03-08 21:41:58 (GMT) |
commit | 5ddf54654044df30bf4febada6cbdc46fcdbde62 (patch) | |
tree | 6fa945056c0deb3d5d303e8f5c4e996d66a9608a /tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | |
parent | 3fde625831df6970ff2ad1e58b374541d46dfa97 (diff) | |
parent | 1e9b107b082282d4aadcffedcd67cb7e5e56aef8 (diff) | |
download | Qt-5ddf54654044df30bf4febada6cbdc46fcdbde62.zip Qt-5ddf54654044df30bf4febada6cbdc46fcdbde62.tar.gz Qt-5ddf54654044df30bf4febada6cbdc46fcdbde62.tar.bz2 |
Merge branch 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration:
Invalidate the EGL surface of QMeeGoLivePixmapData when switching to Raster
PinchArea example produced incorrect scaling.
Added image conversion flag to prevent conversions.
Fix TextInput auto test failure on mac.
Fix word selection locking on string boundaries.
Fix potential crash in QTextControl.
QDeclarativePropertyMap::keys() cannot be called from qml
Compensate for horizontal scroll in TextInput micro focus.
Diffstat (limited to 'tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 78 |
1 files changed, 77 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 24ce0e4..ef64dd9 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -145,7 +145,8 @@ tst_qdeclarativetextinput::tst_qdeclarativetextinput() standard << "the quick brown fox jumped over the lazy dog" << "It's supercalifragisiticexpialidocious!" << "Hello, world!" - << "!dlrow ,olleH"; + << "!dlrow ,olleH" + << " spacey text "; colorStrings << "aliceblue" << "antiquewhite" @@ -446,6 +447,9 @@ void tst_qdeclarativetextinput::moveCursorSelection_data() QTest::addColumn<int>("selectionEnd"); QTest::addColumn<bool>("reversible"); + // () contains the text selected by the cursor. + // <> contains the actual selection. + QTest::newRow("(t)he|characters") << standard[0] << 0 << 1 << QDeclarativeTextInput::SelectCharacters << 0 << 1 << true; QTest::newRow("do(g)|characters") @@ -583,6 +587,24 @@ void tst_qdeclarativetextinput::moveCursorSelection_data() << standard[3] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << true; QTest::newRow("!<()>dlrow|words") << standard[3] << 1 << 1 << QDeclarativeTextInput::SelectWords << 1 << 1 << true; + + QTest::newRow(" <s(pac)ey> text |words") + << standard[4] << 1 << 4 << QDeclarativeTextInput::SelectWords << 1 << 7 << true; + QTest::newRow(" spacey <t(ex)t> |words") + << standard[4] << 11 << 13 << QDeclarativeTextInput::SelectWords << 10 << 14 << false; // Should be reversible. QTBUG-11365 + QTest::newRow("<( )>spacey text |words|ltr") + << standard[4] << 0 << 1 << QDeclarativeTextInput::SelectWords << 0 << 1 << false; + QTest::newRow("<( )spacey> text |words|rtl") + << standard[4] << 1 << 0 << QDeclarativeTextInput::SelectWords << 0 << 7 << false; + QTest::newRow("spacey <text( )>|words|ltr") + << standard[4] << 14 << 15 << QDeclarativeTextInput::SelectWords << 10 << 15 << false; +// QTBUG-11365 +// QTest::newRow("spacey text<( )>|words|rtl") +// << standard[4] << 15 << 14 << QDeclarativeTextInput::SelectWords << 14 << 15 << false; + QTest::newRow("<()> spacey text |words") + << standard[4] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << false; + QTest::newRow(" spacey text <()>|words") + << standard[4] << 15 << 15 << QDeclarativeTextInput::SelectWords << 15 << 15 << false; } void tst_qdeclarativetextinput::moveCursorSelection() @@ -629,6 +651,11 @@ void tst_qdeclarativetextinput::moveCursorSelectionSequence_data() QTest::addColumn<int>("selection2Start"); QTest::addColumn<int>("selection2End"); + // () contains the text selected by the cursor. + // <> contains the actual selection. + // ^ is the revised cursor position. + // {} contains the revised selection. + QTest::newRow("the {<quick( bro)wn> f^ox} jumped|ltr") << standard[0] << 9 << 13 << 17 @@ -741,6 +768,50 @@ void tst_qdeclarativetextinput::moveCursorSelectionSequence_data() << 11 << 9 << 5 << 8 << 13 << 1 << 13; + + QTest::newRow("{<(^} sp)acey> text |ltr") + << standard[4] + << 0 << 3 << 0 + << 0 << 7 + << 0 << 0; + QTest::newRow("{<( ^}sp)acey> text |ltr") + << standard[4] + << 0 << 3 << 1 + << 0 << 7 + << 0 << 1; + QTest::newRow("<( {s^p)acey>} text |rtl") + << standard[4] + << 3 << 0 << 2 + << 0 << 7 + << 1 << 7; + QTest::newRow("<( {^sp)acey>} text |rtl") + << standard[4] + << 3 << 0 << 1 + << 0 << 7 + << 1 << 7; + + QTest::newRow(" spacey <te(xt {^)>}|rtl") + << standard[4] + << 15 << 12 << 15 + << 10 << 15 + << 15 << 15; +// QTBUG-11365 +// QTest::newRow(" spacey <te(xt{^ )>}|rtl") +// << standard[4] +// << 15 << 12 << 14 +// << 10 << 15 +// << 14 << 15; + QTest::newRow(" spacey {<te(x^t} )>|ltr") + << standard[4] + << 12 << 15 << 13 + << 10 << 15 + << 10 << 14; +// QTBUG-11365 +// QTest::newRow(" spacey {<te(xt^} )>|ltr") +// << standard[4] +// << 12 << 15 << 14 +// << 10 << 15 +// << 10 << 14; } void tst_qdeclarativetextinput::moveCursorSelectionSequence() @@ -1451,6 +1522,7 @@ void tst_qdeclarativetextinput::cursorRectangle() QVERIFY(r.left() < textWidth); QVERIFY(r.right() > textWidth); + QCOMPARE(input.inputMethodQuery(Qt::ImMicroFocus).toRect(), r); } // Check the cursor rectangle remains within the input bounding rect when auto scrolling. @@ -1460,11 +1532,14 @@ void tst_qdeclarativetextinput::cursorRectangle() for (int i = 6; i < text.length(); ++i) { input.setCursorPosition(i); QCOMPARE(r, input.cursorRectangle()); + QCOMPARE(input.inputMethodQuery(Qt::ImMicroFocus).toRect(), r); } for (int i = text.length() - 2; i >= 0; --i) { input.setCursorPosition(i); + r = input.cursorRectangle(); QVERIFY(r.right() >= 0); + QCOMPARE(input.inputMethodQuery(Qt::ImMicroFocus).toRect(), r); } } @@ -1991,6 +2066,7 @@ void tst_qdeclarativetextinput::preeditMicroFocus() view.setInputContext(&ic); QDeclarativeTextInput input; input.setPos(0, 0); + input.setAutoScroll(false); input.setFocus(true); scene.addItem(&input); view.show(); |