diff options
author | axis <qt-info@nokia.com> | 2009-05-11 06:30:34 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-05-11 06:30:34 (GMT) |
commit | 804a0ff4ad8c27ece2d403b8d9a4f6f65cdcf867 (patch) | |
tree | 0258fb5f685ccaa710f8ea8ec9da9b6aa9f91d35 /tests/auto/qcompleter | |
parent | efb3e7288eec748db11c35de87239a1eff4d457c (diff) | |
parent | 842ba1b3878c2973b24936b18a7ee55bdd980be6 (diff) | |
download | Qt-804a0ff4ad8c27ece2d403b8d9a4f6f65cdcf867.zip Qt-804a0ff4ad8c27ece2d403b8d9a4f6f65cdcf867.tar.gz Qt-804a0ff4ad8c27ece2d403b8d9a4f6f65cdcf867.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
tests/auto/qtemporaryfile/qtemporaryfile.pro
Diffstat (limited to 'tests/auto/qcompleter')
-rw-r--r-- | tests/auto/qcompleter/tst_qcompleter.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index f6f1a07..738384d 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -143,6 +143,9 @@ private slots: void task246056_setCompletionPrefix(); void task250064_lostFocus(); + void task253125_lineEditCompletion_data(); + void task253125_lineEditCompletion(); + private: void filter(); void testRowCount(); @@ -1187,5 +1190,48 @@ void tst_QCompleter::task250064_lostFocus() QCOMPARE(textEdit->focusPolicy(), origPolicy); } +void tst_QCompleter::task253125_lineEditCompletion_data() +{ + QTest::addColumn<QStringList>("list"); + QTest::addColumn<int>("completionMode"); + + QStringList list = QStringList() + << "alpha" << "beta" << "gamma" << "delta" << "epsilon" << "zeta" + << "eta" << "theta" << "iota" << "kappa" << "lambda" << "mu" + << "nu" << "xi" << "omicron" << "pi" << "rho" << "sigma" + << "tau" << "upsilon" << "phi" << "chi" << "psi" << "omega"; + + QTest::newRow("Inline") << list << (int)QCompleter::InlineCompletion; + QTest::newRow("Filtered") << list << (int)QCompleter::PopupCompletion; + QTest::newRow("Unfiltered") << list << (int)QCompleter::UnfilteredPopupCompletion; +} + +void tst_QCompleter::task253125_lineEditCompletion() +{ + QFETCH(QStringList, list); + QFETCH(int, completionMode); + + QStringListModel *model = new QStringListModel; + model->setStringList(list); + + QCompleter *completer = new QCompleter(list); + completer->setModel(model); + completer->setCompletionMode((QCompleter::CompletionMode)completionMode); + + QLineEdit edit; + edit.setCompleter(completer); + edit.show(); + edit.setFocus(); + + QTest::qWait(100); + + QTest::keyClick(&edit, 'i'); + QCOMPARE(edit.completer()->currentCompletion(), QString("iota")); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Down); + QTest::keyClick(edit.completer()->popup(), Qt::Key_Enter); + + QCOMPARE(edit.text(), QString("iota")); +} + QTEST_MAIN(tst_QCompleter) #include "tst_qcompleter.moc" |