diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-13 17:09:33 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-13 17:09:33 (GMT) |
commit | 0c3068761598e9decd2bdc903be5431d093b8eac (patch) | |
tree | b789afe7d17273a1dd90db1c356465b2263e7104 /tests/auto/qcompleter | |
parent | c549bda8cd38a099118f3cf4c7e5462010cb7259 (diff) | |
download | Qt-0c3068761598e9decd2bdc903be5431d093b8eac.zip Qt-0c3068761598e9decd2bdc903be5431d093b8eac.tar.gz Qt-0c3068761598e9decd2bdc903be5431d093b8eac.tar.bz2 |
Make test faster + fix whitespace
Diffstat (limited to 'tests/auto/qcompleter')
-rw-r--r-- | tests/auto/qcompleter/tst_qcompleter.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index bbc01cc..fb03e1a 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -58,9 +58,9 @@ class CsvCompleter : public QCompleter Q_OBJECT public: CsvCompleter(QObject *parent = 0) : QCompleter(parent), csv(true) { } - - QString pathFromIndex(const QModelIndex& sourceIndex) const; - + + QString pathFromIndex(const QModelIndex& sourceIndex) const; + void setCsvCompletion(bool set) { csv = set; } protected: @@ -178,7 +178,7 @@ tst_QCompleter::~tst_QCompleter() } void tst_QCompleter::setSourceModel(ModelType type) -{ +{ QString text; QTreeWidgetItem *parent, *child; treeWidget->clear(); @@ -284,7 +284,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data() for (int i = 0; i < 2; i++) { if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; - + // Plain text filter QTest::newRow("()") << "" << "" << "P0" << "P0"; QTest::newRow("()F") << "" << "F" << "P0" << "P0"; @@ -301,7 +301,7 @@ void tst_QCompleter::csMatchingOnCsSortedModel_data() QTest::newRow("(p)NNNN") << "p" << "NNNN" << "p4" << "p4"; QTest::newRow("(p1)") << "p1" << "" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + // Tree filter QTest::newRow("(P0,)") << "P0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(P0,c)") << "P0,c" << "" << "c0P0" << "P0,c0P0"; @@ -335,7 +335,7 @@ void tst_QCompleter::ciMatchingOnCiSortedModel_data() QTest::addColumn<QString>("completion"); QTest::addColumn<QString>("completionText"); - for (int i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { if (i == 1) QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; @@ -354,7 +354,7 @@ void tst_QCompleter::ciMatchingOnCiSortedModel_data() QTest::newRow("(p1)") << "p1" << "" << "P1" << "P1"; QTest::newRow("(p1)N") << "p1" << "N" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + //// Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0P0" << "P0,c0P0"; @@ -406,7 +406,7 @@ void tst_QCompleter::ciMatchingOnCsSortedModel_data() QTest::newRow("(p1)") << "p1" << "" << "P1" << "P1"; QTest::newRow("(p1)N") << "p1" << "N" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + // Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0P0" << "P0,c0P0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0P0" << "P0,c0P0"; @@ -458,7 +458,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel_data() QTest::newRow("(p)NNN") << "p" << "NNN" << "p3" << "p3"; QTest::newRow("(p1)") << "p1" << "" << "p1" << "p1"; QTest::newRow("(p11)") << "p11" << "" << "" << ""; - + //// Tree filter QTest::newRow("(p0,)") << "p0," << "" << "c0p0" << "p0,c0p0"; QTest::newRow("(p0,c)") << "p0,c" << "" << "c0p0" << "p0,c0p0"; @@ -471,7 +471,7 @@ void tst_QCompleter::csMatchingOnCiSortedModel_data() QTest::newRow("(p3,,c)") << "p3,,c" << "" << "" << ""; QTest::newRow("(p3,c0P3,)") << "p3,c0P3," << "" << "" << ""; QTest::newRow("(p,)") << "p," << "" << "" << ""; - + QTest::newRow("FILTERING_OFF") << "FILTERING_OFF" << "" << "" << ""; } } @@ -509,13 +509,13 @@ void tst_QCompleter::directoryModel_data() QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; #elif defined (Q_OS_MAC) QTest::newRow("()") << "" << "" << "/" << "/"; - QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; + QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications"; QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer"; #else QTest::newRow("()") << "" << "" << "/" << "/"; #if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) QTest::newRow("(/h)") << "/h" << "" << "home" << "/home"; -#endif +#endif QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc"; QTest::newRow("(/etc/passw)") << "/etc/passw" << "" << "passwd" << "/etc/passwd"; #endif @@ -661,7 +661,7 @@ void tst_QCompleter::currentRow() completer->setModelSorting(QCompleter::CaseInsensitivelySortedModel); completer->setCaseSensitivity(Qt::CaseInsensitive); setSourceModel(CASE_INSENSITIVELY_SORTED_MODEL); - + // blank text completer->setCompletionPrefix(""); QCOMPARE(completer->currentRow(), 0); @@ -693,7 +693,7 @@ void tst_QCompleter::sortedEngineMapFromSource() QModelIndex si1, si2, pi; QAbstractItemModel *sourceModel = completer->model(); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast<const QAbstractProxyModel *>(completer->completionModel()); // Fitering ON @@ -764,7 +764,7 @@ void tst_QCompleter::unsortedEngineMapFromSource() QModelIndex si, si2, si3, pi; QAbstractItemModel *sourceModel = completer->model(); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast<const QAbstractProxyModel *>(completer->completionModel()); si = sourceModel->index(6, completionColumn); // "P3" @@ -846,7 +846,7 @@ void tst_QCompleter::historySearch() completer->setCaseSensitivity(Qt::CaseSensitive); setSourceModel(HISTORY_MODEL); - const QAbstractProxyModel *completionModel = + const QAbstractProxyModel *completionModel = qobject_cast<const QAbstractProxyModel *>(completer->completionModel()); // "p3,c3p3" and "p2,c4p2" are added in the tree root @@ -954,7 +954,7 @@ void tst_QCompleter::multipleWidgets() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&window); #endif - QTest::qWait(5000); + QTest::qWait(50); QTRY_VERIFY(qApp->focusWidget() == comboBox); comboBox->lineEdit()->setText("it"); QCOMPARE(comboBox->currentText(), QString("it")); // should not complete with setText @@ -967,7 +967,8 @@ void tst_QCompleter::multipleWidgets() lineEdit->setCompleter(&completer); lineEdit->show(); lineEdit->setFocus(); - QTest::qWait(5000); + QTest::qWait(50); + QTRY_VERIFY(qApp->focusWidget() == lineEdit); lineEdit->setText("it"); QCOMPARE(lineEdit->text(), QString("it")); // should not completer with setText QCOMPARE(comboBox->currentText(), QString("")); // combo box text must not change! @@ -1029,7 +1030,7 @@ void tst_QCompleter::dynamicSortOrder() QCOMPARE(completer.completionCount(), 12); completer.setCompletionPrefix("13"); QCOMPARE(completer.completionCount(), 2); - + root->sortChildren(0, Qt::DescendingOrder); completer.setCompletionPrefix("13"); QCOMPARE(completer.completionCount(), 2); |