diff options
Diffstat (limited to 'tests/auto/qml')
4 files changed, 66 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmltypeloader/data/declarativeCppType.qml b/tests/auto/qml/qqmltypeloader/data/declarativeCppType.qml new file mode 100644 index 0000000000..9061f3beb5 --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/data/declarativeCppType.qml @@ -0,0 +1,6 @@ +import QtQml 2.0 +import declarative.import.for.typeloader.test 3.2 + +DeclarativeTestType { + objectName: "ddddd" +} diff --git a/tests/auto/qml/qqmltypeloader/declarativetesttype.h b/tests/auto/qml/qqmltypeloader/declarativetesttype.h new file mode 100644 index 0000000000..a21cdcfd1d --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/declarativetesttype.h @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2019 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef DECLARATIVETESTTYPE_H +#define DECLARATIVETESTTYPE_H + +#include <QObject> +#include <qqml.h> + +class DeclarativeTestType : public QObject +{ + Q_OBJECT + QML_ELEMENT + +public: + explicit DeclarativeTestType(QObject *parent = nullptr) : QObject(parent) {} +}; + +#endif // DECLARATIVETESTTYPE_H diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index 9ad53aaa8b..e90f53d389 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -61,6 +61,7 @@ private slots: void qrcRootPathUrl(); void implicitImport(); void compositeSingletonCycle(); + void declarativeCppType(); }; void tst_QQMLTypeLoader::testLoadComplete() @@ -542,6 +543,15 @@ void tst_QQMLTypeLoader::compositeSingletonCycle() QCOMPARE(qvariant_cast<QColor>(object->property("color")), QColorConstants::Black); } +void tst_QQMLTypeLoader::declarativeCppType() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("declarativeCppType.qml")); + QCOMPARE(component.status(), QQmlComponent::Ready); + QScopedPointer<QObject> obj(component.create()); + QVERIFY(!obj.isNull()); +} + QTEST_MAIN(tst_QQMLTypeLoader) #include "tst_qqmltypeloader.moc" diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro index 0352561e03..50f94405f4 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro @@ -1,4 +1,4 @@ -CONFIG += testcase +CONFIG += testcase qmltypes TARGET = tst_qqmltypeloader QT += qml testlib qml-private quick macx:CONFIG -= app_bundle @@ -8,7 +8,11 @@ SOURCES += \ ../../shared/testhttpserver.cpp HEADERS += \ - ../../shared/testhttpserver.h + ../../shared/testhttpserver.h \ + declarativetesttype.h + +IMPORT_VERSION = 3.2 +QML_IMPORT_NAME = "declarative.import.for.typeloader.test" include (../../shared/util.pri) |