blob: 8bb5981bd9c28147a23f45ae2171f8aa12681d2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#include <QtCore/qobject.h>
#include <QtQml/qqml.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
#include <QtTest/qtest.h>
class tst_empty_qmldir : public QObject
{
Q_OBJECT
private slots:
void canSelfImport();
};
void tst_empty_qmldir::canSelfImport()
{
QQmlEngine engine;
QQmlComponent component(&engine, QUrl("qrc:/flee.qml"));
QScopedPointer<QObject> obj(component.create());
QVERIFY2(!obj.isNull(), qPrintable(component.errorString()));
QCOMPARE(obj->property("success").toInt(), -11);
QObject *enemy = qvariant_cast<QObject *>(obj->property("other"));
QVERIFY(enemy != nullptr);
QCOMPARE(enemy->property("name").toString(), QStringLiteral("evil"));
}
QTEST_MAIN(tst_empty_qmldir)
#include "main.moc"
|