summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdoc/generatedoutput/testdata
diff options
context:
space:
mode:
authorTopi Reinio <topi.reinio@qt.io>2020-08-10 14:21:14 +0200
committerTopi Reinio <topi.reinio@qt.io>2020-09-23 21:33:23 +0200
commit82384d23378ca8277d0a228c1f343d7d89912edb (patch)
tree82be668f09c1dadb4176459f2848913c4718ae37 /tests/auto/qdoc/generatedoutput/testdata
parent668696ac8502c7fced5f0985188bff62a9040313 (diff)
qdoc: Test the C++ property macros in QDoc's generatedoutput autotest
In order to test the Q_PROPERTY macros, we need to provide include paths to QtCore for the test. Generate a list of include files when running qmake or CMake, stored in a file, and load that file as extra command line arguments when running QDoc. Skip the test if that file is not available at the time of test execution. Fixes: QTBUG-85565 Change-Id: Ibe7ec4a454441c15320b3a7e1ff8ebefb44c2f5e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'tests/auto/qdoc/generatedoutput/testdata')
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/configs/properties.qdocconf10
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/testcpp/properties.qdoc53
-rw-r--r--tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h32
3 files changed, 95 insertions, 0 deletions
diff --git a/tests/auto/qdoc/generatedoutput/testdata/configs/properties.qdocconf b/tests/auto/qdoc/generatedoutput/testdata/configs/properties.qdocconf
new file mode 100644
index 000000000..610b96948
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/configs/properties.qdocconf
@@ -0,0 +1,10 @@
+include(testcpp.qdocconf)
+
+defines += test_properties
+
+sources += ../testcpp/properties.qdoc
+
+outputformats = HTML DocBook
+{HTML.nosubdirs,DocBook.nosubdirs} = true
+HTML.outputsubdir = properties
+DocBook.outputsubdir = properties-docbook
diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/properties.qdoc b/tests/auto/qdoc/generatedoutput/testdata/testcpp/properties.qdoc
new file mode 100644
index 000000000..a7ebd3960
--- /dev/null
+++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/properties.qdoc
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the tools applications 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$
+**
+****************************************************************************/
+
+/*!
+ \property TestQDoc::TestDerived::bindableProp
+ Some property.
+*/
+
+/*!
+ \property TestQDoc::TestDerived::someProp
+ Another property.
+*/
+
+/*!
+ \property TestQDoc::TestDerived::intProp
+ An integer property.
+*/
+
+/*!
+ \property TestQDoc::TestDerived::boolProp
+ A boolean property.
+*/
+
+/*!
+ //! avoid link warnings for auto-generated links to QProperty
+ \externalpage https://wiki.qt.io/QProperty
+ \title QProperty
+*/
diff --git a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h
index b950dfec9..684b5fff4 100644
--- a/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h
+++ b/tests/auto/qdoc/generatedoutput/testdata/testcpp/testcpp.h
@@ -26,6 +26,13 @@
**
****************************************************************************/
#pragma once
+
+#ifdef test_properties
+#include <QtCore/qmetaobject.h>
+#include <QtCore/qproperty.h>
+#include <QtCore/qstring.h>
+#endif
+
#define QDOCTEST_MACRO test
#define QDOCTEST_MACRO2(x) (x) < 0 ? 0 : (x))
@@ -75,10 +82,35 @@ protected:
};
class TestDerived : public Test {
+#ifdef test_properties
+ Q_OBJECT
+
+ Q_PROPERTY(QString bindableProp READ bindableProp WRITE setBindableProp NOTIFY bindablePropChanged BINDABLE bindableProp)
+ Q_PROPERTY(QString someProp READ someProp BINDABLE somBindableProp)
+ Q_PROPERTY(int *intProp READ getInt STORED false CONSTANT FINAL)
+ QDOC_PROPERTY(bool boolProp READ boolProp WRITE setBoolProp NOTIFY boolPropChanged RESET resetBoolProp REVISION 1)
+#endif
+
public:
using DerivedType = Test::SomeType;
using NotTypedef = int;
void virtualFun() override;
+#ifdef test_properties
+ QBindable<QString> bindableProp();
+ QBindable<QString> someBindableProp();
+ const QString &someProp();
+ int *getInt();
+ bool boolProp();
+
+Q_SIGNALS:
+ void bindablePropChanged();
+ Q_REVISION(1) void boolPropChanged();
+
+public Q_SLOTS:
+ void setBindableProp(const QString &s);
+ void setBoolProp(bool b);
+ void resetBoolProp();
+#endif
};
} // namespace TestQDoc