Re-enable tests dependent on QStandardItemModel.
authorAndrew den Exter <andrew.den-exter@nokia.com>
Tue, 10 Jul 2012 05:29:58 +0000 (15:29 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 12 Jul 2012 04:33:07 +0000 (06:33 +0200)
These were disabled when QtWidgets was not available, but that is no
longer necessary following QStandardItemModel being moved to QtGui.

Change-Id: I7ed133d9fd5ae6daa5ed9df180f7745fc3f368b1
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Damian Jansen <damian.jansen@nokia.com>
tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp

index 4684df2..54871c1 100644 (file)
 #include <private/qquickchangeset_p.h>
 #include <private/qqmlengine_p.h>
 #include <math.h>
+#include <QtGui/qstandarditemmodel.h>
 
 using namespace QQuickVisualTestUtil;
 using namespace QQuickViewTestUtil;
 
 template <typename T, int N> int lengthOf(const T (&)[N]) { return N; }
 
-#ifndef QT_NO_WIDGETS
-#include <QStandardItemModel>
 static void initStandardTreeModel(QStandardItemModel *model)
 {
     QStandardItem *item;
@@ -82,7 +81,6 @@ static void initStandardTreeModel(QStandardItemModel *model)
     item->setIcon(QIcon());
     model->insertRow(2, item);
 }
-#endif
 
 class SingleRoleModel : public QAbstractListModel
 {
@@ -125,7 +123,6 @@ protected:
     }
 };
 
-#ifndef QT_NO_WIDGETS
 class StandardItem : public QObject, public QStandardItem
 {
     Q_OBJECT
@@ -149,7 +146,6 @@ public:
         static_cast<QStandardItemModel *>(property->object)->appendRow(item);
     }
 };
-#endif
 
 class DataSubObject : public QObject
 {
@@ -261,10 +257,8 @@ public Q_SLOTS:
 
 QML_DECLARE_TYPE(SingleRoleModel)
 QML_DECLARE_TYPE(DataObject)
-#ifndef QT_NO_WIDGETS
 QML_DECLARE_TYPE(StandardItem)
 QML_DECLARE_TYPE(StandardItemModel)
-#endif
 
 class tst_qquickvisualdatamodel : public QQmlDataTest
 {
@@ -275,7 +269,6 @@ public:
 private slots:
     void initTestCase();
     void cleanupTestCase();
-#ifndef QT_NO_WIDGETS
     void rootIndex();
     void updateLayout_data();
     void updateLayout();
@@ -285,7 +278,6 @@ private slots:
     void noDelegate();
     void itemsDestroyed_data();
     void itemsDestroyed();
-#endif
     void objectListModel();
     void singleRole();
     void modelProperties();
@@ -373,10 +365,8 @@ void tst_qquickvisualdatamodel::initTestCase()
 
     qmlRegisterType<SingleRoleModel>("tst_qquickvisualdatamodel", 1, 0, "SingleRoleModel");
     qmlRegisterType<DataObject>("tst_qquickvisualdatamodel", 1, 0, "DataObject");
-#ifndef QT_NO_WIDGETS
     qmlRegisterType<StandardItem>("tst_qquickvisualdatamodel", 1, 0, "StandardItem");
     qmlRegisterType<StandardItemModel>("tst_qquickvisualdatamodel", 1, 0, "StandardItemModel");
-#endif
 
     engine.setIncubationController(&controller);
 }
@@ -389,7 +379,6 @@ tst_qquickvisualdatamodel::tst_qquickvisualdatamodel()
 {
 }
 
-#ifndef QT_NO_WIDGETS
 void tst_qquickvisualdatamodel::rootIndex()
 {
     QQmlEngine engine;
@@ -531,7 +520,6 @@ void tst_qquickvisualdatamodel::childChanged()
     QVERIFY(name);
     QCOMPARE(name->text(), QString("Row 3 Item"));
 }
-#endif
 
 void tst_qquickvisualdatamodel::objectListModel()
 {
@@ -708,7 +696,6 @@ void tst_qquickvisualdatamodel::modelProperties()
         QCOMPARE(delegate->property("test8").toInt(),1);
     }
 
-#ifndef QT_NO_WIDGETS
     {
         QQuickView view;
 
@@ -750,11 +737,9 @@ void tst_qquickvisualdatamodel::modelProperties()
         QCOMPARE(delegate->property("test7").toInt(),1);
         QCOMPARE(delegate->property("test8").toInt(),1);
     }
-#endif
     //### should also test QStringList and QVariantList
 }
 
-#ifndef QT_NO_WIDGETS
 void tst_qquickvisualdatamodel::noDelegate_data()
 {
     QTest::addColumn<QUrl>("source");
@@ -818,7 +803,6 @@ void tst_qquickvisualdatamodel::itemsDestroyed()
     QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
     QVERIFY(!delegate);
 }
-#endif
 
 void tst_qquickvisualdatamodel::packagesDestroyed()
 {
@@ -2476,7 +2460,7 @@ void tst_qquickvisualdatamodel::insert_data()
                 << 4 << 5 << 0 << true << true << false << false << true
                 << QString("name")
                 << (QStringList() << "seven" << "one" << "two" << "three" << "four");
-#ifndef QT_NO_WIDGETS
+
         // AbstractItemModel (Multiple Roles).
         QTest::newRow("StandardItemModel.items prepend")
                 << multipleRoleSource[i]
@@ -2557,7 +2541,7 @@ void tst_qquickvisualdatamodel::insert_data()
                 << 4 << 5 << 0 << true << true << false << false << false
                 << QString("display")
                 << (QStringList() << "Row 7 Item" << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
-#endif
+
         // StringList.
         QTest::newRow("StringList.items prepend")
                 << stringListSource[i]
@@ -3057,7 +3041,6 @@ void tst_qquickvisualdatamodel::resolve_data()
                 << QString("name")
                 << (QStringList() << "one" << "two" << "three" << "four");
 
-#ifndef QT_NO_WIDGETS
         // AbstractItemModel (Multiple Roles)
         QTest::newRow("StandardItemModel.items prepend, resolve prepended")
                 << multipleRoleSource[i]
@@ -3082,7 +3065,7 @@ void tst_qquickvisualdatamodel::resolve_data()
                 << 5 << 4 << 4 << 2 << true << false << true << false << false
                 << QString("display")
                 << (QStringList() << "Row 1 Item" << "Row 2 Item" << "Row 3 Item" << "Row 4 Item");
-#endif
+
         // StringList
         QTest::newRow("StringList.items prepend, resolve prepended")
                 << stringListSource[i]