summaryrefslogtreecommitdiffstats
path: root/tests/auto/moc
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2009-03-23 09:18:55 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-03-23 09:18:55 (GMT)
commite5fcad302d86d316390c6b0f62759a067313e8a9 (patch)
treec2afbf6f1066b6ce261f14341cf6d310e5595bc1 /tests/auto/moc
downloadQt-e5fcad302d86d316390c6b0f62759a067313e8a9.zip
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.gz
Qt-e5fcad302d86d316390c6b0f62759a067313e8a9.tar.bz2
Long live Qt 4.5!
Diffstat (limited to 'tests/auto/moc')
-rw-r--r--tests/auto/moc/.gitattributes1
-rw-r--r--tests/auto/moc/.gitignore1
-rw-r--r--tests/auto/moc/Header6
-rw-r--r--tests/auto/moc/Test.framework/Headers/testinterface.h55
-rw-r--r--tests/auto/moc/assign-namespace.h52
-rw-r--r--tests/auto/moc/backslash-newlines.h63
-rw-r--r--tests/auto/moc/c-comments.h55
-rw-r--r--tests/auto/moc/cstyle-enums.h50
-rw-r--r--tests/auto/moc/dir-in-include-path.h47
-rw-r--r--tests/auto/moc/escapes-in-string-literals.h49
-rw-r--r--tests/auto/moc/extraqualification.h57
-rw-r--r--tests/auto/moc/forgotten-qinterface.h53
-rw-r--r--tests/auto/moc/gadgetwithnoenums.h62
-rw-r--r--tests/auto/moc/interface-from-framework.h55
-rw-r--r--tests/auto/moc/macro-on-cmdline.h50
-rw-r--r--tests/auto/moc/moc.pro30
-rw-r--r--tests/auto/moc/namespaced-flags.h75
-rw-r--r--tests/auto/moc/no-keywords.h88
-rw-r--r--tests/auto/moc/oldstyle-casts.h56
-rw-r--r--tests/auto/moc/os9-newlines.h1
-rw-r--r--tests/auto/moc/parse-boost.h126
-rw-r--r--tests/auto/moc/pure-virtual-signals.h60
-rw-r--r--tests/auto/moc/qinvokable.h57
-rw-r--r--tests/auto/moc/qprivateslots.h60
-rw-r--r--tests/auto/moc/single_function_keyword.h75
-rw-r--r--tests/auto/moc/slots-with-void-template.h59
-rw-r--r--tests/auto/moc/task189996.h58
-rw-r--r--tests/auto/moc/task192552.h55
-rw-r--r--tests/auto/moc/task234909.h73
-rw-r--r--tests/auto/moc/task240368.h72
-rw-r--r--tests/auto/moc/task71021/dummy0
-rw-r--r--tests/auto/moc/task87883.h57
-rw-r--r--tests/auto/moc/template-gtgt.h60
-rw-r--r--tests/auto/moc/testproject/Plugin/Plugin.h50
-rw-r--r--tests/auto/moc/testproject/include/Plugin1
-rw-r--r--tests/auto/moc/trigraphs.h63
-rw-r--r--tests/auto/moc/tst_moc.cpp1205
-rw-r--r--tests/auto/moc/using-namespaces.h56
-rw-r--r--tests/auto/moc/warn-on-multiple-qobject-subclasses.h55
-rw-r--r--tests/auto/moc/warn-on-property-without-read.h48
-rw-r--r--tests/auto/moc/win-newlines.h49
41 files changed, 3245 insertions, 0 deletions
diff --git a/tests/auto/moc/.gitattributes b/tests/auto/moc/.gitattributes
new file mode 100644
index 0000000..ccf34c3
--- /dev/null
+++ b/tests/auto/moc/.gitattributes
@@ -0,0 +1 @@
+win-newlines.h -crlf
diff --git a/tests/auto/moc/.gitignore b/tests/auto/moc/.gitignore
new file mode 100644
index 0000000..86a604a
--- /dev/null
+++ b/tests/auto/moc/.gitignore
@@ -0,0 +1 @@
+tst_moc
diff --git a/tests/auto/moc/Header b/tests/auto/moc/Header
new file mode 100644
index 0000000..b7066b7
--- /dev/null
+++ b/tests/auto/moc/Header
@@ -0,0 +1,6 @@
+#include <QtCore/qobject.h>
+
+class Object : public QObject
+{
+ Q_OBJECT
+};
diff --git a/tests/auto/moc/Test.framework/Headers/testinterface.h b/tests/auto/moc/Test.framework/Headers/testinterface.h
new file mode 100644
index 0000000..2b52a39
--- /dev/null
+++ b/tests/auto/moc/Test.framework/Headers/testinterface.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TESTINTERFACE_H
+#define TESTINTERFACE_H
+
+#include <QtCore/qobject.h>
+
+struct TestInterface
+{
+ inline virtual ~TestInterface() {}
+
+ virtual void foobar() = 0;
+};
+
+Q_DECLARE_INTERFACE(TestInterface, "foo.bar/1.0")
+
+#endif // TESTINTERFACE_H
diff --git a/tests/auto/moc/assign-namespace.h b/tests/auto/moc/assign-namespace.h
new file mode 100644
index 0000000..b766269
--- /dev/null
+++ b/tests/auto/moc/assign-namespace.h
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+namespace A
+{
+ namespace Nested
+ {
+ namespace Space {}
+ }
+}
+
+namespace Mine = Qt;
+namespace Theirs = A::Nested::Space;
+
diff --git a/tests/auto/moc/backslash-newlines.h b/tests/auto/moc/backslash-newlines.h
new file mode 100644
index 0000000..fc4a998
--- /dev/null
+++ b/tests/auto/moc/backslash-newlines.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+
+const int blackslashNewlinesDummy = 0
+
+#define value 0\
+1
+
+;
+
+class BackslashNewlines : public QObject
+{
+ Q_OBJECT
+public slots:
+#if value
+ void works() {}
+#else
+ void buggy() {}
+#endif
+};
+
+#undef value
+
diff --git a/tests/auto/moc/c-comments.h b/tests/auto/moc/c-comments.h
new file mode 100644
index 0000000..c200e25
--- /dev/null
+++ b/tests/auto/moc/c-comments.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qobject.h>
+
+/* test support for multi-line comments in preprocessor statements */
+
+#if 0 /* comment starts here
+ ends here */ || defined(Q_MOC_RUN) || 1
+
+class IfdefedClass : public QObject
+{
+ Q_OBJECT
+public:
+ inline IfdefedClass() {}
+};
+
+#endif
diff --git a/tests/auto/moc/cstyle-enums.h b/tests/auto/moc/cstyle-enums.h
new file mode 100644
index 0000000..b21b688
--- /dev/null
+++ b/tests/auto/moc/cstyle-enums.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+class CStyleEnums
+{
+ Q_GADGET
+public:
+ Q_ENUMS(Baz)
+ typedef enum { Foo, Bar } Baz;
+};
+
diff --git a/tests/auto/moc/dir-in-include-path.h b/tests/auto/moc/dir-in-include-path.h
new file mode 100644
index 0000000..06914e2
--- /dev/null
+++ b/tests/auto/moc/dir-in-include-path.h
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <Plugin>
+
+class DirInIncludePath : public QObject, public MyInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(MyInterface)
+};
diff --git a/tests/auto/moc/escapes-in-string-literals.h b/tests/auto/moc/escapes-in-string-literals.h
new file mode 100644
index 0000000..76f420d
--- /dev/null
+++ b/tests/auto/moc/escapes-in-string-literals.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+class StringLiterals: public QObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("Test", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\x53")
+ Q_CLASSINFO("Test2", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\123")
+ Q_CLASSINFO("Test3", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nb")
+};
diff --git a/tests/auto/moc/extraqualification.h b/tests/auto/moc/extraqualification.h
new file mode 100644
index 0000000..5e1075a
--- /dev/null
+++ b/tests/auto/moc/extraqualification.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+
+class Test : public QObject
+{
+ Q_OBJECT
+public slots:
+ // this is invalid code that does not compile, the extra qualification
+ // is bad. However for example older gccs silently accept it, so customers
+ // can write the code and moc generates bad metadata. So instead moc should
+ // now write out a warning and /not/ generate any code, because the code is
+ // bad and with a decent compiler it won't compile anyway.
+ void Test::badFunctionDeclaration() {}
+
+public:
+ Q_SLOT void Test::anotherOne() {}
+};
diff --git a/tests/auto/moc/forgotten-qinterface.h b/tests/auto/moc/forgotten-qinterface.h
new file mode 100644
index 0000000..a11793b
--- /dev/null
+++ b/tests/auto/moc/forgotten-qinterface.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+struct MyInterface
+{
+ virtual ~MyInterface() {}
+ virtual void foo() = 0;
+};
+
+Q_DECLARE_INTERFACE(MyInterface, "foo.bar.blah")
+
+class Test : public QObject, public MyInterface
+{
+ Q_OBJECT
+};
diff --git a/tests/auto/moc/gadgetwithnoenums.h b/tests/auto/moc/gadgetwithnoenums.h
new file mode 100644
index 0000000..34df110
--- /dev/null
+++ b/tests/auto/moc/gadgetwithnoenums.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef TASK175491
+#define TASK175491
+
+#include <QObject>
+
+class GadgetWithNoEnums {
+ Q_GADGET
+ public:
+ GadgetWithNoEnums() {}
+ virtual ~GadgetWithNoEnums() {}
+};
+
+class DerivedGadgetWithEnums : public GadgetWithNoEnums {
+ Q_GADGET
+ Q_ENUMS( FooEnum )
+ public:
+ enum FooEnum { FooValue };
+ DerivedGadgetWithEnums() {}
+ ~DerivedGadgetWithEnums() {}
+};
+
+#endif
diff --git a/tests/auto/moc/interface-from-framework.h b/tests/auto/moc/interface-from-framework.h
new file mode 100644
index 0000000..d921664
--- /dev/null
+++ b/tests/auto/moc/interface-from-framework.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef INTERFACE_FROM-FRAMEWORK_H
+#define INTERFACE_FROM_FRAMEWORK_H
+
+#include <Test/testinterface.h>
+
+class TestComponent : public QObject, public TestInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(TestInterface)
+public:
+
+ virtual inline foobar() { }
+};
+
+#endif // INTERFACE_FROM_FRAMEWORK_H
diff --git a/tests/auto/moc/macro-on-cmdline.h b/tests/auto/moc/macro-on-cmdline.h
new file mode 100644
index 0000000..655dd82
--- /dev/null
+++ b/tests/auto/moc/macro-on-cmdline.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#if FOO
+
+class Test : public QObject
+{
+ Q_OBJECT
+public:
+};
+
+#endif
diff --git a/tests/auto/moc/moc.pro b/tests/auto/moc/moc.pro
new file mode 100644
index 0000000..f96b4e2
--- /dev/null
+++ b/tests/auto/moc/moc.pro
@@ -0,0 +1,30 @@
+load(qttest_p4)
+
+#exists(/usr/include/boost/spirit.hpp) {
+# message("including boost headers in test")
+# DEFINES += PARSE_BOOST
+# # need to add explicitly so that it ends up in moc's search path
+# INCLUDEPATH += /usr/include
+#}
+
+INCLUDEPATH += testproject/include testproject
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
+cross_compile: DEFINES += MOC_CROSS_COMPILED
+
+HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-newlines.h oldstyle-casts.h \
+ slots-with-void-template.h qinvokable.h namespaced-flags.h trigraphs.h \
+ escapes-in-string-literals.h cstyle-enums.h qprivateslots.h gadgetwithnoenums.h \
+ dir-in-include-path.h single_function_keyword.h task192552.h task189996.h \
+ task234909.h task240368.h pure-virtual-signals.h
+if(*-g++*|*-icc*):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h
+SOURCES += tst_moc.cpp
+
+QT += sql network svg script
+contains(QT_CONFIG, qt3support): QT += qt3support
+contains(QT_CONFIG, dbus){
+ DEFINES += WITH_DBUS
+ QT += dbus
+}
+
+
diff --git a/tests/auto/moc/namespaced-flags.h b/tests/auto/moc/namespaced-flags.h
new file mode 100644
index 0000000..f6ad649
--- /dev/null
+++ b/tests/auto/moc/namespaced-flags.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+namespace Foo {
+ class Bar : public QObject {
+ Q_OBJECT
+ Q_FLAGS( Flags )
+ Q_PROPERTY( Flags flags READ flags WRITE setFlags )
+ public:
+ explicit Bar( QObject * parent=0 ) : QObject( parent ), mFlags() {}
+
+ enum Flag { Read=1, Write=2 };
+ Q_DECLARE_FLAGS( Flags, Flag )
+
+ void setFlags( Flags f ) { mFlags = f; }
+ Flags flags() const { return mFlags; }
+
+ private:
+ Flags mFlags;
+ };
+
+ class Baz : public QObject {
+ Q_OBJECT
+ //Q_PROPERTY( Bar::Flags flags READ flags WRITE setFlags ) // triggers assertion
+ Q_PROPERTY( Foo::Bar::Flags flags READ flags WRITE setFlags ) // fails to compile, or with the same assertion if moc fix is applied
+ public:
+ explicit Baz( QObject * parent=0 ) : QObject( parent ), mFlags() {}
+
+ void setFlags( Bar::Flags f ) { mFlags = f; }
+ Bar::Flags flags() const { return mFlags; }
+ private:
+ Bar::Flags mFlags;
+ };
+}
+
+Q_DECLARE_OPERATORS_FOR_FLAGS( Foo::Bar::Flags )
diff --git a/tests/auto/moc/no-keywords.h b/tests/auto/moc/no-keywords.h
new file mode 100644
index 0000000..37333e5
--- /dev/null
+++ b/tests/auto/moc/no-keywords.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#define QT_NO_KEYWORDS
+#undef signals
+#undef slots
+#undef emit
+#define signals FooBar
+#define slots Baz
+#define emit Yoyodyne
+
+#include <QtGui/QtGui>
+#include <QtCore>
+#include <QtNetwork/QtNetwork>
+#include <QtSql/QtSql>
+#include <QtSvg>
+#if defined(QT3_SUPPORT)
+#include <Qt3Support>
+#endif
+#if defined(WITH_DBUS)
+#include <QtDBus>
+#endif
+#include <QtScript>
+
+#undef signals
+#undef slots
+#undef emit
+
+class MyBooooooostishClass : public QObject
+{
+ Q_OBJECT
+public:
+ inline MyBooooooostishClass() {}
+
+Q_SIGNALS:
+ void mySignal();
+
+public Q_SLOTS:
+ inline void mySlot() { mySignal(); }
+
+private:
+ int signals;
+ double slots;
+};
+
+#define signals protected
+#define slots
+#define emit
+#undef QT_NO_KEYWORDS
+
diff --git a/tests/auto/moc/oldstyle-casts.h b/tests/auto/moc/oldstyle-casts.h
new file mode 100644
index 0000000..e434f4c
--- /dev/null
+++ b/tests/auto/moc/oldstyle-casts.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtCore/qobject.h>
+
+class Foo: public QObject
+{
+ Q_OBJECT
+public:
+
+
+signals:
+
+public slots:
+ inline void foo() {}
+ inline int bar(int, int*, const int *, volatile int *, const int * volatile *) { return 0; }
+ inline void slot(int, QObject * const) {}
+};
+
diff --git a/tests/auto/moc/os9-newlines.h b/tests/auto/moc/os9-newlines.h
new file mode 100644
index 0000000..8dd8058
--- /dev/null
+++ b/tests/auto/moc/os9-newlines.h
@@ -0,0 +1 @@
+/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information (qt-info@nokia.com) ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions ** contained in the either Technology Preview License Agreement or the ** Beta Release License Agreement. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain ** additional rights. These rights are described in the Nokia Qt LGPL ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this ** package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** If you are unsure which license is appropriate for your use, please ** contact the sales department at qt-sales@nokia.com. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} }; \ No newline at end of file
diff --git a/tests/auto/moc/parse-boost.h b/tests/auto/moc/parse-boost.h
new file mode 100644
index 0000000..2baa7b0
--- /dev/null
+++ b/tests/auto/moc/parse-boost.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <boost/aligned_storage.hpp>
+#include <boost/any.hpp>
+#include <boost/array.hpp>
+#include <boost/assert.hpp>
+#include <boost/assign.hpp>
+#include <boost/bind.hpp>
+#include <boost/blank_fwd.hpp>
+#include <boost/blank.hpp>
+#include <boost/call_traits.hpp>
+#include <boost/cast.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/compressed_pair.hpp>
+#include <boost/concept_archetype.hpp>
+#include <boost/concept_check.hpp>
+#include <boost/config.hpp>
+#include <boost/crc.hpp>
+#include <boost/cstdint.hpp>
+#include <boost/cstdlib.hpp>
+#include <boost/current_function.hpp>
+#include <boost/dynamic_bitset_fwd.hpp>
+#include <boost/dynamic_bitset.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <boost/format.hpp>
+#include <boost/functional.hpp>
+#include <boost/function_equal.hpp>
+#include <boost/function.hpp>
+#include <boost/function_output_iterator.hpp>
+#include <boost/generator_iterator.hpp>
+#include <boost/get_pointer.hpp>
+#include <boost/implicit_cast.hpp>
+#include <boost/indirect_reference.hpp>
+#include <boost/integer_fwd.hpp>
+#include <boost/integer.hpp>
+#include <boost/integer_traits.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/io_fwd.hpp>
+#include <boost/iterator_adaptors.hpp>
+#include <boost/iterator.hpp>
+#include <boost/last_value.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/limits.hpp>
+#include <boost/math_fwd.hpp>
+#include <boost/mem_fn.hpp>
+#include <boost/multi_array.hpp>
+#include <boost/next_prior.hpp>
+#include <boost/noncopyable.hpp>
+#include <boost/nondet_random.hpp>
+#include <boost/none.hpp>
+#include <boost/non_type.hpp>
+#include <boost/operators.hpp>
+#include <boost/optional.hpp>
+#include <boost/pfto.hpp>
+#include <boost/pointee.hpp>
+#include <boost/preprocessor.hpp>
+#include <boost/progress.hpp>
+#include <boost/property_map.hpp>
+#include <boost/property_map_iterator.hpp>
+#include <boost/random.hpp>
+#include <boost/range.hpp>
+#include <boost/rational.hpp>
+#include <boost/ref.hpp>
+#include <boost/scoped_array.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/shared_array.hpp>
+#include <boost/shared_container_iterator.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/smart_cast.hpp>
+#include <boost/smart_ptr.hpp>
+#include <boost/spirit.hpp>
+#include <boost/state_saver.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/static_warning.hpp>
+#include <boost/strong_typedef.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/timer.hpp>
+#include <boost/token_functions.hpp>
+#include <boost/token_iterator.hpp>
+#include <boost/tokenizer.hpp>
+#include <boost/type.hpp>
+#include <boost/type_traits.hpp>
+#include <boost/utility.hpp>
+#include <boost/variant.hpp>
+#include <boost/vector_property_map.hpp>
+#include <boost/version.hpp>
+#include <boost/visit_each.hpp>
+#include <boost/weak_ptr.hpp>
diff --git a/tests/auto/moc/pure-virtual-signals.h b/tests/auto/moc/pure-virtual-signals.h
new file mode 100644
index 0000000..2f6206e
--- /dev/null
+++ b/tests/auto/moc/pure-virtual-signals.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+class PureVirtualSignalsTest : public QObject
+{
+ Q_OBJECT
+public:
+signals:
+ virtual void mySignal() = 0;
+ void myOtherSignal();
+ virtual void mySignal2(int foo) = 0;
+};
+
+class PureVirtualSignalsImpl : public PureVirtualSignalsTest
+{
+ Q_OBJECT
+public:
+signals:
+ void mySignal();
+ void mySignal2(int foo);
+};
diff --git a/tests/auto/moc/qinvokable.h b/tests/auto/moc/qinvokable.h
new file mode 100644
index 0000000..b223671
--- /dev/null
+++ b/tests/auto/moc/qinvokable.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+
+class InvokableBeforeReturnType : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE const char *foo() const { return ""; }
+};
+
+class InvokableBeforeInline : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE inline void foo() {}
+ Q_INVOKABLE virtual void bar() {}
+};
diff --git a/tests/auto/moc/qprivateslots.h b/tests/auto/moc/qprivateslots.h
new file mode 100644
index 0000000..b61e21b
--- /dev/null
+++ b/tests/auto/moc/qprivateslots.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+
+struct TestQPrivateSlots_Private
+{
+ void _q_privateslot() {};
+};
+
+class TestQPrivateSlots: public QObject
+{
+ Q_OBJECT
+public:
+ TestQPrivateSlots() : d(new TestQPrivateSlots_Private()) {}
+ ~TestQPrivateSlots() { delete d; }
+private:
+ Q_PRIVATE_SLOT(d, void _q_privateslot())
+ Q_INVOKABLE void method1() {}; //task 204730
+ TestQPrivateSlots_Private *d;
+};
+
diff --git a/tests/auto/moc/single_function_keyword.h b/tests/auto/moc/single_function_keyword.h
new file mode 100644
index 0000000..71e0d74
--- /dev/null
+++ b/tests/auto/moc/single_function_keyword.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+class SingleFunctionKeywordBeforeReturnType : public QObject
+{
+ Q_OBJECT
+public:
+ inline SingleFunctionKeywordBeforeReturnType() {}
+
+ Q_SIGNAL void mySignal();
+
+ Q_SLOT void mySlot() { mySignal(); }
+};
+
+class SingleFunctionKeywordBeforeInline : public QObject
+{
+ Q_OBJECT
+public:
+ inline SingleFunctionKeywordBeforeInline() {}
+
+ Q_SIGNAL inline void mySignal();
+
+ Q_SLOT inline void mySlot() { emit mySignal(); }
+};
+
+class SingleFunctionKeywordAfterInline : public QObject
+{
+ Q_OBJECT
+public:
+ inline SingleFunctionKeywordAfterInline() {}
+
+ inline Q_SIGNAL void mySignal();
+
+ inline Q_SLOT void mySlot() { emit mySignal(); }
+};
+
diff --git a/tests/auto/moc/slots-with-void-template.h b/tests/auto/moc/slots-with-void-template.h
new file mode 100644
index 0000000..01004e4
--- /dev/null
+++ b/tests/auto/moc/slots-with-void-template.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+template <typename T>
+struct TestTemplate
+{
+ T *blah;
+};
+
+class SlotsWithVoidTemplateTest : public QObject
+{
+ Q_OBJECT
+public slots:
+ inline void dummySlot() {}
+ inline void anotherSlot(const TestTemplate<void> &) {}
+ inline TestTemplate<void> mySlot() { return TestTemplate<void>(); }
+signals:
+ void mySignal(const TestTemplate<void> &);
+ void myVoidSignal();
+};
diff --git a/tests/auto/moc/task189996.h b/tests/auto/moc/task189996.h
new file mode 100644
index 0000000..86a8efb
--- /dev/null
+++ b/tests/auto/moc/task189996.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+// inline functions can have throw declarations
+
+#ifndef TASK189996_H
+#define TASK189996_H
+
+#include <QObject>
+
+class InlineSlotsWithThrowDeclaration : public QObject {
+ Q_OBJECT
+public slots:
+ void a() throw() { }
+ void b() const throw() { }
+ void c() throw();
+ void d() throw(int) { }
+ void e() const throw(int,double) { }
+};
+
+#endif
diff --git a/tests/auto/moc/task192552.h b/tests/auto/moc/task192552.h
new file mode 100644
index 0000000..679282c
--- /dev/null
+++ b/tests/auto/moc/task192552.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*
+ <:: is not valid C++, but we want moc to treat it as < :: since this
+ is usually the intention
+ */
+
+#include <qobject.h>
+
+class Task192552 : public QObject
+{
+ Q_OBJECT
+public:
+#ifdef Q_MOC_RUN
+ QList<::QObject*> m_objects;
+#endif
+};
diff --git a/tests/auto/moc/task234909.h b/tests/auto/moc/task234909.h
new file mode 100644
index 0000000..fe68995
--- /dev/null
+++ b/tests/auto/moc/task234909.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <qobject.h>
+
+namespace NS_A {
+namespace NS_B {
+
+ /*/
+
+ {
+
+ */
+ class TestObject : public QObject {
+ Q_OBJECT
+
+ public:
+
+
+ };
+
+}
+}
+
+namespace NS_A {
+namespace NS_Main {
+
+ class TestMain : public QObject {
+ Q_OBJECT
+
+ public:
+
+ };
+
+}
+}
diff --git a/tests/auto/moc/task240368.h b/tests/auto/moc/task240368.h
new file mode 100644
index 0000000..4d435d0
--- /dev/null
+++ b/tests/auto/moc/task240368.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+// moc parsing issue with "unsigned" subphrase
+
+#ifndef TASK240368_H
+#define TASK240368_H
+
+#include <QObject>
+
+typedef struct { unsigned _1; } unsigned1;
+typedef struct { unsigned qi; } unsignedQImage;
+
+class TypenameWithUnsigned : public QObject {
+
+ Q_OBJECT
+
+public slots:
+
+ void a(unsigned) { }
+ void b(unsigned u) { Q_UNUSED(u); }
+ void c(unsigned*) { }
+ void d(unsigned* p) { Q_UNUSED(p); }
+ void e(unsigned&) { }
+ void f(unsigned& r) { Q_UNUSED(r); }
+ void g(unsigned1) { }
+ void h(unsigned1 u1) { Q_UNUSED(u1); }
+ void i(unsigned,unsigned1) { }
+ void j(unsigned1,unsigned) { }
+ void k(unsignedQImage) { }
+ void l(unsignedQImage uqi) { Q_UNUSED(uqi); }
+
+};
+
+#endif
diff --git a/tests/auto/moc/task71021/dummy b/tests/auto/moc/task71021/dummy
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/auto/moc/task71021/dummy
diff --git a/tests/auto/moc/task87883.h b/tests/auto/moc/task87883.h
new file mode 100644
index 0000000..c1b533c
--- /dev/null
+++ b/tests/auto/moc/task87883.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+/*
+ The bug is triggered only if there is a multiline comment after an #include
+ statement that in the following line contains a single quote but lacks a finishing
+ quote. So Moc tries to find the end quote, doesn't find it and by the skips over the
+ everything, including important class declarations :)
+ */
+
+#include <qobject.h> /* blah
+foo ' bar */
+
+class Task87883 : public QObject
+{
+ Q_OBJECT
+public:
+ inline Task87883() {}
+};
+
diff --git a/tests/auto/moc/template-gtgt.h b/tests/auto/moc/template-gtgt.h
new file mode 100644
index 0000000..5090e93
--- /dev/null
+++ b/tests/auto/moc/template-gtgt.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+template<class TYPE, size_t COUNT>
+class myTemplate :
+ QString,
+ QVector<TYPE, QList<COUNT>>
+{};
+
+template<class TYPE, size_t COUNT>
+class myTemplate2 :
+ QString,
+ QVector<TYPE, QList< (4 >> 2) >>
+{};
+
+class Widget : public QWidget
+{
+ Q_OBJECT
+public:
+ Widget()
+ {
+ }
+};
diff --git a/tests/auto/moc/testproject/Plugin/Plugin.h b/tests/auto/moc/testproject/Plugin/Plugin.h
new file mode 100644
index 0000000..554d7a6
--- /dev/null
+++ b/tests/auto/moc/testproject/Plugin/Plugin.h
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+struct MyInterface
+{
+ virtual void blah() = 0;
+};
+
+Q_DECLARE_INTERFACE(MyInterface, "MyInterface")
+
+
diff --git a/tests/auto/moc/testproject/include/Plugin b/tests/auto/moc/testproject/include/Plugin
new file mode 100644
index 0000000..d63149c
--- /dev/null
+++ b/tests/auto/moc/testproject/include/Plugin
@@ -0,0 +1 @@
+#include "../Plugin/Plugin.h"
diff --git a/tests/auto/moc/trigraphs.h b/tests/auto/moc/trigraphs.h
new file mode 100644
index 0000000..2a4c0a1
--- /dev/null
+++ b/tests/auto/moc/trigraphs.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+
+namespace AAA {
+ struct BaseA {};
+}
+
+namespace BBB {
+ class Foo : public QObject, public ::AAA::BaseA
+ {
+ Q_OBJECT
+ Q_SIGNALS:
+ // don't turn "> >" into ">>"
+ void foo(QList<QList<int> >);
+ void foo2(const QList<QList<int> > &);
+
+ // don't turn "< :" into "<:"
+ void bar(QList< ::AAA::BaseA*>);
+ void bar2(const QList< ::AAA::BaseA*> &);
+ void bar3(QList< ::AAA::BaseA const*>);
+ };
+}
+
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
new file mode 100644
index 0000000..39f4f23
--- /dev/null
+++ b/tests/auto/moc/tst_moc.cpp
@@ -0,0 +1,1205 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+
+#include <QtTest/QtTest>
+#include <stdio.h>
+#include <qobject.h>
+
+#include "using-namespaces.h"
+#include "assign-namespace.h"
+#include "no-keywords.h"
+#include "single_function_keyword.h"
+#include "backslash-newlines.h"
+#include "slots-with-void-template.h"
+#include "pure-virtual-signals.h"
+#include "qinvokable.h"
+// msvc and friends crap out on it
+#if !defined(Q_CC_GNU) || defined(Q_OS_IRIX) || defined(Q_OS_WIN)
+#define SKIP_NEWLINE_TEST
+#endif
+#if !defined(SKIP_NEWLINE_TEST)
+#include "os9-newlines.h"
+// msvc and friends crap out on this file too,
+// it seems to contain Mac 9 EOLs, and not windows EOLs.
+#include "win-newlines.h"
+#endif
+#include "escapes-in-string-literals.h"
+#include "cstyle-enums.h"
+
+
+#if defined(PARSE_BOOST)
+#include "parse-boost.h"
+#endif
+
+// No such thing as "long long" in Microsoft's compiler 13.0 and before
+#if defined Q_CC_MSVC && _MSC_VER <= 1310
+# define NOLONGLONG
+#endif
+
+QT_USE_NAMESPACE
+
+struct MyStruct {};
+struct MyStruct2 {};
+
+struct SuperClass {};
+
+// Try to avoid inserting for instance a comment with a quote between the following line and the Q_OBJECT
+// That will make the test give a false positive.
+const char* test_multiple_number_of_escapes = "\\\"";
+namespace MyNamespace
+{
+ class TestSuperClass : public QObject
+ {
+ Q_OBJECT
+ public:
+ inline TestSuperClass() {}
+ };
+}
+
+namespace String
+{
+ typedef QString Type;
+}
+
+namespace Int
+{
+ typedef int Type;
+}
+
+typedef struct {
+ int doNotConfuseMoc;
+} OldStyleCStruct;
+
+class Sender : public QObject
+{
+ Q_OBJECT
+
+public:
+ void sendValue(const String::Type& value)
+ {
+ emit send(value);
+ }
+ void sendValue(const Int::Type& value)
+ {
+ emit send(value);
+ }
+
+signals:
+ void send(const String::Type&);
+ void send(const Int::Type&);
+};
+
+class Receiver : public QObject
+{
+ Q_OBJECT
+public:
+ Receiver() : stringCallCount(0), intCallCount(0) {}
+
+ int stringCallCount;
+ int intCallCount;
+
+public slots:
+ void receive(const String::Type&) { stringCallCount++; }
+ void receive(const Int::Type&) { intCallCount++; }
+};
+
+#define MACRO_WITH_POSSIBLE_COMPILER_SPECIFIC_ATTRIBUTES
+
+#define DONT_CONFUSE_MOC(klass) klass
+#define DONT_CONFUSE_MOC_EVEN_MORE(klass, dummy, dummy2) klass
+
+Q_DECLARE_METATYPE(MyStruct)
+Q_DECLARE_METATYPE(MyStruct*)
+
+#if QT_VERSION >= 0x040200
+namespace myNS {
+ struct Points
+ {
+ Points() : p1(0xBEEF), p2(0xBABE) { }
+ int p1, p2;
+ };
+}
+
+Q_DECLARE_METATYPE(myNS::Points)
+#endif
+
+class TestClassinfoWithEscapes: public QObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("escaped", "\"bar\"")
+ Q_CLASSINFO("\"escaped\"", "foo")
+public slots:
+ void slotWithAReallyLongName(int)
+ { }
+};
+
+struct ForwardDeclaredStruct;
+
+struct StructQObject : public QObject
+{
+ Q_OBJECT
+public:
+ void foo(struct ForwardDeclaredStruct *);
+};
+
+void StructQObject::foo(struct ForwardDeclaredStruct *)
+{
+ struct Inner {
+ bool field;
+ };
+
+ struct Inner unusedVariable;
+}
+
+class TestClass : public MyNamespace::TestSuperClass, public DONT_CONFUSE_MOC(MyStruct),
+ public DONT_CONFUSE_MOC_EVEN_MORE(MyStruct2, dummy, ignored)
+{
+ Q_OBJECT
+#if QT_VERSION >= 0x040101
+ Q_CLASSINFO("help", QT_TR_NOOP("Opening this will let you configure something"))
+#endif
+#if QT_VERSION >= 0x040102
+ Q_PROPERTY(short int shortIntProperty READ shortIntProperty)
+ Q_PROPERTY(unsigned short int unsignedShortIntProperty READ unsignedShortIntProperty)
+ Q_PROPERTY(signed short int signedShortIntProperty READ signedShortIntProperty)
+ Q_PROPERTY(long int longIntProperty READ longIntProperty)
+ Q_PROPERTY(unsigned long int unsignedLongIntProperty READ unsignedLongIntProperty)
+ Q_PROPERTY(signed long int signedLongIntProperty READ signedLongIntProperty)
+ Q_PROPERTY(long double longDoubleProperty READ longDoubleProperty)
+#endif
+#if QT_VERSION >= 0x040200
+ Q_PROPERTY(myNS::Points points READ points WRITE setPoints)
+#endif
+
+ Q_CLASSINFO("Multi"
+ "line",
+ ""
+ "This is a "
+ "multiline Q_CLASSINFO"
+ "")
+
+ // a really really long string that we have to cut into pieces in the generated stringdata
+ // table, otherwise msvc craps out
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"org.kde.KCookieServer\" >\n"
+" <method name=\"findCookies\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
+" <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
+" <arg direction=\"out\" type=\"s\" name=\"cookies\" />\n"
+" </method>\n"
+" <method name=\"findDomains\" >\n"
+" <arg direction=\"out\" type=\"as\" name=\"domains\" />\n"
+" </method>\n"
+" <method name=\"findCookies\" >\n"
+" <arg direction=\"in\" type=\"ai\" name=\"fields\" />\n"
+" <arg direction=\"in\" type=\"s\" name=\"domain\" />\n"
+" <arg direction=\"in\" type=\"s\" name=\"fqdn\" />\n"
+" <arg direction=\"in\" type=\"s\" name=\"path\" />\n"
+" <arg direction=\"in\" type=\"s\" name=\"name\" />\n"
+" <arg direction=\"out\" type=\"as\" name=\"cookies\" />\n"
+" <annotation value=\"QList&lt;int>\" name=\"com.trolltech.QtDBus.QtTypeName.In0\" />\n"
+" </method>\n"
+" <method name=\"findDOMCookies\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
+" <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
+" <arg direction=\"out\" type=\"s\" name=\"cookies\" />\n"
+" </method>\n"
+" <method name=\"addCookies\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
+" <arg direction=\"in\" type=\"ay\" name=\"cookieHeader\" />\n"
+" <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
+" </method>\n"
+" <method name=\"deleteCookie\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"domain\" />\n"
+" <arg direction=\"in\" type=\"s\" name=\"fqdn\" />\n"
+" <arg direction=\"in\" type=\"s\" name=\"path\" />\n"
+" <arg direction=\"in\" type=\"s\" name=\"name\" />\n"
+" </method>\n"
+" <method name=\"deleteCookiesFromDomain\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"domain\" />\n"
+" </method>\n"
+" <method name=\"deleteSessionCookies\" >\n"
+" <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
+" </method>\n"
+" <method name=\"deleteSessionCookiesFor\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"fqdn\" />\n"
+" <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
+" </method>\n"
+" <method name=\"deleteAllCookies\" />\n"
+" <method name=\"addDOMCookies\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
+" <arg direction=\"in\" type=\"ay\" name=\"cookieHeader\" />\n"
+" <arg direction=\"in\" type=\"x\" name=\"windowId\" />\n"
+" </method>\n"
+" <method name=\"setDomainAdvice\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
+" <arg direction=\"in\" type=\"s\" name=\"advice\" />\n"
+" </method>\n"
+" <method name=\"getDomainAdvice\" >\n"
+" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
+" <arg direction=\"out\" type=\"s\" name=\"advice\" />\n"
+" </method>\n"
+" <method name=\"reloadPolicy\" />\n"
+" <method name=\"shutdown\" />\n"
+" </interface>\n"
+ "")
+
+public:
+ inline TestClass() {}
+
+private slots:
+ inline void dummy1() MACRO_WITH_POSSIBLE_COMPILER_SPECIFIC_ATTRIBUTES {}
+ inline void dummy2() MACRO_WITH_POSSIBLE_COMPILER_SPECIFIC_ATTRIBUTES const {}
+ inline void dummy3() const MACRO_WITH_POSSIBLE_COMPILER_SPECIFIC_ATTRIBUTES {}
+
+#ifndef NOLONGLONG
+ void slotWithULongLong(unsigned long long) {}
+#if QT_VERSION >= 0x040101
+ void slotWithULongLongP(unsigned long long*) {}
+#endif
+ void slotWithULong(unsigned long) {}
+ void slotWithLongLong(long long) {}
+ void slotWithLong(long) {}
+#endif
+
+ void slotWithColonColonType(::Int::Type) {}
+
+#if QT_VERSION >= 0x040101
+ TestClass &slotWithReferenceReturnType() { return *this; }
+#endif
+
+#if (0 && 1) || 1
+ void expressionEvaluationShortcut1() {}
+#endif
+#if (1 || 0) && 0
+#else
+ void expressionEvaluationShortcut2() {}
+#endif
+
+public slots:
+ void slotWithArray(const double[3]) {}
+ void slotWithNamedArray(const double namedArray[3]) {}
+ void slotWithMultiArray(const double[3][4]) {}
+
+#if QT_VERSION >= 0x040102
+ short int shortIntProperty() { return 0; }
+ unsigned short int unsignedShortIntProperty() { return 0; }
+ signed short int signedShortIntProperty() { return 0; }
+ long int longIntProperty() { return 0; }
+ unsigned long int unsignedLongIntProperty() { return 0; }
+ signed long int signedLongIntProperty() { return 0; }
+ long double longDoubleProperty() { return 0.0; }
+#endif
+
+#if QT_VERSION >= 0x040200
+ myNS::Points points() { return m_points; }
+ void setPoints(myNS::Points points) { m_points = points; }
+#endif
+
+signals:
+ void signalWithArray(const double[3]);
+ void signalWithNamedArray(const double namedArray[3]);
+
+private slots:
+ // for tst_Moc::preprocessorConditionals
+#if 0
+ void invalidSlot() {}
+#else
+ void slotInElse() {}
+#endif
+
+#if 1
+ void slotInIf() {}
+#else
+ void invalidSlot() {}
+#endif
+
+#if 0
+ void invalidSlot() {}
+#elif 0
+#else
+ void slotInLastElse() {}
+#endif
+
+#if 0
+ void invalidSlot() {}
+#elif 1
+ void slotInElif() {}
+#else
+ void invalidSlot() {}
+#endif
+
+
+ friend class Receiver; // task #85783
+signals:
+ friend class Sender; // task #85783
+
+public slots:
+ void const slotWithSillyConst() {}
+
+public:
+ Q_INVOKABLE void const slotWithSillyConst2() {}
+
+ // that one however should be fine
+public slots:
+ void slotWithVoidStar(void *) {}
+
+#if QT_VERSION >= 0x040200
+private:
+ myNS::Points m_points;
+#endif
+
+private slots:
+ inline virtual void blub1() {}
+ virtual inline void blub2() {}
+};
+
+class PropertyTestClass : public QObject
+{
+ Q_OBJECT
+public:
+
+ enum TestEnum { One, Two, Three };
+
+ Q_ENUMS(TestEnum)
+};
+
+class PropertyUseClass : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(PropertyTestClass::TestEnum foo READ foo)
+public:
+
+ inline PropertyTestClass::TestEnum foo() const { return PropertyTestClass::One; }
+};
+
+#if defined(Q_MOC_RUN)
+// Task #119503
+#define _TASK_119503
+#if !_TASK_119503
+#endif
+#endif
+
+static QString srcify(const char *path)
+{
+#ifndef Q_OS_IRIX
+ return QString(SRCDIR) + QLatin1Char('/') + QLatin1String(path);
+#else
+ return QString(QLatin1String(path));
+#endif
+}
+
+class CtorTestClass : public QObject
+{
+ Q_OBJECT
+public:
+ Q_INVOKABLE CtorTestClass(QObject *parent = 0);
+
+ CtorTestClass(int foo);
+
+ inline Q_INVOKABLE CtorTestClass(const QString &str)
+ { m_str = str; }
+
+ QString m_str;
+
+protected:
+ CtorTestClass(int foo, int bar, int baz);
+private:
+ CtorTestClass(float, float) {}
+};
+
+CtorTestClass::CtorTestClass(QObject *parent)
+ : QObject(parent) {}
+
+CtorTestClass::CtorTestClass(int, int, int) {}
+
+
+class tst_Moc : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(bool user1 READ user1 USER true )
+ Q_PROPERTY(bool user2 READ user2 USER false)
+ Q_PROPERTY(bool user3 READ user3 USER userFunction())
+
+public:
+ inline tst_Moc() {}
+
+private slots:
+ void slotWithException() throw(MyStruct);
+ void dontStripNamespaces();
+ void oldStyleCasts();
+ void warnOnExtraSignalSlotQualifiaction();
+ void uLongLong();
+ void inputFileNameWithDotsButNoExtension();
+ void userProperties();
+ void supportConstSignals();
+ void task87883();
+ void multilineComments();
+ void classinfoWithEscapes();
+ void trNoopInClassInfo();
+ void ppExpressionEvaluation();
+ void arrayArguments();
+ void preprocessorConditionals();
+ void blackslashNewlines();
+ void slotWithSillyConst();
+ void testExtraData();
+ void namespaceTypeProperty();
+ void slotsWithVoidTemplate();
+ void structQObject();
+ void namespacedFlags();
+ void warnOnMultipleInheritance();
+ void forgottenQInterface();
+ void os9Newline();
+ void winNewline();
+ void escapesInStringLiterals();
+ void frameworkSearchPath();
+ void cstyleEnums();
+ void defineMacroViaCmdline();
+ void invokable();
+ void singleFunctionKeywordSignalAndSlot();
+ void templateGtGt();
+ void qprivateslots();
+ void inlineSlotsWithThrowDeclaration();
+ void warnOnPropertyWithoutREAD();
+ void constructors();
+ void typenameWithUnsigned();
+
+signals:
+ void sigWithUnsignedArg(unsigned foo);
+ void sigWithSignedArg(signed foo);
+ void sigWithConstSignedArg(const signed foo);
+ void sigWithVolatileConstSignedArg(volatile const signed foo);
+ void sigWithCustomType(const MyStruct);
+ void constSignal1() const;
+ void constSignal2(int arg) const;
+
+private:
+ bool user1() { return true; };
+ bool user2() { return false; };
+ bool user3() { return false; };
+ bool userFunction(){ return false; };
+};
+
+void tst_Moc::slotWithException() throw(MyStruct)
+{
+ // be happy
+ QVERIFY(true);
+}
+
+void tst_Moc::dontStripNamespaces()
+{
+ Sender sender;
+ Receiver receiver;
+
+ connect(&sender, SIGNAL(send(const String::Type &)),
+ &receiver, SLOT(receive(const String::Type &)));
+ connect(&sender, SIGNAL(send(const Int::Type &)),
+ &receiver, SLOT(receive(const Int::Type &)));
+
+ sender.sendValue(String::Type("Hello"));
+ QCOMPARE(receiver.stringCallCount, 1);
+ QCOMPARE(receiver.intCallCount, 0);
+ sender.sendValue(Int::Type(42));
+ QCOMPARE(receiver.stringCallCount, 1);
+ QCOMPARE(receiver.intCallCount, 1);
+}
+
+
+void tst_Moc::oldStyleCasts()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QProcess proc;
+ proc.start("moc", QStringList(srcify("/oldstyle-casts.h")));
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+
+ QStringList args;
+ args << "-c" << "-x" << "c++" << "-Wold-style-cast" << "-I" << "."
+ << "-I" << qgetenv("QTDIR") + "/include" << "-o" << "/dev/null" << "-";
+ proc.start("gcc", args);
+ QVERIFY(proc.waitForStarted());
+ proc.write(mocOut);
+ proc.closeWriteChannel();
+
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
+void tst_Moc::warnOnExtraSignalSlotQualifiaction()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QProcess proc;
+ proc.start("moc", QStringList(srcify("extraqualification.h")));
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+ QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
+ QCOMPARE(mocWarning, QString(SRCDIR) +
+ QString("/extraqualification.h:53: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
+ QString(SRCDIR) + QString("/extraqualification.h:56: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
+void tst_Moc::uLongLong()
+{
+#ifndef NOLONGLONG
+ TestClass tst;
+ const QMetaObject *mobj = tst.metaObject();
+ int idx = mobj->indexOfSlot("slotWithULong(ulong)");
+ QVERIFY(idx != -1);
+ idx = mobj->indexOfSlot("slotWithULongLong(unsigned long long)");
+ QVERIFY(idx != -1);
+#if QT_VERSION >= 0x040101
+ idx = mobj->indexOfSlot("slotWithULongLongP(unsigned long long*)");
+ QVERIFY(idx != -1);
+#endif
+
+ idx = mobj->indexOfSlot("slotWithLong(long)");
+ QVERIFY(idx != -1);
+ idx = mobj->indexOfSlot("slotWithLongLong(long long)");
+ QVERIFY(idx != -1);
+#else
+ QSKIP("long long doesn't work on MSVC6 & .NET 2002, also skipped on 2003 due to compiler version issue with moc", SkipAll);
+#endif
+}
+
+void tst_Moc::inputFileNameWithDotsButNoExtension()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QProcess proc;
+ proc.setWorkingDirectory(QString(SRCDIR) + "/task71021");
+ proc.start("moc", QStringList("../Header"));
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+
+ QStringList args;
+ args << "-c" << "-x" << "c++" << "-I" << ".."
+ << "-I" << qgetenv("QTDIR") + "/include" << "-o" << "/dev/null" << "-";
+ proc.start("gcc", args);
+ QVERIFY(proc.waitForStarted());
+ proc.write(mocOut);
+ proc.closeWriteChannel();
+
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()), QString());
+ QCOMPARE(proc.exitCode(), 0);
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
+void tst_Moc::userProperties()
+{
+ const QMetaObject *mobj = metaObject();
+ QMetaProperty property = mobj->property(mobj->indexOfProperty("user1"));
+ QVERIFY(property.isValid());
+ QVERIFY(property.isUser());
+
+ property = mobj->property(mobj->indexOfProperty("user2"));
+ QVERIFY(property.isValid());
+ QVERIFY(!property.isUser());
+
+ property = mobj->property(mobj->indexOfProperty("user3"));
+ QVERIFY(property.isValid());
+ QVERIFY(!property.isUser(this));
+}
+
+void tst_Moc::supportConstSignals()
+{
+ QSignalSpy spy1(this, SIGNAL(constSignal1()));
+ QVERIFY(spy1.isEmpty());
+ emit constSignal1();
+ QCOMPARE(spy1.count(), 1);
+
+ QSignalSpy spy2(this, SIGNAL(constSignal2(int)));
+ QVERIFY(spy2.isEmpty());
+ emit constSignal2(42);
+ QCOMPARE(spy2.count(), 1);
+ QCOMPARE(spy2.at(0).at(0).toInt(), 42);
+}
+
+#include "task87883.h"
+
+void tst_Moc::task87883()
+{
+#if QT_VERSION >= 0x040101
+ QVERIFY(Task87883::staticMetaObject.className());
+#else
+ QSKIP("Fixed in >= 4.1.1", SkipAll);
+#endif
+}
+
+#include "c-comments.h"
+
+void tst_Moc::multilineComments()
+{
+#if QT_VERSION >= 0x040101
+ QVERIFY(IfdefedClass::staticMetaObject.className());
+#else
+ QSKIP("Fixed in >= 4.1.1", SkipAll);
+#endif
+}
+
+void tst_Moc::classinfoWithEscapes()
+{
+ const QMetaObject *mobj = &TestClassinfoWithEscapes::staticMetaObject;
+ QCOMPARE(mobj->methodCount() - mobj->methodOffset(), 1);
+
+ QMetaMethod mm = mobj->method(mobj->methodOffset());
+ QCOMPARE(mm.signature(), "slotWithAReallyLongName(int)");
+}
+
+void tst_Moc::trNoopInClassInfo()
+{
+ TestClass t;
+ const QMetaObject *mobj = t.metaObject();
+ QVERIFY(mobj);
+ QCOMPARE(mobj->classInfoCount(), 3);
+ QCOMPARE(mobj->indexOfClassInfo("help"), 0);
+ QCOMPARE(QString(mobj->classInfo(0).value()), QString("Opening this will let you configure something"));
+}
+
+void tst_Moc::ppExpressionEvaluation()
+{
+ TestClass tst;
+ const QMetaObject *mobj = tst.metaObject();
+ int idx = mobj->indexOfSlot("expressionEvaluationShortcut1()");
+ QVERIFY(idx != -1);
+
+ idx = mobj->indexOfSlot("expressionEvaluationShortcut2()");
+ QVERIFY(idx != -1);
+}
+
+void tst_Moc::arrayArguments()
+{
+ TestClass tst;
+ const QMetaObject *mobj = tst.metaObject();
+ QVERIFY(mobj->indexOfSlot("slotWithArray(const double[3])") != -1);
+ QVERIFY(mobj->indexOfSlot("slotWithNamedArray(const double[3])") != -1);
+ QVERIFY(mobj->indexOfSlot("slotWithMultiArray(const double[3][4])") != -1);
+ QVERIFY(mobj->indexOfSignal("signalWithArray(const double[3])") != -1);
+ QVERIFY(mobj->indexOfSignal("signalWithNamedArray(const double[3])") != -1);
+}
+
+void tst_Moc::preprocessorConditionals()
+{
+ TestClass tst;
+ const QMetaObject *mobj = tst.metaObject();
+ QVERIFY(mobj->indexOfSlot("slotInElse()") != -1);
+ QVERIFY(mobj->indexOfSlot("slotInIf()") != -1);
+ QVERIFY(mobj->indexOfSlot("slotInLastElse()") != -1);
+ QVERIFY(mobj->indexOfSlot("slotInElif()") != -1);
+}
+
+void tst_Moc::blackslashNewlines()
+{
+ BackslashNewlines tst;
+ const QMetaObject *mobj = tst.metaObject();
+ QVERIFY(mobj->indexOfSlot("works()") != -1);
+ QVERIFY(mobj->indexOfSlot("buggy()") == -1);
+}
+
+void tst_Moc::slotWithSillyConst()
+{
+ TestClass tst;
+ const QMetaObject *mobj = tst.metaObject();
+ QVERIFY(mobj->indexOfSlot("slotWithSillyConst()") != -1);
+ QVERIFY(mobj->indexOfMethod("slotWithSillyConst2()") != -1);
+ QVERIFY(mobj->indexOfSlot("slotWithVoidStar(void*)") != -1);
+}
+
+void tst_Moc::testExtraData()
+{
+ const QMetaObject *mobj = &PropertyTestClass::staticMetaObject;
+ QCOMPARE(mobj->enumeratorCount(), 1);
+ QCOMPARE(QByteArray(mobj->enumerator(0).name()), QByteArray("TestEnum"));
+
+ mobj = &PropertyUseClass::staticMetaObject;
+ const int idx = mobj->indexOfProperty("foo");
+ QVERIFY(idx != -1);
+ const QMetaProperty prop = mobj->property(idx);
+ QVERIFY(prop.isValid());
+ QVERIFY(prop.isEnumType());
+ const QMetaEnum en = prop.enumerator();
+ QCOMPARE(QByteArray(en.name()), QByteArray("TestEnum"));
+}
+
+void tst_Moc::namespaceTypeProperty()
+{
+ qRegisterMetaType<myNS::Points>("myNS::Points");
+ TestClass tst;
+ QByteArray ba = QByteArray("points");
+ QVariant v = tst.property(ba);
+ QVERIFY(v.isValid());
+ myNS::Points p = qVariantValue<myNS::Points>(v);
+ QCOMPARE(p.p1, 0xBEEF);
+ QCOMPARE(p.p2, 0xBABE);
+ p.p1 = 0xCAFE;
+ p.p2 = 0x1EE7;
+ QVERIFY(tst.setProperty(ba, qVariantFromValue(p)));
+ myNS::Points pp = qVariantValue<myNS::Points>(tst.property(ba));
+ QCOMPARE(p.p1, pp.p1);
+ QCOMPARE(p.p2, pp.p2);
+}
+
+void tst_Moc::slotsWithVoidTemplate()
+{
+ SlotsWithVoidTemplateTest test;
+ QVERIFY(QObject::connect(&test, SIGNAL(myVoidSignal(void)),
+ &test, SLOT(dummySlot(void))));
+ QVERIFY(QObject::connect(&test, SIGNAL(mySignal(const TestTemplate<void> &)),
+ &test, SLOT(anotherSlot(const TestTemplate<void> &))));
+}
+
+void tst_Moc::structQObject()
+{
+ StructQObject o;
+ QCOMPARE(QByteArray(o.metaObject()->className()), QByteArray("StructQObject"));
+}
+
+#include "namespaced-flags.h"
+
+void tst_Moc::namespacedFlags()
+{
+ Foo::Baz baz;
+ Foo::Bar bar;
+
+ bar.setFlags(Foo::Bar::Read | Foo::Bar::Write);
+ QVERIFY(baz.flags() != bar.flags());
+
+ const QVariant v = bar.property("flags");
+ QVERIFY(v.isValid());
+ QVERIFY(baz.setProperty("flags", v));
+ QVERIFY(baz.flags() == bar.flags());
+}
+
+void tst_Moc::warnOnMultipleInheritance()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QProcess proc;
+ proc.start("moc", QStringList(srcify("warn-on-multiple-qobject-subclasses.h")));
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+ QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
+ QCOMPARE(mocWarning, QString(SRCDIR) +
+ QString("/warn-on-multiple-qobject-subclasses.h:53: Warning: Class Bar inherits from two QObject subclasses QWidget and Foo. This is not supported!\n"));
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
+void tst_Moc::forgottenQInterface()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QProcess proc;
+ proc.start("moc", QStringList(srcify("forgotten-qinterface.h")));
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+ QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
+ QCOMPARE(mocWarning, QString(SRCDIR) +
+ QString("/forgotten-qinterface.h:53: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
+void tst_Moc::os9Newline()
+{
+#if !defined(SKIP_NEWLINE_TEST)
+ const QMetaObject &mo = Os9Newlines::staticMetaObject;
+ QVERIFY(mo.indexOfSlot("testSlot()") != -1);
+ QFile f(srcify("os9-newlines.h"));
+ QVERIFY(f.open(QIODevice::ReadOnly)); // no QIODevice::Text!
+ QByteArray data = f.readAll();
+ f.close();
+ QVERIFY(!data.contains('\n'));
+ QVERIFY(data.contains('\r'));
+#endif
+}
+
+void tst_Moc::winNewline()
+{
+#if !defined(SKIP_NEWLINE_TEST)
+ const QMetaObject &mo = WinNewlines::staticMetaObject;
+ QVERIFY(mo.indexOfSlot("testSlot()") != -1);
+ QFile f(srcify("win-newlines.h"));
+ QVERIFY(f.open(QIODevice::ReadOnly)); // no QIODevice::Text!
+ QByteArray data = f.readAll();
+ f.close();
+ for (int i = 0; i < data.count(); ++i) {
+ if (data.at(i) == QLatin1Char('\r')) {
+ QVERIFY(i < data.count() - 1);
+ ++i;
+ QVERIFY(data.at(i) == '\n');
+ } else {
+ QVERIFY(data.at(i) != '\n');
+ }
+ }
+#endif
+}
+
+void tst_Moc::escapesInStringLiterals()
+{
+ const QMetaObject &mo = StringLiterals::staticMetaObject;
+ QCOMPARE(mo.classInfoCount(), 3);
+
+ int idx = mo.indexOfClassInfo("Test");
+ QVERIFY(idx != -1);
+ QMetaClassInfo info = mo.classInfo(idx);
+ QCOMPARE(QByteArray(info.value()),
+ QByteArray("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\x53"));
+
+ QVERIFY(idx != -1);
+ idx = mo.indexOfClassInfo("Test2");
+ info = mo.classInfo(idx);
+ QCOMPARE(QByteArray(info.value()),
+ QByteArray("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\123"));
+
+ QVERIFY(idx != -1);
+ idx = mo.indexOfClassInfo("Test3");
+ info = mo.classInfo(idx);
+ QCOMPARE(QByteArray(info.value()),
+ QByteArray("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nb"));
+}
+
+void tst_Moc::frameworkSearchPath()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_UNIX)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QStringList args;
+ args << "-F" << srcify(".")
+ << srcify("interface-from-framework.h")
+ ;
+
+ QProcess proc;
+ proc.start("moc", args);
+ bool finished = proc.waitForFinished();
+ if (!finished)
+ qWarning("waitForFinished failed. QProcess error: %d", (int)proc.error());
+ QVERIFY(finished);
+ if (proc.exitCode() != 0) {
+ qDebug() << proc.readAllStandardError();
+ }
+ QCOMPARE(proc.exitCode(), 0);
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+#else
+ QSKIP("Only tested/relevant on unixy platforms", SkipAll);
+#endif
+}
+
+void tst_Moc::cstyleEnums()
+{
+ const QMetaObject &obj = CStyleEnums::staticMetaObject;
+ QCOMPARE(obj.enumeratorCount(), 1);
+ QMetaEnum metaEnum = obj.enumerator(0);
+ QCOMPARE(metaEnum.name(), "Baz");
+ QCOMPARE(metaEnum.keyCount(), 2);
+ QCOMPARE(metaEnum.key(0), "Foo");
+ QCOMPARE(metaEnum.key(1), "Bar");
+}
+
+void tst_Moc::templateGtGt()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QProcess proc;
+ proc.start("moc", QStringList(srcify("template-gtgt.h")));
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+ QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
+ QVERIFY(mocWarning.isEmpty());
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
+void tst_Moc::defineMacroViaCmdline()
+{
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QProcess proc;
+
+ QStringList args;
+ args << "-DFOO";
+ args << srcify("macro-on-cmdline.h");
+
+ proc.start("moc", args);
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QCOMPARE(proc.readAllStandardError(), QByteArray());
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
+void tst_Moc::invokable()
+{
+ {
+ const QMetaObject &mobj = InvokableBeforeReturnType::staticMetaObject;
+ QCOMPARE(mobj.methodCount(), 5);
+ QVERIFY(mobj.method(4).signature() == QByteArray("foo()"));
+ }
+
+ {
+ const QMetaObject &mobj = InvokableBeforeInline::staticMetaObject;
+ QCOMPARE(mobj.methodCount(), 6);
+ QVERIFY(mobj.method(4).signature() == QByteArray("foo()"));
+ QVERIFY(mobj.method(5).signature() == QByteArray("bar()"));
+ }
+}
+
+void tst_Moc::singleFunctionKeywordSignalAndSlot()
+{
+ {
+ const QMetaObject &mobj = SingleFunctionKeywordBeforeReturnType::staticMetaObject;
+ QCOMPARE(mobj.methodCount(), 6);
+ QVERIFY(mobj.method(4).signature() == QByteArray("mySignal()"));
+ QVERIFY(mobj.method(5).signature() == QByteArray("mySlot()"));
+ }
+
+ {
+ const QMetaObject &mobj = SingleFunctionKeywordBeforeInline::staticMetaObject;
+ QCOMPARE(mobj.methodCount(), 6);
+ QVERIFY(mobj.method(4).signature() == QByteArray("mySignal()"));
+ QVERIFY(mobj.method(5).signature() == QByteArray("mySlot()"));
+ }
+
+ {
+ const QMetaObject &mobj = SingleFunctionKeywordAfterInline::staticMetaObject;
+ QCOMPARE(mobj.methodCount(), 6);
+ QVERIFY(mobj.method(4).signature() == QByteArray("mySignal()"));
+ QVERIFY(mobj.method(5).signature() == QByteArray("mySlot()"));
+ }
+}
+
+#include "qprivateslots.h"
+
+void tst_Moc::qprivateslots()
+{
+ TestQPrivateSlots tst;
+ const QMetaObject *mobj = tst.metaObject();
+ QVERIFY(mobj->indexOfSlot("_q_privateslot()") != -1);
+ QVERIFY(mobj->indexOfMethod("method1()") != -1); //tast204730
+}
+
+#include "task189996.h"
+
+void InlineSlotsWithThrowDeclaration::c() throw() {}
+
+void tst_Moc::inlineSlotsWithThrowDeclaration()
+{
+ InlineSlotsWithThrowDeclaration tst;
+ const QMetaObject *mobj = tst.metaObject();
+ QVERIFY(mobj->indexOfSlot("a()") != -1);
+ QVERIFY(mobj->indexOfSlot("b()") != -1);
+ QVERIFY(mobj->indexOfSlot("c()") != -1);
+ QVERIFY(mobj->indexOfSlot("d()") != -1);
+ QVERIFY(mobj->indexOfSlot("e()") != -1);
+}
+
+void tst_Moc::warnOnPropertyWithoutREAD()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+ QVERIFY(!qgetenv("QTDIR").isNull());
+
+ QProcess proc;
+ proc.start("moc", QStringList(srcify("warn-on-property-without-read.h")));
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 0);
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(!mocOut.isEmpty());
+ QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
+ QCOMPARE(mocWarning, QString(SRCDIR) +
+ QString("/warn-on-property-without-read.h:46: Warning: Property declaration foo has no READ accessor function. The property will be invalid.\n"));
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
+void tst_Moc::constructors()
+{
+ const QMetaObject *mo = &CtorTestClass::staticMetaObject;
+ QCOMPARE(mo->constructorCount(), 3);
+ {
+ QMetaMethod mm = mo->constructor(0);
+ QCOMPARE(mm.access(), QMetaMethod::Public);
+ QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
+ QCOMPARE(mm.signature(), "CtorTestClass(QObject*)");
+ QCOMPARE(mm.typeName(), "");
+ QList<QByteArray> paramNames = mm.parameterNames();
+ QCOMPARE(paramNames.size(), 1);
+ QCOMPARE(paramNames.at(0), QByteArray("parent"));
+ QList<QByteArray> paramTypes = mm.parameterTypes();
+ QCOMPARE(paramTypes.size(), 1);
+ QCOMPARE(paramTypes.at(0), QByteArray("QObject*"));
+ }
+ {
+ QMetaMethod mm = mo->constructor(1);
+ QCOMPARE(mm.access(), QMetaMethod::Public);
+ QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
+ QCOMPARE(mm.signature(), "CtorTestClass()");
+ QCOMPARE(mm.typeName(), "");
+ QCOMPARE(mm.parameterNames().size(), 0);
+ QCOMPARE(mm.parameterTypes().size(), 0);
+ }
+ {
+ QMetaMethod mm = mo->constructor(2);
+ QCOMPARE(mm.access(), QMetaMethod::Public);
+ QCOMPARE(mm.methodType(), QMetaMethod::Constructor);
+ QCOMPARE(mm.signature(), "CtorTestClass(QString)");
+ QCOMPARE(mm.typeName(), "");
+ QList<QByteArray> paramNames = mm.parameterNames();
+ QCOMPARE(paramNames.size(), 1);
+ QCOMPARE(paramNames.at(0), QByteArray("str"));
+ QList<QByteArray> paramTypes = mm.parameterTypes();
+ QCOMPARE(paramTypes.size(), 1);
+ QCOMPARE(paramTypes.at(0), QByteArray("QString"));
+ }
+
+ QCOMPARE(mo->indexOfConstructor("CtorTestClass(QObject*)"), 0);
+ QCOMPARE(mo->indexOfConstructor("CtorTestClass()"), 1);
+ QCOMPARE(mo->indexOfConstructor("CtorTestClass(QString)"), 2);
+ QCOMPARE(mo->indexOfConstructor("CtorTestClass2(QObject*)"), -1);
+ QCOMPARE(mo->indexOfConstructor("CtorTestClass(float,float)"), -1);
+
+ QObject *o1 = mo->newInstance();
+ QVERIFY(o1 != 0);
+ QCOMPARE(o1->parent(), (QObject*)0);
+ QVERIFY(qobject_cast<CtorTestClass*>(o1) != 0);
+
+ QObject *o2 = mo->newInstance(Q_ARG(QObject*, o1));
+ QVERIFY(o2 != 0);
+ QCOMPARE(o2->parent(), o1);
+
+ QString str = QString::fromLatin1("hello");
+ QObject *o3 = mo->newInstance(Q_ARG(QString, str));
+ QVERIFY(o3 != 0);
+ QCOMPARE(qobject_cast<CtorTestClass*>(o3)->m_str, str);
+}
+
+#include "task234909.h"
+
+#include "task240368.h"
+
+void tst_Moc::typenameWithUnsigned()
+{
+ TypenameWithUnsigned tst;
+ const QMetaObject *mobj = tst.metaObject();
+ QVERIFY(mobj->indexOfSlot("a(uint)") != -1);
+ QVERIFY(mobj->indexOfSlot("b(uint)") != -1);
+ QVERIFY(mobj->indexOfSlot("c(uint*)") != -1);
+ QVERIFY(mobj->indexOfSlot("d(uint*)") != -1);
+ QVERIFY(mobj->indexOfSlot("e(uint&)") != -1);
+ QVERIFY(mobj->indexOfSlot("f(uint&)") != -1);
+ QVERIFY(mobj->indexOfSlot("g(unsigned1)") != -1);
+ QVERIFY(mobj->indexOfSlot("h(unsigned1)") != -1);
+ QVERIFY(mobj->indexOfSlot("i(uint,unsigned1)") != -1);
+ QVERIFY(mobj->indexOfSlot("j(unsigned1,uint)") != -1);
+ QVERIFY(mobj->indexOfSlot("k(unsignedQImage)") != -1);
+ QVERIFY(mobj->indexOfSlot("l(unsignedQImage)") != -1);
+}
+
+QTEST_MAIN(tst_Moc)
+#include "tst_moc.moc"
+
+
+
diff --git a/tests/auto/moc/using-namespaces.h b/tests/auto/moc/using-namespaces.h
new file mode 100644
index 0000000..77bcf59
--- /dev/null
+++ b/tests/auto/moc/using-namespaces.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+namespace Foo {}
+namespace Bar
+{
+ namespace Huh
+ {
+ }
+}
+namespace Top
+{
+}
+
+using namespace Foo;
+using namespace Bar::Huh;
+using namespace ::Top;
+
diff --git a/tests/auto/moc/warn-on-multiple-qobject-subclasses.h b/tests/auto/moc/warn-on-multiple-qobject-subclasses.h
new file mode 100644
index 0000000..2cc5bed
--- /dev/null
+++ b/tests/auto/moc/warn-on-multiple-qobject-subclasses.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+class Foo : public QObject
+{
+ Q_OBJECT
+public:
+};
+
+class Bar : public QWidget, public Foo
+{
+ Q_OBJECT
+};
+
+
diff --git a/tests/auto/moc/warn-on-property-without-read.h b/tests/auto/moc/warn-on-property-without-read.h
new file mode 100644
index 0000000..939d8c8
--- /dev/null
+++ b/tests/auto/moc/warn-on-property-without-read.h
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QObject>
+
+class ClassWithPropertyWithoutREAD : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int foo)
+ Q_PROPERTY(int bar READ bar)
+};
diff --git a/tests/auto/moc/win-newlines.h b/tests/auto/moc/win-newlines.h
new file mode 100644
index 0000000..ae8aad8
--- /dev/null
+++ b/tests/auto/moc/win-newlines.h
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QObject>
+
+class WinNewlines : public QObject
+{
+ Q_OBJECT
+public Q_SLOTS:
+ inline void testSlot() {}
+};