mirror of
https://github.com/crystalidea/qt6windows7.git
synced 2025-07-02 23:35:28 +08:00
qt 6.5.1 original
This commit is contained in:
13
tests/manual/qmetatype/CMakeLists.txt
Normal file
13
tests/manual/qmetatype/CMakeLists.txt
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright (C) 2022 The Qt Company Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
#####################################################################
|
||||
## tst_qmetatype_expect_fail Test:
|
||||
#####################################################################
|
||||
|
||||
qt_internal_add_test(tst_qmetatype_expect_fail
|
||||
GUI
|
||||
SOURCES
|
||||
declare_metatype_noninline.cpp declare_metatype_noninline.h
|
||||
tst_qmetatype.cpp
|
||||
)
|
11
tests/manual/qmetatype/declare_metatype_noninline.cpp
Normal file
11
tests/manual/qmetatype/declare_metatype_noninline.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "declare_metatype_noninline.h"
|
||||
|
||||
Q_DECLARE_METATYPE(ToBeDeclaredMetaTypeNonInline)
|
||||
|
||||
int ToBeDeclaredMetaTypeNonInline::triggerRegistration()
|
||||
{
|
||||
return qMetaTypeId<ToBeDeclaredMetaTypeNonInline>();
|
||||
}
|
14
tests/manual/qmetatype/declare_metatype_noninline.h
Normal file
14
tests/manual/qmetatype/declare_metatype_noninline.h
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#ifndef DECLARE_METATYPE_NONINLINE_H
|
||||
#define DECLARE_METATYPE_NONINLINE_H
|
||||
|
||||
#include <QtCore/qmetatype.h>
|
||||
|
||||
struct ToBeDeclaredMetaTypeNonInline {
|
||||
static int triggerRegistration();
|
||||
};
|
||||
|
||||
#endif // DECLARE_METATYPE_NONINLINE_H
|
||||
|
5
tests/manual/qmetatype/qmetatype.pro
Normal file
5
tests/manual/qmetatype/qmetatype.pro
Normal file
@ -0,0 +1,5 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qmetatype_expect_fail
|
||||
QT = core
|
||||
HEADERS = declare_metatype_noninline.h
|
||||
SOURCES = tst_qmetatype.cpp declare_metatype_noninline.cpp
|
17
tests/manual/qmetatype/tst_qmetatype.cpp
Normal file
17
tests/manual/qmetatype/tst_qmetatype.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
#include "declare_metatype_noninline.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
qDebug("expect no warning here");
|
||||
const int id = qRegisterMetaType<ToBeDeclaredMetaTypeNonInline>("ToBeDeclaredMetaTypeNonInline");
|
||||
qDebug("expect a qfatal now");
|
||||
const int result = ToBeDeclaredMetaTypeNonInline::triggerRegistration();
|
||||
Q_ASSERT(id == result);
|
||||
qDebug("if you read this, check that a qFatal was seen, "
|
||||
"otherwise the test failed.");
|
||||
}
|
Reference in New Issue
Block a user