Allow qtdeclarative to compile with -no-widgets

We have no hard requirement for QtWidgets library, so we should
build without it.

Change-Id: I85c85cc1a52bf9daa7ab7916f19bf7cc3ad5845f
Reviewed-by: Damian Jansen <damian.jansen@nokia.com>
This commit is contained in:
Martin Jones 2012-06-01 14:53:26 +10:00 committed by Qt by Nokia
parent c734706c69
commit 805c30e809
14 changed files with 70 additions and 23 deletions

View File

@ -6,9 +6,10 @@ SUBDIRS += \
binding \
coercion \
default \
extended \
grouped \
properties \
signal \
valuesource \
methods
!contains(QT_CONFIG, no-widgets): SUBDIRS += extended

View File

@ -13,7 +13,6 @@
);
%mastercontent = (
"gui" => "#include <QtGui/QtGui>\n",
"script" => "#include <QtScript/QtScript>\n",
"network" => "#include <QtNetwork/QtNetwork>\n",
"testlib" => "#include <QtTest/QtTest>\n",
"qml" => "#include <QtQml/QtQml>\n",

View File

@ -5,8 +5,6 @@ METATYPETESTS += \
PUBLICTESTS += \
parserstress \
qjsengine \
qjsvalue \
qjsvalueiterator \
qjsonbinding \
qmlmin \
@ -50,6 +48,15 @@ PRIVATETESTS += \
qqmlbundle \
v4
!contains(QT_CONFIG, no-widgets) {
PUBLICTESTS += \
qjsengine \
qjsvalue
PRIVATETESTS += \
qqmlecmascript
}
SUBDIRS += $$PUBLICTESTS
SUBDIRS += $$METATYPETESTS
SUBDIRS += debugger

View File

@ -16,4 +16,6 @@ include (../../shared/util.pri)
TESTDATA = data/*
QT += core-private gui-private v8-private qml-private network widgets testlib
QT += core-private gui-private v8-private qml-private network testlib
!contains(QT_CONFIG, no-widgets): QT += widgets

View File

@ -39,8 +39,10 @@
**
****************************************************************************/
#include "testtypes.h"
#include <QWidget>
#include <QPlainTextEdit>
#ifndef QT_NO_WIDGETS
# include <QWidget>
# include <QPlainTextEdit>
#endif
#include <QQmlEngine>
#include <QJSEngine>
#include <QThread>
@ -201,8 +203,10 @@ void registerTypes()
// MyRevisionedSubclass 1.1 uses MyRevisionedClass revision 1
qmlRegisterType<MyRevisionedSubclass,1>("Qt.test",1,1,"MyRevisionedSubclass");
#ifndef QT_NO_WIDGETS
qmlRegisterExtendedType<QWidget,QWidgetDeclarativeUI>("Qt.test",1,0,"QWidget");
qmlRegisterType<QPlainTextEdit>("Qt.test",1,0,"QPlainTextEdit");
#endif
qRegisterMetaType<MyQmlObject::MyType>("MyQmlObject::MyType");

View File

@ -190,7 +190,9 @@ private slots:
void qtbug_21580();
void singleV8BindingDestroyedDuringEvaluation();
void bug1();
#ifndef QT_NO_WIDGETS
void bug2();
#endif
void dynamicCreationCrash();
void dynamicCreationOwnership();
void regExpBug();
@ -2042,6 +2044,7 @@ void tst_qqmlecmascript::bug1()
delete object;
}
#ifndef QT_NO_WIDGETS
void tst_qqmlecmascript::bug2()
{
QQmlComponent component(&engine);
@ -2052,6 +2055,7 @@ void tst_qqmlecmascript::bug2()
delete object;
}
#endif
// Don't crash in createObject when the component has errors.
void tst_qqmlecmascript::dynamicCreationCrash()

View File

@ -10,7 +10,7 @@ TESTDATA = data/*
CONFIG += parallel_test
QT += core-private gui-private v8-private qml-private quick-private testlib widgets
QT += core-private gui-private v8-private qml-private quick-private testlib
# QTBUG-23385 - color mixing tests failing on Ubuntu 11.10 x64
linux-*:system(". /etc/lsb-release && [ $DISTRIB_CODENAME = oneiric ]"):DEFINES+=UBUNTU_ONEIRIC

View File

@ -9,4 +9,5 @@ include (../shared/util.pri)
TESTDATA = data/*
QT += core-private gui-private v8-private qml-private quick-private widgets testlib
QT += core-private gui-private v8-private qml-private quick-private testlib
!contains(QT_CONFIG, no-widgets): QT += widgets

View File

@ -53,7 +53,6 @@
#include <QtQml/private/qquicklistmodel_p.h>
#include <QtQml/private/qqmlvaluetype_p.h>
#include <QStringListModel>
#include <QStandardItemModel>
#include <QFile>
#include "../../shared/util.h"
@ -65,6 +64,8 @@ using namespace QQuickVisualTestUtil;
Q_DECLARE_METATYPE(QQuickPathView::HighlightRangeMode)
#ifndef QT_NO_WIDGETS
#include <QStandardItemModel>
static void initStandardTreeModel(QStandardItemModel *model)
{
QStandardItem *item;
@ -82,6 +83,7 @@ static void initStandardTreeModel(QStandardItemModel *model)
item->setIcon(QIcon());
model->insertRow(2, item);
}
#endif
class tst_QQuickPathView : public QQmlDataTest
@ -120,7 +122,9 @@ private slots:
void visualDataModel();
void undefinedPath();
void mouseDrag();
#ifndef QT_NO_WIDGETS
void treeModel();
#endif
void changePreferredHighlight();
void missingPercent();
void creationContext();
@ -1415,6 +1419,7 @@ void tst_QQuickPathView::mouseDrag()
delete canvas;
}
#ifndef QT_NO_WIDGETS
void tst_QQuickPathView::treeModel()
{
QQuickView *canvas = createView();
@ -1442,6 +1447,7 @@ void tst_QQuickPathView::treeModel()
delete canvas;
}
#endif
void tst_QQuickPathView::changePreferredHighlight()
{

View File

@ -5,4 +5,5 @@ macx:CONFIG -= app_bundle
SOURCES += tst_qquicksystempalette.cpp
CONFIG += parallel_test
QT += core-private gui-private qml-private quick-private widgets testlib
QT += core-private gui-private qml-private quick-private testlib
!contains(QT_CONFIG, no-widgets): QT += widgets

View File

@ -56,7 +56,9 @@ private slots:
void activePalette();
void inactivePalette();
void disabledPalette();
#ifndef QT_NO_WIDGETS
void paletteChanged();
#endif
private:
QQmlEngine engine;
@ -155,6 +157,7 @@ void tst_qquicksystempalette::disabledPalette()
delete object;
}
#ifndef QT_NO_WIDGETS
void tst_qquicksystempalette::paletteChanged()
{
QString componentStr = "import QtQuick 2.0\nSystemPalette { }";
@ -179,6 +182,7 @@ void tst_qquicksystempalette::paletteChanged()
delete object;
}
#endif
QTEST_MAIN(tst_qquicksystempalette)

View File

@ -11,4 +11,5 @@ TESTDATA = data/*
CONFIG += parallel_test
QT += core-private gui-private v8-private qml-private quick-private widgets testlib
QT += core-private gui-private v8-private qml-private quick-private testlib
!contains(QT_CONFIG, no-widgets): QT += widgets

View File

@ -43,7 +43,6 @@
#include <qtest.h>
#include <QtTest/QSignalSpy>
#include <QStandardItemModel>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
#include <QtQml/qqmlcontext.h>
@ -61,6 +60,8 @@ using namespace QQuickVisualTestUtil;
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;
@ -78,6 +79,7 @@ static void initStandardTreeModel(QStandardItemModel *model)
item->setIcon(QIcon());
model->insertRow(2, item);
}
#endif
class SingleRoleModel : public QAbstractListModel
{
@ -120,6 +122,7 @@ protected:
}
};
#ifndef QT_NO_WIDGETS
class StandardItem : public QObject, public QStandardItem
{
Q_OBJECT
@ -143,6 +146,7 @@ public:
static_cast<QStandardItemModel *>(property->object)->appendRow(item);
}
};
#endif
class DataObject : public QObject
{
@ -183,9 +187,11 @@ private:
};
QML_DECLARE_TYPE(SingleRoleModel)
QML_DECLARE_TYPE(DataObject)
#ifndef QT_NO_WIDGETS
QML_DECLARE_TYPE(StandardItem)
QML_DECLARE_TYPE(StandardItemModel)
QML_DECLARE_TYPE(DataObject)
#endif
class tst_qquickvisualdatamodel : public QQmlDataTest
{
@ -196,18 +202,20 @@ public:
private slots:
void initTestCase();
void cleanupTestCase();
#ifndef QT_NO_WIDGETS
void rootIndex();
void updateLayout_data();
void updateLayout();
void childChanged_data();
void childChanged();
void objectListModel();
void singleRole();
void modelProperties();
void noDelegate_data();
void noDelegate();
void itemsDestroyed_data();
void itemsDestroyed();
#endif
void objectListModel();
void singleRole();
void modelProperties();
void packagesDestroyed();
void qaimRowsMoved();
void qaimRowsMoved_data();
@ -283,9 +291,11 @@ void tst_qquickvisualdatamodel::initTestCase()
qRegisterMetaType<QQuickChangeSet>();
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");
qmlRegisterType<DataObject>("tst_qquickvisualdatamodel", 1, 0, "DataObject");
#endif
}
void tst_qquickvisualdatamodel::cleanupTestCase()
@ -296,6 +306,7 @@ tst_qquickvisualdatamodel::tst_qquickvisualdatamodel()
{
}
#ifndef QT_NO_WIDGETS
void tst_qquickvisualdatamodel::rootIndex()
{
QQmlEngine engine;
@ -437,6 +448,7 @@ void tst_qquickvisualdatamodel::childChanged()
QVERIFY(name);
QCOMPARE(name->text(), QString("Row 3 Item"));
}
#endif
void tst_qquickvisualdatamodel::objectListModel()
{
@ -603,6 +615,7 @@ void tst_qquickvisualdatamodel::modelProperties()
QCOMPARE(delegate->property("test8").toInt(),1);
}
#ifndef QT_NO_WIDGETS
{
QQuickView view;
@ -644,10 +657,11 @@ 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");
@ -711,6 +725,7 @@ void tst_qquickvisualdatamodel::itemsDestroyed()
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
QVERIFY(!delegate);
}
#endif
void tst_qquickvisualdatamodel::packagesDestroyed()
{
@ -2368,7 +2383,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]
@ -2449,7 +2464,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]
@ -2949,6 +2964,7 @@ 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]
@ -2973,7 +2989,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]

View File

@ -2,10 +2,11 @@ TEMPLATE = subdirs
PUBLICTESTS += \
geometry \
nodes \
rendernode \
qquickpixmapcache
!contains(QT_CONFIG, no-widgets): PUBLICTESTS += nodes
!cross_compile: PUBLICTESTS += examples
# This test requires the qtconcurrent module