diff options
| author | Frank Reininghaus <[email protected]> | 2011-04-12 21:44:31 +0200 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2011-04-12 21:44:31 +0200 |
| commit | e152885d9435a6049cf033addbae6fa303900794 (patch) | |
| tree | 68c19e2cc0195a5c9dd4e18f4fda16c9988fa217 /src/tests/testbase.cpp | |
| parent | de077f8477c0b7077ed9239be8741fcb67658ffa (diff) | |
Implement a cut/copy/paste unit test for DolphinView.
Diffstat (limited to 'src/tests/testbase.cpp')
| -rw-r--r-- | src/tests/testbase.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tests/testbase.cpp b/src/tests/testbase.cpp index 38909e671..52dc59a63 100644 --- a/src/tests/testbase.cpp +++ b/src/tests/testbase.cpp @@ -55,3 +55,19 @@ QStringList TestBase::viewItems(const DolphinView* view) return itemList; } + +QStringList TestBase::selectedItems(const DolphinView* view) +{ + QStringList itemList; + const QAbstractItemModel* model = itemView(view)->model(); + const QModelIndexList selectedIndexes = itemView(view)->selectionModel()->selectedIndexes(); + + for (int row = 0; row < model->rowCount(); row++) { + const QModelIndex index = model->index(row, 0); + if (selectedIndexes.contains(index)) { + itemList << model->data(model->index(row, 0), Qt::DisplayRole).toString(); + } + } + + return itemList; +} |
