diff options
Diffstat (limited to 'tests/auto/qcompleter/tst_qcompleter.cpp')
-rw-r--r-- | tests/auto/qcompleter/tst_qcompleter.cpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index b71cdc6..738384d 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: @@ -176,7 +176,7 @@ tst_QCompleter::~tst_QCompleter() } void tst_QCompleter::setSourceModel(ModelType type) -{ +{ QString text; QTreeWidgetItem *parent, *child; treeWidget->clear(); @@ -282,7 +282,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"; @@ -299,7 +299,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"; @@ -333,7 +333,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" << "" << "" << ""; @@ -352,7 +352,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"; @@ -404,7 +404,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"; @@ -456,7 +456,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"; @@ -469,7 +469,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" << "" << "" << ""; } } @@ -505,15 +505,18 @@ void tst_QCompleter::directoryModel_data() #elif defined(Q_OS_WIN) QTest::newRow("()") << "C" << "" << "C:" << "C:"; QTest::newRow("()") << "C:\\Program" << "" << "Program Files" << "C:\\Program Files"; +#elif defined(Q_OS_SYMBIAN) + QTest::newRow("()") << "C" << "" << "C:" << "C:"; + QTest::newRow("()") << "C:\\re" << "" << "resource" << "C:\\resource"; #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 @@ -659,7 +662,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); @@ -691,7 +694,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 @@ -762,7 +765,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" @@ -844,7 +847,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 @@ -1027,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); |