qmltyperegistrar: test for missing Component in qmltypes
qmllint was wrongly complaining about missing types because qmltyperegistrar was not including all required types in the qmltypes files. Add a regression test to make sure that we don't run into the problem mentioned by Mario Emmenlauer in the linked task at QTBUG-118112. Task-number: QTBUG-118112 Pick-to: 6.8 Change-Id: Id67e9f9927e94ad5aa900c7bf30e85fc977e3e45 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
b0fd8ef05e
commit
c5da722515
|
@ -33,6 +33,7 @@ target_link_libraries(tst_qmltyperegistrarPrivate PRIVATE Qt::Core)
|
|||
qt_internal_add_test(tst_qmltyperegistrar
|
||||
SOURCES
|
||||
hppheader.hpp
|
||||
typereferencinganother.h
|
||||
# noextheader special case
|
||||
tst_qmltyperegistrar.cpp tst_qmltyperegistrar.h
|
||||
foo.cpp foo.h duplicatedExports.h
|
||||
|
|
|
@ -1133,5 +1133,15 @@ void tst_qmltyperegistrar::preserveVoidStarPropTypes()
|
|||
}
|
||||
})"));
|
||||
}
|
||||
void tst_qmltyperegistrar::allReferencedTypesCollected()
|
||||
{
|
||||
// reproduce the issue from the comment in QTBUG-118112
|
||||
QVERIFY(qmltypesData.contains(R"(Component {
|
||||
file: "typereferencinganother.h"
|
||||
name: "SampleHeader"
|
||||
accessSemantics: "reference"
|
||||
prototype: "QObject"
|
||||
})"));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_qmltyperegistrar)
|
||||
|
|
|
@ -940,6 +940,7 @@ private slots:
|
|||
void doNotDuplicateQtNamespace();
|
||||
void doNotDuplicateQObject();
|
||||
void slotsBeforeInvokables();
|
||||
void allReferencedTypesCollected();
|
||||
|
||||
void omitQQmlV4FunctionPtrArg();
|
||||
void preserveVoidStarPropTypes();
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (C) 2024 The Qt Company Ltd.
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
||||
|
||||
#ifndef QTBUG_118112_H
|
||||
#define QTBUG_118112_H
|
||||
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtQml/qqml.h>
|
||||
|
||||
class SampleHeader: public QObject {
|
||||
Q_OBJECT
|
||||
};
|
||||
|
||||
class SampleUser: public QObject {
|
||||
Q_OBJECT
|
||||
QML_ELEMENT
|
||||
|
||||
Q_PROPERTY(SampleHeader* header READ header WRITE setHeader NOTIFY headerChanged)
|
||||
Q_PROPERTY(int invalid READ invalid WRITE setInvalid NOTIFY invalidChanged)
|
||||
|
||||
public:
|
||||
SampleHeader* header() const {return m_header;}
|
||||
void setHeader(SampleHeader* header) {m_header = header;}
|
||||
int invalid() const { return m_invalid;}
|
||||
void setInvalid(int invalid) { m_invalid = invalid; }
|
||||
|
||||
signals:
|
||||
void headerChanged();
|
||||
void invalidChanged();
|
||||
|
||||
private:
|
||||
SampleHeader* m_header;
|
||||
int m_invalid;
|
||||
};
|
||||
|
||||
#endif // QTBUG_118112_H
|
Loading…
Reference in New Issue