From f360cc9b521e5e3e7d4b896627b3257365c6ad3c Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Wed, 22 Dec 2010 10:05:06 +1000 Subject: Improve QDeclarativeComponent test coverage. --- src/declarative/qml/qdeclarativecomponent.cpp | 11 ----------- src/declarative/qml/qdeclarativecomponent_p.h | 1 - .../qdeclarativecomponent/tst_qdeclarativecomponent.cpp | 15 +++++++++++++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 77fc925..ecb3bc5 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -699,17 +699,6 @@ QObject *QDeclarativeComponent::create(QDeclarativeContext *context) return rv; } -QObject *QDeclarativeComponentPrivate::create(QDeclarativeContextData *context, - const QBitField &bindings) -{ - if (!context) - context = QDeclarativeContextData::get(engine->rootContext()); - - QObject *rv = beginCreate(context, bindings); - completeCreate(); - return rv; -} - /*! This method provides more advanced control over component instance creation. In general, programmers should use QDeclarativeComponent::create() to create a diff --git a/src/declarative/qml/qdeclarativecomponent_p.h b/src/declarative/qml/qdeclarativecomponent_p.h index 7b30bad..daf1dcb 100644 --- a/src/declarative/qml/qdeclarativecomponent_p.h +++ b/src/declarative/qml/qdeclarativecomponent_p.h @@ -81,7 +81,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeComponentPrivate : public QObjectPrivate, pu public: QDeclarativeComponentPrivate() : typeData(0), progress(0.), start(-1), count(-1), cc(0), engine(0), creationContext(0) {} - QObject *create(QDeclarativeContextData *, const QBitField &); QObject *beginCreate(QDeclarativeContextData *, const QBitField &); void completeCreate(); diff --git a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp index 8a19b8b..60ce46d 100644 --- a/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp +++ b/tests/auto/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -57,6 +57,7 @@ public: tst_qdeclarativecomponent() { } private slots: + void null(); void loadEmptyUrl(); void qmlCreateObject(); @@ -64,6 +65,20 @@ private: QDeclarativeEngine engine; }; +void tst_qdeclarativecomponent::null() +{ + { + QDeclarativeComponent c; + QVERIFY(c.isNull()); + } + + { + QDeclarativeComponent c(&engine); + QVERIFY(c.isNull()); + } +} + + void tst_qdeclarativecomponent::loadEmptyUrl() { QDeclarativeComponent c(&engine); -- cgit v0.12