diff options
Diffstat (limited to 'tests/auto/tools/moc/tst_moc.cpp')
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index e5de647930..2bad8f2e63 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2013 Olivier Goffart <ogoffart@woboq.com> +** Copyright (C) 2020 Olivier Goffart <ogoffart@woboq.com> ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the test suite of the Qt Toolkit. @@ -27,8 +27,6 @@ ** ****************************************************************************/ - - #include <QtTest/QtTest> #include <stdio.h> #include <qobject.h> @@ -74,6 +72,11 @@ #include "cxx17-namespaces.h" #include "cxx-attributes.h" +#include "moc_include.h" +#include "fwdclass1.h" +#include "fwdclass2.h" +#include "fwdclass3.h" + #ifdef Q_MOC_RUN // check that moc can parse these constructs, they are being used in Windows winsock2.h header #define STRING_HASH_HASH(x) ("foo" ## x ## "bar") @@ -717,6 +720,7 @@ private slots: void cxx17Namespaces(); void cxxAttributes(); void mocJsonOutput(); + void mocInclude(); signals: void sigWithUnsignedArg(unsigned foo); @@ -4002,6 +4006,29 @@ void tst_Moc::mocJsonOutput() QVERIFY2(actualOutput == expectedOutput, showPotentialDiff(actualOutput, expectedOutput).constData()); } +void TestFwdProperties::setProp1(const FwdClass1 &v) +{ + prop1.reset(new FwdClass1(v)); +} +void TestFwdProperties::setProp2(const FwdClass2 &v) +{ + prop2.reset(new FwdClass2(v)); +} +void TestFwdProperties::setProp3(const FwdClass3 &v) +{ + prop3.reset(new FwdClass3(v)); +} +TestFwdProperties::~TestFwdProperties() {} + +Q_DECLARE_METATYPE(FwdClass1); + +void tst_Moc::mocInclude() +{ + TestFwdProperties obj; + obj.setProperty("prop1", QVariant::fromValue(FwdClass1 { 45 })); + QCOMPARE(obj.prop1->x, 45); +} + QTEST_MAIN(tst_Moc) // the generated code must compile with QT_NO_KEYWORDS |