diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-01-06 08:02:19 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-10 16:11:43 +0100 |
commit | 20abd88e711a2dfcbe07925f8902faa45e5110e2 (patch) | |
tree | 75c7e469f4683de422886d5265ed314496956444 /tests | |
parent | c95aea407b89ee5ad4f5f87971104d05a453f9da (diff) |
Make the supportedDragActions a virtual accessor.
Change-Id: I4001fcabc67e5b46465b3c9111c33247c52e5788
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index fd7b0d76ba..5d7eb1d759 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -113,6 +113,7 @@ private slots: void testChildrenLayoutsChanged(); void testRoleNames(); + void testDragActions(); private: DynamicTreeModel *m_model; @@ -1978,11 +1979,11 @@ void tst_QAbstractItemModel::testChildrenLayoutsChanged() } } -class OverrideRoleNames : public QStringListModel +class OverrideRoleNamesAndDragActions : public QStringListModel { Q_OBJECT public: - OverrideRoleNames(QObject *parent = 0) + OverrideRoleNamesAndDragActions(QObject *parent = 0) : QStringListModel(parent) { @@ -1994,15 +1995,28 @@ public: roles.insert(Qt::UserRole + 2, "custom"); return roles; } + + Qt::DropActions supportedDragActions() const + { + return QStringListModel::supportedDragActions() | Qt::MoveAction; + } }; void tst_QAbstractItemModel::testRoleNames() { - QAbstractItemModel *model = new OverrideRoleNames(this); + QAbstractItemModel *model = new OverrideRoleNamesAndDragActions(this); QHash<int, QByteArray> roles = model->roleNames(); QVERIFY(roles.contains(Qt::UserRole + 2)); QVERIFY(roles.value(Qt::UserRole + 2) == "custom"); } +void tst_QAbstractItemModel::testDragActions() +{ + QAbstractItemModel *model = new OverrideRoleNamesAndDragActions(this); + const Qt::DropActions actions = model->supportedDragActions(); + QVERIFY(actions & Qt::CopyAction); // Present by default + QVERIFY(actions & Qt::MoveAction); +} + QTEST_MAIN(tst_QAbstractItemModel) #include "tst_qabstractitemmodel.moc" |