summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/assign-namespace.h4
-rw-r--r--tests/auto/tools/moc/backslash-newlines.h4
-rw-r--r--tests/auto/tools/moc/c-comments.h4
-rw-r--r--tests/auto/tools/moc/cstyle-enums.h4
-rw-r--r--tests/auto/tools/moc/cxx11-enums.h4
-rw-r--r--tests/auto/tools/moc/dir-in-include-path.h4
-rw-r--r--tests/auto/tools/moc/dollars.h4
-rw-r--r--tests/auto/tools/moc/error-on-wrong-notify.h4
-rw-r--r--tests/auto/tools/moc/escapes-in-string-literals.h4
-rw-r--r--tests/auto/tools/moc/extraqualification.h4
-rw-r--r--tests/auto/tools/moc/forgotten-qinterface.h4
-rw-r--r--tests/auto/tools/moc/forward-declared-param.h6
-rw-r--r--tests/auto/tools/moc/function-with-attributes.h4
-rw-r--r--tests/auto/tools/moc/interface-from-framework.h3
-rw-r--r--tests/auto/tools/moc/macro-on-cmdline.h4
-rw-r--r--tests/auto/tools/moc/moc.pro6
-rw-r--r--tests/auto/tools/moc/namespaced-flags.h4
-rw-r--r--tests/auto/tools/moc/no-keywords.h4
-rw-r--r--tests/auto/tools/moc/oldstyle-casts.h6
-rw-r--r--tests/auto/tools/moc/parse-boost.h4
-rw-r--r--tests/auto/tools/moc/pp-dollar-signs.h4
-rw-r--r--tests/auto/tools/moc/pure-virtual-signals.h4
-rw-r--r--tests/auto/tools/moc/qinvokable.h4
-rw-r--r--tests/auto/tools/moc/qprivateslots.h4
-rw-r--r--tests/auto/tools/moc/qtbug-35657-gadget.h56
-rw-r--r--tests/auto/tools/moc/related-metaobjects-in-gadget.h59
-rw-r--r--tests/auto/tools/moc/related-metaobjects-in-namespaces.h65
-rw-r--r--tests/auto/tools/moc/related-metaobjects-name-conflict.h117
-rw-r--r--tests/auto/tools/moc/single-quote-digit-separator-n3781.h4
-rw-r--r--tests/auto/tools/moc/single_function_keyword.h4
-rw-r--r--tests/auto/tools/moc/slots-with-void-template.h4
-rw-r--r--tests/auto/tools/moc/task192552.h4
-rw-r--r--tests/auto/tools/moc/task234909.h4
-rw-r--r--tests/auto/tools/moc/task87883.h4
-rw-r--r--tests/auto/tools/moc/template-gtgt.h4
-rw-r--r--tests/auto/tools/moc/trigraphs.h4
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp145
-rw-r--r--tests/auto/tools/moc/unterminated-function-macro.h4
-rw-r--r--tests/auto/tools/moc/using-namespaces.h4
-rw-r--r--tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h4
-rw-r--r--tests/auto/tools/moc/warn-on-property-without-read.h4
-rw-r--r--tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h50
-rw-r--r--tests/auto/tools/uic/tst_uic.cpp52
43 files changed, 679 insertions, 14 deletions
diff --git a/tests/auto/tools/moc/assign-namespace.h b/tests/auto/tools/moc/assign-namespace.h
index 8f5ecc23e7..7377b38f6b 100644
--- a/tests/auto/tools/moc/assign-namespace.h
+++ b/tests/auto/tools/moc/assign-namespace.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef ASSIGN_NAMESPACE_H
+#define ASSIGN_NAMESPACE_H
+
namespace A
{
namespace Nested
@@ -50,3 +53,4 @@ namespace A
namespace Mine = Qt;
namespace Theirs = A::Nested::Space;
+#endif // ASSIGN_NAMESPACE_H
diff --git a/tests/auto/tools/moc/backslash-newlines.h b/tests/auto/tools/moc/backslash-newlines.h
index 27c47843a2..29d800f26f 100644
--- a/tests/auto/tools/moc/backslash-newlines.h
+++ b/tests/auto/tools/moc/backslash-newlines.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef BACKSLASH_NEWLINES_H
+#define BACKSLASH_NEWLINES_H
+
#include <QObject>
const int blackslashNewlinesDummy = 0
@@ -61,3 +64,4 @@ public slots:
#undef value
+#endif // BACKSLASH_NEWLINES_H
diff --git a/tests/auto/tools/moc/c-comments.h b/tests/auto/tools/moc/c-comments.h
index bded642737..dff4492287 100644
--- a/tests/auto/tools/moc/c-comments.h
+++ b/tests/auto/tools/moc/c-comments.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef C_COMMENTS_H
+#define C_COMMENTS_H
#include <qobject.h>
/* test support for multi-line comments in preprocessor statements */
@@ -53,3 +56,4 @@ public:
};
#endif
+#endif // C_COMMENTS_H
diff --git a/tests/auto/tools/moc/cstyle-enums.h b/tests/auto/tools/moc/cstyle-enums.h
index 38c5932f69..7d1f6d0147 100644
--- a/tests/auto/tools/moc/cstyle-enums.h
+++ b/tests/auto/tools/moc/cstyle-enums.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef CSTYLE_ENUMS_H
+#define CSTYLE_ENUMS_H
#include <QObject>
class CStyleEnums
@@ -48,3 +51,4 @@ public:
typedef enum { Foo, Bar } Baz;
};
+#endif // CSTYLE_ENUMS_H
diff --git a/tests/auto/tools/moc/cxx11-enums.h b/tests/auto/tools/moc/cxx11-enums.h
index 0bd99b762c..215ae093d9 100644
--- a/tests/auto/tools/moc/cxx11-enums.h
+++ b/tests/auto/tools/moc/cxx11-enums.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef CXX11_ENUMS_H
+#define CXX11_ENUMS_H
#include <QtCore/QObject>
#if defined(Q_COMPILER_CLASS_ENUM) || defined(Q_MOC_RUN)
@@ -64,3 +67,4 @@ public:
enum TypedEnum { B0, B1 , B2, B3 };
};
#endif
+#endif // CXX11_ENUMS_H
diff --git a/tests/auto/tools/moc/dir-in-include-path.h b/tests/auto/tools/moc/dir-in-include-path.h
index 0d46f69d63..34f96bea6b 100644
--- a/tests/auto/tools/moc/dir-in-include-path.h
+++ b/tests/auto/tools/moc/dir-in-include-path.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef DIR_IN_INCLUDE_PATH_H
+#define DIR_IN_INCLUDE_PATH_H
#include <Plugin>
class DirInIncludePath : public QObject, public MyInterface
@@ -45,3 +48,4 @@ class DirInIncludePath : public QObject, public MyInterface
Q_OBJECT
Q_INTERFACES(MyInterface)
};
+#endif // DIR_IN_INCLUDE_PATH_H
diff --git a/tests/auto/tools/moc/dollars.h b/tests/auto/tools/moc/dollars.h
index 8fab45559c..b136b00881 100644
--- a/tests/auto/tools/moc/dollars.h
+++ b/tests/auto/tools/moc/dollars.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef DOLLARS_H
+#define DOLLARS_H
+
/* both GCC and clang allow $ in identifiers
* So moc should not throw a parse error if it parses a file that contains such identifiers
*/
@@ -68,3 +71,4 @@ namespace $NS {
};
}
+#endif // DOLLARS_H
diff --git a/tests/auto/tools/moc/error-on-wrong-notify.h b/tests/auto/tools/moc/error-on-wrong-notify.h
index d13e352143..7358f4e77a 100644
--- a/tests/auto/tools/moc/error-on-wrong-notify.h
+++ b/tests/auto/tools/moc/error-on-wrong-notify.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef ERROR_ON_WRONG_NOTIFY_H
+#define ERROR_ON_WRONG_NOTIFY_H
#include <QObject>
class ClassWithWrongNOTIFY : public QObject
@@ -51,3 +54,4 @@ public:
int foo() { return m_foo; }
};
+#endif // ERROR_ON_WRONG_NOTIFY_H
diff --git a/tests/auto/tools/moc/escapes-in-string-literals.h b/tests/auto/tools/moc/escapes-in-string-literals.h
index e2f044e196..25f9df2e74 100644
--- a/tests/auto/tools/moc/escapes-in-string-literals.h
+++ b/tests/auto/tools/moc/escapes-in-string-literals.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef ESCAPES_IN_STRING_LITERALS_H
+#define ESCAPES_IN_STRING_LITERALS_H
#include <QObject>
class StringLiterals: public QObject
@@ -47,3 +50,4 @@ class StringLiterals: public QObject
Q_CLASSINFO("Test2", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\123")
Q_CLASSINFO("Test3", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nb")
};
+#endif // ESCAPES_IN_STRING_LITERALS_H
diff --git a/tests/auto/tools/moc/extraqualification.h b/tests/auto/tools/moc/extraqualification.h
index 5c69699067..875eb56184 100644
--- a/tests/auto/tools/moc/extraqualification.h
+++ b/tests/auto/tools/moc/extraqualification.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef EXTRAQUALIFICATION_H
+#define EXTRAQUALIFICATION_H
+
#include <QObject>
class Test : public QObject
@@ -55,3 +58,4 @@ public slots:
public:
Q_SLOT void Test::anotherOne() {}
};
+#endif // EXTRAQUALIFICATION_H
diff --git a/tests/auto/tools/moc/forgotten-qinterface.h b/tests/auto/tools/moc/forgotten-qinterface.h
index 4c8aa45d92..0c2fd87aa5 100644
--- a/tests/auto/tools/moc/forgotten-qinterface.h
+++ b/tests/auto/tools/moc/forgotten-qinterface.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef FORGOTTEN_QINTERFACE_H
+#define FORGOTTEN_QINTERFACE_H
+
#include <QObject>
struct MyInterface
@@ -53,3 +56,4 @@ class Test : public QObject, public MyInterface
{
Q_OBJECT
};
+#endif // FORGOTTEN_QINTERFACE_H
diff --git a/tests/auto/tools/moc/forward-declared-param.h b/tests/auto/tools/moc/forward-declared-param.h
index 013c6563e8..441745f9fc 100644
--- a/tests/auto/tools/moc/forward-declared-param.h
+++ b/tests/auto/tools/moc/forward-declared-param.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef FORWARD_DECLARED_PARAM_H
+#define FORWARD_DECLARED_PARAM_H
#include <qobject.h>
#include <qmetatype.h>
@@ -73,4 +76,5 @@ signals:
void signalQSet(const QSet<int> &);
void signalQSet(const QSet<QString> &);
void signalQSet(const QSet<FullyDefined> &);
-}; \ No newline at end of file
+};
+#endif // FORWARD_DECLARED_PARAM_H
diff --git a/tests/auto/tools/moc/function-with-attributes.h b/tests/auto/tools/moc/function-with-attributes.h
index afa02e6f3a..88f3e3fcb3 100644
--- a/tests/auto/tools/moc/function-with-attributes.h
+++ b/tests/auto/tools/moc/function-with-attributes.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef FUNCTION_WITH_ATTRIBUTES_H
+#define FUNCTION_WITH_ATTRIBUTES_H
#include <qobject.h>
// test support for gcc attributes with functions
@@ -62,3 +65,4 @@ public slots:
DEPRECATED2 void test2() {}
};
+#endif // FUNCTION_WITH_ATTRIBUTES_H
diff --git a/tests/auto/tools/moc/interface-from-framework.h b/tests/auto/tools/moc/interface-from-framework.h
index 8a4188e5ab..c961d18bb9 100644
--- a/tests/auto/tools/moc/interface-from-framework.h
+++ b/tests/auto/tools/moc/interface-from-framework.h
@@ -38,7 +38,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifndef INTERFACE_FROM-FRAMEWORK_H
+
+#ifndef INTERFACE_FROM_FRAMEWORK_H
#define INTERFACE_FROM_FRAMEWORK_H
#include <Test/testinterface.h>
diff --git a/tests/auto/tools/moc/macro-on-cmdline.h b/tests/auto/tools/moc/macro-on-cmdline.h
index 9609b7cd31..681340471d 100644
--- a/tests/auto/tools/moc/macro-on-cmdline.h
+++ b/tests/auto/tools/moc/macro-on-cmdline.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef MACRO_ON_CMDLINE_H
+#define MACRO_ON_CMDLINE_H
+
#if FOO
class Test : public QObject
@@ -48,3 +51,4 @@ public:
};
#endif
+#endif // MACRO_ON_CMDLINE_H
diff --git a/tests/auto/tools/moc/moc.pro b/tests/auto/tools/moc/moc.pro
index 9a3fee38f0..cc8c2c671d 100644
--- a/tests/auto/tools/moc/moc.pro
+++ b/tests/auto/tools/moc/moc.pro
@@ -24,7 +24,11 @@ HEADERS += using-namespaces.h no-keywords.h task87883.h c-comments.h backslash-n
parse-defines.h \
function-with-attributes.h \
plugin_metadata.h \
- single-quote-digit-separator-n3781.h
+ single-quote-digit-separator-n3781.h \
+ related-metaobjects-in-namespaces.h \
+ qtbug-35657-gadget.h \
+ related-metaobjects-in-gadget.h \
+ related-metaobjects-name-conflict.h
if(*-g++*|*-icc*|*-clang*|*-llvm):!irix-*:!win32-*: HEADERS += os9-newlines.h win-newlines.h
diff --git a/tests/auto/tools/moc/namespaced-flags.h b/tests/auto/tools/moc/namespaced-flags.h
index 97aecfbf3c..ce1e12d83f 100644
--- a/tests/auto/tools/moc/namespaced-flags.h
+++ b/tests/auto/tools/moc/namespaced-flags.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef NAMESPACED_FLAGS_H
+#define NAMESPACED_FLAGS_H
#include <QObject>
namespace Foo {
@@ -78,3 +81,4 @@ namespace Foo {
}
Q_DECLARE_OPERATORS_FOR_FLAGS( Foo::Bar::Flags )
+#endif // NAMESPACED_FLAGS_H
diff --git a/tests/auto/tools/moc/no-keywords.h b/tests/auto/tools/moc/no-keywords.h
index ffd5928370..3fa6f089e0 100644
--- a/tests/auto/tools/moc/no-keywords.h
+++ b/tests/auto/tools/moc/no-keywords.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef NO_KEYWORDS_H
+#define NO_KEYWORDS_H
+
#define QT_NO_KEYWORDS
#undef signals
#undef slots
@@ -85,3 +88,4 @@ private:
#define emit
#undef QT_NO_KEYWORDS
+#endif // NO_KEYWORDS_H
diff --git a/tests/auto/tools/moc/oldstyle-casts.h b/tests/auto/tools/moc/oldstyle-casts.h
index 89f90a3504..0c4e9e8e00 100644
--- a/tests/auto/tools/moc/oldstyle-casts.h
+++ b/tests/auto/tools/moc/oldstyle-casts.h
@@ -38,9 +38,12 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef OLDSTYLE_CASTS_H
+#define OLDSTYLE_CASTS_H
#include <QtCore/qobject.h>
-class Foo: public QObject
+class OldStyleCast: public QObject
{
Q_OBJECT
public:
@@ -54,3 +57,4 @@ public slots:
inline void slot(int, QObject * const) {}
};
+#endif // OLDSTYLE_CASTS_H
diff --git a/tests/auto/tools/moc/parse-boost.h b/tests/auto/tools/moc/parse-boost.h
index b93eb7130c..4dd7693358 100644
--- a/tests/auto/tools/moc/parse-boost.h
+++ b/tests/auto/tools/moc/parse-boost.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef PARSE_BOOST_H
+#define PARSE_BOOST_H
#include <boost/aligned_storage.hpp>
#include <boost/any.hpp>
#include <boost/array.hpp>
@@ -124,3 +127,4 @@
#include <boost/version.hpp>
#include <boost/visit_each.hpp>
#include <boost/weak_ptr.hpp>
+#endif // PARSE_BOOST_H
diff --git a/tests/auto/tools/moc/pp-dollar-signs.h b/tests/auto/tools/moc/pp-dollar-signs.h
index 98134a5019..a90b654ee4 100644
--- a/tests/auto/tools/moc/pp-dollar-signs.h
+++ b/tests/auto/tools/moc/pp-dollar-signs.h
@@ -39,4 +39,8 @@
**
****************************************************************************/
+#ifndef PP_DOLLAR_SIGNS_H
+#define PP_DOLLAR_SIGNS_H
+
$$ = parser->createFoo()
+#endif // PP_DOLLAR_SIGNS_H
diff --git a/tests/auto/tools/moc/pure-virtual-signals.h b/tests/auto/tools/moc/pure-virtual-signals.h
index fb23089b30..070f5894a3 100644
--- a/tests/auto/tools/moc/pure-virtual-signals.h
+++ b/tests/auto/tools/moc/pure-virtual-signals.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef PURE_VIRTUAL_SIGNALS_H
+#define PURE_VIRTUAL_SIGNALS_H
#include <QObject>
class PureVirtualSignalsTest : public QObject
@@ -58,3 +61,4 @@ signals:
void mySignal();
void mySignal2(int foo);
};
+#endif // PURE_VIRTUAL_SIGNALS_H
diff --git a/tests/auto/tools/moc/qinvokable.h b/tests/auto/tools/moc/qinvokable.h
index 9070f2ab8e..a47ae72b2b 100644
--- a/tests/auto/tools/moc/qinvokable.h
+++ b/tests/auto/tools/moc/qinvokable.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef QINVOKABLE_H
+#define QINVOKABLE_H
+
#include <QObject>
class InvokableBeforeReturnType : public QObject
@@ -55,3 +58,4 @@ public:
Q_INVOKABLE inline void foo() {}
Q_INVOKABLE virtual void bar() {}
};
+#endif // QINVOKABLE_H
diff --git a/tests/auto/tools/moc/qprivateslots.h b/tests/auto/tools/moc/qprivateslots.h
index 5b0db3d27e..82a68270af 100644
--- a/tests/auto/tools/moc/qprivateslots.h
+++ b/tests/auto/tools/moc/qprivateslots.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef QPRIVATESLOTS_H
+#define QPRIVATESLOTS_H
+
#include <QObject>
struct TestQPrivateSlots_Private
@@ -58,3 +61,4 @@ private:
TestQPrivateSlots_Private *d;
};
+#endif // QPRIVATESLOTS_H
diff --git a/tests/auto/tools/moc/qtbug-35657-gadget.h b/tests/auto/tools/moc/qtbug-35657-gadget.h
new file mode 100644
index 0000000000..c030405c67
--- /dev/null
+++ b/tests/auto/tools/moc/qtbug-35657-gadget.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTBUG_35657_GADGET_H
+#define QTBUG_35657_GADGET_H
+
+#include <QObject>
+
+namespace QTBUG_35657 {
+ class A {
+ Q_GADGET
+ Q_ENUMS(SomeEnum)
+ public:
+ enum SomeEnum { SomeEnumValue = 0 };
+ };
+}
+
+#endif // QTBUG_35657_GADGET_H
diff --git a/tests/auto/tools/moc/related-metaobjects-in-gadget.h b/tests/auto/tools/moc/related-metaobjects-in-gadget.h
new file mode 100644
index 0000000000..556e92efaf
--- /dev/null
+++ b/tests/auto/tools/moc/related-metaobjects-in-gadget.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef RELATED_METAOBJECTS_IN_GADGET_H
+#define RELATED_METAOBJECTS_IN_GADGET_H
+
+#include <QObject>
+#include "qtbug-35657-gadget.h"
+
+namespace QTBUG_35657 {
+ class B : public QObject
+ {
+ Q_OBJECT
+ Q_PROPERTY(A::SomeEnum blah READ blah)
+ public:
+
+ A::SomeEnum blah() const { return A::SomeEnumValue; }
+ };
+}
+
+#endif // RELATED_METAOBJECTS_IN_GADGET_H
diff --git a/tests/auto/tools/moc/related-metaobjects-in-namespaces.h b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h
new file mode 100644
index 0000000000..4be856391f
--- /dev/null
+++ b/tests/auto/tools/moc/related-metaobjects-in-namespaces.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef RELATED_METAOBJECTS_IN_NAMESPACES_H
+#define RELATED_METAOBJECTS_IN_NAMESPACES_H
+
+#include <QObject>
+
+namespace QTBUG_2151 {
+ class A : public QObject {
+ Q_OBJECT
+ Q_ENUMS(SomeEnum)
+ public:
+ enum SomeEnum { SomeEnumValue = 0 };
+ };
+
+ class B : public QObject
+ {
+ Q_OBJECT
+ Q_PROPERTY(A::SomeEnum blah READ blah)
+ public:
+
+ A::SomeEnum blah() const { return A::SomeEnumValue; }
+ };
+}
+
+#endif // RELATED_METAOBJECTS_IN_NAMESPACES_H
diff --git a/tests/auto/tools/moc/related-metaobjects-name-conflict.h b/tests/auto/tools/moc/related-metaobjects-name-conflict.h
new file mode 100644
index 0000000000..551ab461e3
--- /dev/null
+++ b/tests/auto/tools/moc/related-metaobjects-name-conflict.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef RELATED_METAOBJECTS_NAME_CONFLICT_H
+#define RELATED_METAOBJECTS_NAME_CONFLICT_H
+
+#include <QObject>
+
+#define DECLARE_GADGET_AND_OBJECT_CLASSES \
+ class Gadget { \
+ Q_GADGET \
+ Q_ENUMS(SomeEnum) \
+ public: \
+ enum SomeEnum { SomeEnumValue = 0 }; \
+ }; \
+ class Object : public QObject{ \
+ Q_OBJECT \
+ Q_ENUMS(SomeEnum) \
+ public: \
+ enum SomeEnum { SomeEnumValue = 0 }; \
+ };
+
+#define DECLARE_DEPENDING_CLASSES \
+ class DependingObject : public QObject \
+ { \
+ Q_OBJECT \
+ Q_PROPERTY(Gadget::SomeEnum gadgetPoperty READ gadgetPoperty) \
+ Q_PROPERTY(Object::SomeEnum objectPoperty READ objectPoperty) \
+ public: \
+ Gadget::SomeEnum gadgetPoperty() const { return Gadget::SomeEnumValue; } \
+ Object::SomeEnum objectPoperty() const { return Object::SomeEnumValue; } \
+ };\
+ struct DependingNestedGadget : public QObject \
+ { \
+ Q_OBJECT \
+ Q_PROPERTY(Nested::Gadget::SomeEnum nestedGadgetPoperty READ nestedGadgetPoperty) \
+ Nested::Gadget::SomeEnum nestedGadgetPoperty() const { return Nested::Gadget::SomeEnumValue; } \
+ };\
+ struct DependingNestedObject : public QObject \
+ { \
+ Q_OBJECT \
+ Q_PROPERTY(Nested::Object::SomeEnum nestedObjectPoperty READ nestedObjectPoperty) \
+ Nested::Object::SomeEnum nestedObjectPoperty() const { return Nested::Object::SomeEnumValue; } \
+ };\
+
+
+namespace Unsused {
+ DECLARE_GADGET_AND_OBJECT_CLASSES
+} // Unused
+
+namespace NS1 {
+namespace Nested {
+ DECLARE_GADGET_AND_OBJECT_CLASSES
+} // Nested
+
+namespace NestedUnsused {
+ DECLARE_GADGET_AND_OBJECT_CLASSES
+} // NestedUnused
+
+DECLARE_GADGET_AND_OBJECT_CLASSES
+DECLARE_DEPENDING_CLASSES
+
+} // NS1
+
+namespace NS2 {
+namespace Nested {
+ DECLARE_GADGET_AND_OBJECT_CLASSES
+} // Nested
+
+namespace NestedUnsused {
+ DECLARE_GADGET_AND_OBJECT_CLASSES
+} // NestedUnused
+
+DECLARE_GADGET_AND_OBJECT_CLASSES
+DECLARE_DEPENDING_CLASSES
+
+} // NS2
+
+#endif // RELATED_METAOBJECTS_NAME_CONFLICT_H
diff --git a/tests/auto/tools/moc/single-quote-digit-separator-n3781.h b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h
index 0b234011d5..f5f39c7dd7 100644
--- a/tests/auto/tools/moc/single-quote-digit-separator-n3781.h
+++ b/tests/auto/tools/moc/single-quote-digit-separator-n3781.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H
+#define SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H
+
#include <QObject>
class KDAB : public QObject
@@ -56,3 +59,4 @@ public:
};
Q_ENUMS(Salaries)
};
+#endif // SINGLE_QUOTE_DIGIT_SEPARATOR_N3781_H
diff --git a/tests/auto/tools/moc/single_function_keyword.h b/tests/auto/tools/moc/single_function_keyword.h
index 44a1a41d30..6717509517 100644
--- a/tests/auto/tools/moc/single_function_keyword.h
+++ b/tests/auto/tools/moc/single_function_keyword.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef SINGLE_FUNCTION_KEYWORD_H
+#define SINGLE_FUNCTION_KEYWORD_H
#include <QObject>
class SingleFunctionKeywordBeforeReturnType : public QObject
@@ -73,3 +76,4 @@ public:
inline Q_SLOT void mySlot() { emit mySignal(); }
};
+#endif // SINGLE_FUNCTION_KEYWORD_H
diff --git a/tests/auto/tools/moc/slots-with-void-template.h b/tests/auto/tools/moc/slots-with-void-template.h
index c38437ca54..524d565345 100644
--- a/tests/auto/tools/moc/slots-with-void-template.h
+++ b/tests/auto/tools/moc/slots-with-void-template.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef SLOTS_WITH_VOID_TEMPLATE_H
+#define SLOTS_WITH_VOID_TEMPLATE_H
#include <QObject>
template <typename T>
@@ -59,3 +62,4 @@ signals:
void myVoidSignal();
void myVoidSignal2(void);
};
+#endif // SLOTS_WITH_VOID_TEMPLATE_H
diff --git a/tests/auto/tools/moc/task192552.h b/tests/auto/tools/moc/task192552.h
index 23665bbb07..b221984d7d 100644
--- a/tests/auto/tools/moc/task192552.h
+++ b/tests/auto/tools/moc/task192552.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef TASK192552_H
+#define TASK192552_H
/*
<:: is not valid C++, but we want moc to treat it as < :: since this
is usually the intention
@@ -53,3 +56,4 @@ public:
QList<::QObject*> m_objects;
#endif
};
+#endif // TASK192552_H
diff --git a/tests/auto/tools/moc/task234909.h b/tests/auto/tools/moc/task234909.h
index 2ad8b9a410..37948441eb 100644
--- a/tests/auto/tools/moc/task234909.h
+++ b/tests/auto/tools/moc/task234909.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef TASK234909_H
+#define TASK234909_H
#include <qobject.h>
namespace NS_A {
@@ -71,3 +74,4 @@ namespace NS_Main {
}
}
+#endif // TASK234909_H
diff --git a/tests/auto/tools/moc/task87883.h b/tests/auto/tools/moc/task87883.h
index d6687588f7..65988221f1 100644
--- a/tests/auto/tools/moc/task87883.h
+++ b/tests/auto/tools/moc/task87883.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef TASK87883_H
+#define TASK87883_H
/*
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
@@ -55,3 +58,4 @@ public:
inline Task87883() {}
};
+#endif // TASK87883_H
diff --git a/tests/auto/tools/moc/template-gtgt.h b/tests/auto/tools/moc/template-gtgt.h
index 2c2f56c34d..b5d83b5796 100644
--- a/tests/auto/tools/moc/template-gtgt.h
+++ b/tests/auto/tools/moc/template-gtgt.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef TEMPLATE_GTGT_H
+#define TEMPLATE_GTGT_H
template<class TYPE, size_t COUNT>
class myTemplate :
QString,
@@ -58,3 +61,4 @@ public:
{
}
};
+#endif // TEMPLATE_GTGT_H
diff --git a/tests/auto/tools/moc/trigraphs.h b/tests/auto/tools/moc/trigraphs.h
index cc1824190e..301ea35265 100644
--- a/tests/auto/tools/moc/trigraphs.h
+++ b/tests/auto/tools/moc/trigraphs.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef TRIGRAPHS_H
+#define TRIGRAPHS_H
+
#include <QObject>
namespace AAA {
@@ -61,3 +64,4 @@ namespace BBB {
};
}
+#endif // TRIGRAPHS_H
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index bf2d6afdb4..04140fa4a1 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -76,6 +76,9 @@
#include "cxx11-explicit-override-control.h"
#include "parse-defines.h"
+#include "related-metaobjects-in-namespaces.h"
+#include "related-metaobjects-in-gadget.h"
+#include "related-metaobjects-name-conflict.h"
QT_USE_NAMESPACE
@@ -569,6 +572,11 @@ private slots:
void preprocessorOnly();
void unterminatedFunctionMacro();
void QTBUG32933_relatedObjectsDontIncludeItself();
+ void writeEnumFromUnrelatedClass();
+ void relatedMetaObjectsWithinNamespaces();
+ void relatedMetaObjectsInGadget();
+ void relatedMetaObjectsNameConflict_data();
+ void relatedMetaObjectsNameConflict();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -688,8 +696,8 @@ void tst_Moc::warnOnExtraSignalSlotQualifiaction()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
- QString(":53: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
- header + QString(":56: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
+ QString(":56: Warning: Function declaration Test::badFunctionDeclaration contains extra qualification. Ignoring as signal or slot.\n") +
+ header + QString(":59: Warning: parsemaybe: Function declaration Test::anotherOne contains extra qualification. Ignoring as signal or slot.\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -885,7 +893,7 @@ void tst_Moc::testExtraDataForEnum()
const QMetaObject *mobjUser = &EnumUserClass::staticMetaObject;
QCOMPARE(mobjUser->enumeratorCount(), 0);
- const QMetaObject **objects = mobjUser->d.relatedMetaObjects;
+ const QMetaObject * const *objects = mobjUser->d.relatedMetaObjects;
QVERIFY(objects);
QVERIFY(objects[0] == mobjSource);
QVERIFY(objects[1] == 0);
@@ -967,7 +975,7 @@ void tst_Moc::warnOnMultipleInheritance()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
- QString(":53: Warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n"));
+ QString(":56: Warning: Class Bar inherits from two QObject subclasses QWindow and Foo. This is not supported!\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -1030,7 +1038,7 @@ void tst_Moc::forgottenQInterface()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
- QString(":55: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
+ QString(":58: 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");
#endif
@@ -1346,7 +1354,7 @@ void tst_Moc::warnOnPropertyWithoutREAD()
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocWarning, header +
- QString(":46: Warning: Property declaration foo has no READ accessor function or associated MEMBER variable. The property will be invalid.\n"));
+ QString(":49: Warning: Property declaration foo has no READ accessor function or associated MEMBER variable. The property will be invalid.\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -1456,8 +1464,8 @@ void tst_Moc::warnOnVirtualSignal()
QByteArray mocOut = proc.readAllStandardOutput();
QVERIFY(!mocOut.isEmpty());
QString mocWarning = QString::fromLocal8Bit(proc.readAllStandardError());
- QCOMPARE(mocWarning, header + QString(":48: Warning: Signals cannot be declared virtual\n") +
- header + QString(":50: Warning: Signals cannot be declared virtual\n"));
+ QCOMPARE(mocWarning, header + QString(":51: Warning: Signals cannot be declared virtual\n") +
+ header + QString(":53: Warning: Signals cannot be declared virtual\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -1590,7 +1598,7 @@ void tst_Moc::notifyError()
QVERIFY(mocOut.isEmpty());
QString mocError = QString::fromLocal8Bit(proc.readAllStandardError());
QCOMPARE(mocError, header +
- QString(":52: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n"));
+ QString(":55: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n"));
#else
QSKIP("Only tested on linux/gcc");
#endif
@@ -3121,12 +3129,129 @@ namespace QTBUG32933_relatedObjectsDontIncludeItself {
void tst_Moc::QTBUG32933_relatedObjectsDontIncludeItself()
{
const QMetaObject *mo = &QTBUG32933_relatedObjectsDontIncludeItself::NS::Obj::staticMetaObject;
- const QMetaObject **objects = mo->d.relatedMetaObjects;
+ const QMetaObject * const *objects = mo->d.relatedMetaObjects;
// the related objects should be empty because the enums is in the same object.
QVERIFY(!objects);
}
+class UnrelatedClass : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(UnrelatedEnum)
+public:
+ enum UnrelatedEnum {
+ UnrelatedInvalidValue = -1,
+ UnrelatedValue = 42
+ };
+};
+
+// The presence of this macro used to confuse moc and prevent
+// UnrelatedClass from being listed in the related meta objects.
+Q_DECLARE_METATYPE(UnrelatedClass::UnrelatedEnum)
+
+class TestClassReferencingUnrelatedEnum : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(UnrelatedClass::UnrelatedEnum enumProperty READ enumProperty WRITE setEnumProperty)
+public:
+ TestClassReferencingUnrelatedEnum()
+ : m_enumProperty(UnrelatedClass::UnrelatedInvalidValue)
+ {}
+
+ UnrelatedClass::UnrelatedEnum enumProperty() const {
+ return m_enumProperty;
+ }
+
+ void setEnumProperty(UnrelatedClass::UnrelatedEnum arg) {
+ m_enumProperty = arg;
+ }
+
+private:
+ UnrelatedClass::UnrelatedEnum m_enumProperty;
+};
+
+void tst_Moc::writeEnumFromUnrelatedClass()
+{
+ TestClassReferencingUnrelatedEnum obj;
+ QString enumValueAsString("UnrelatedValue");
+ obj.setProperty("enumProperty", enumValueAsString);
+ QCOMPARE(int(obj.enumProperty()), int(UnrelatedClass::UnrelatedValue));
+}
+
+
+
+void tst_Moc::relatedMetaObjectsWithinNamespaces()
+{
+ const QMetaObject *relatedMo = &QTBUG_2151::A::staticMetaObject;
+
+ const QMetaObject *testMo = &QTBUG_2151::B::staticMetaObject;
+ QVERIFY(testMo->d.relatedMetaObjects);
+ QVERIFY(testMo->d.relatedMetaObjects[0] == relatedMo);
+}
+
+void tst_Moc::relatedMetaObjectsInGadget()
+{
+ const QMetaObject *relatedMo = &QTBUG_35657::A::staticMetaObject;
+
+ const QMetaObject *testMo = &QTBUG_35657::B::staticMetaObject;
+ QVERIFY(testMo->d.relatedMetaObjects);
+ QVERIFY(testMo->d.relatedMetaObjects[0] == relatedMo);
+}
+
+void tst_Moc::relatedMetaObjectsNameConflict_data()
+{
+ typedef QVector<const QMetaObject*> QMetaObjects;
+ QTest::addColumn<const QMetaObject*>("dependingObject");
+ QTest::addColumn<QMetaObjects>("relatedMetaObjects");
+
+ //NS1
+ const QMetaObject *n1gadget = &NS1::Gadget::staticMetaObject;
+ const QMetaObject *n1object = &NS1::Object::staticMetaObject;
+ const QMetaObject *n1nestedGadget = &NS1::Nested::Gadget::staticMetaObject;
+ const QMetaObject *n1nestedObject = &NS1::Nested::Object::staticMetaObject;
+ //N2
+ const QMetaObject *n2gadget = &NS2::Gadget::staticMetaObject;
+ const QMetaObject *n2object = &NS2::Object::staticMetaObject;
+ const QMetaObject *n2nestedGadget = &NS2::Nested::Gadget::staticMetaObject;
+ const QMetaObject *n2nestedObject = &NS2::Nested::Object::staticMetaObject;
+
+ QTest::newRow("N1::dependingObject") << &NS1::DependingObject::staticMetaObject
+ << (QMetaObjects() << n1gadget << n1object);
+ QTest::newRow("N2::dependingObject") << &NS2::DependingObject::staticMetaObject
+ << (QMetaObjects() << n2gadget << n2object);
+ QTest::newRow("N1::dependingNestedObject") << &NS1::DependingNestedObject::staticMetaObject
+ << (QMetaObjects() << n1nestedObject);
+ QTest::newRow("N2::dependingNestedObject") << &NS2::DependingNestedObject::staticMetaObject
+ << (QMetaObjects() << n2nestedObject);
+ QTest::newRow("N1::dependingNestedGadget") << &NS1::DependingNestedGadget::staticMetaObject
+ << (QMetaObjects() << n1nestedGadget);
+ QTest::newRow("N2::dependingNestedGadget") << &NS2::DependingNestedGadget::staticMetaObject
+ << (QMetaObjects() << n2nestedGadget);
+}
+
+void tst_Moc::relatedMetaObjectsNameConflict()
+{
+ typedef QVector<const QMetaObject*> QMetaObjects;
+ QFETCH(const QMetaObject*, dependingObject);
+ QFETCH(QMetaObjects, relatedMetaObjects);
+
+ // load all specified metaobjects int a set
+ QSet<const QMetaObject*> dependency;
+ const QMetaObject *const *i = dependingObject->d.relatedMetaObjects;
+ while (*i) {
+ dependency.insert(*i);
+ ++i;
+ }
+
+ // check if all required metaobjects are specified
+ foreach (const QMetaObject *mo, relatedMetaObjects)
+ QVERIFY(dependency.contains(mo));
+
+ // check if no additional metaobjects ara specified
+ QCOMPARE(dependency.size(), relatedMetaObjects.size());
+}
+
QTEST_MAIN(tst_Moc)
// the generated code must compile with QT_NO_KEYWORDS
diff --git a/tests/auto/tools/moc/unterminated-function-macro.h b/tests/auto/tools/moc/unterminated-function-macro.h
index 813d60f0e4..60595d1536 100644
--- a/tests/auto/tools/moc/unterminated-function-macro.h
+++ b/tests/auto/tools/moc/unterminated-function-macro.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef UNTERMINATED_FUNCTION_MACRO_H
+#define UNTERMINATED_FUNCTION_MACRO_H
+
class Dummy : public QObject {
Q_OBJECT
}
@@ -49,3 +52,4 @@ static void foo() {
MACRO(foo
}
+#endif // UNTERMINATED_FUNCTION_MACRO_H
diff --git a/tests/auto/tools/moc/using-namespaces.h b/tests/auto/tools/moc/using-namespaces.h
index c662bb762a..64ffa96a21 100644
--- a/tests/auto/tools/moc/using-namespaces.h
+++ b/tests/auto/tools/moc/using-namespaces.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef USING_NAMESPACES_H
+#define USING_NAMESPACES_H
+
namespace Foo {}
namespace Bar
{
@@ -54,3 +57,4 @@ using namespace Foo;
using namespace Bar::Huh;
using namespace ::Top;
+#endif // USING_NAMESPACES_H
diff --git a/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h b/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h
index 346909cca1..bbe416f7f0 100644
--- a/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h
+++ b/tests/auto/tools/moc/warn-on-multiple-qobject-subclasses.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H
+#define WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H
+
#include <QtGui>
class Foo : public QObject
@@ -53,3 +56,4 @@ class Bar : public QWindow, public Foo
};
+#endif // WARN_ON_MULTIPLE_QOBJECT_SUBCLASSES_H
diff --git a/tests/auto/tools/moc/warn-on-property-without-read.h b/tests/auto/tools/moc/warn-on-property-without-read.h
index 75d2953aa1..85c092d240 100644
--- a/tests/auto/tools/moc/warn-on-property-without-read.h
+++ b/tests/auto/tools/moc/warn-on-property-without-read.h
@@ -38,6 +38,9 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
+#ifndef WARN_ON_PROPERTY_WITHOUT_READ_H
+#define WARN_ON_PROPERTY_WITHOUT_READ_H
#include <QObject>
class ClassWithPropertyWithoutREAD : public QObject
@@ -46,3 +49,4 @@ class ClassWithPropertyWithoutREAD : public QObject
Q_PROPERTY(int foo)
Q_PROPERTY(int bar READ bar)
};
+#endif // WARN_ON_PROPERTY_WITHOUT_READ_H
diff --git a/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h b/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h
new file mode 100644
index 0000000000..597728e207
--- /dev/null
+++ b/tests/auto/tools/uic/baseline/translation/Dialog_without_Buttons_tr.h
@@ -0,0 +1,50 @@
+/********************************************************************************
+** Form generated from reading UI file 'Dialog_without_Buttons.ui'
+**
+** Created by: Qt User Interface Compiler version 5.3.0
+**
+** WARNING! All changes made in this file will be lost when recompiling UI file!
+********************************************************************************/
+
+#ifndef DIALOG_WITHOUT_BUTTONS_TR_H
+#define DIALOG_WITHOUT_BUTTONS_TR_H
+
+#include <QtCore/QVariant>
+#include <QtWidgets/QAction>
+#include <QtWidgets/QApplication>
+#include <QtWidgets/QButtonGroup>
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QHeaderView>
+#include <ki18n.h>
+
+QT_BEGIN_NAMESPACE
+
+class Ui_Dialog
+{
+public:
+
+ void setupUi(QDialog *Dialog)
+ {
+ if (Dialog->objectName().isEmpty())
+ Dialog->setObjectName(QStringLiteral("Dialog"));
+ Dialog->resize(400, 300);
+
+ retranslateUi(Dialog);
+
+ QMetaObject::connectSlotsByName(Dialog);
+ } // setupUi
+
+ void retranslateUi(QDialog *Dialog)
+ {
+ Dialog->setWindowTitle(i18n("Dialog", 0));
+ } // retranslateUi
+
+};
+
+namespace Ui {
+ class Dialog: public Ui_Dialog {};
+} // namespace Ui
+
+QT_END_NAMESPACE
+
+#endif // DIALOG_WITHOUT_BUTTONS_TR_H
diff --git a/tests/auto/tools/uic/tst_uic.cpp b/tests/auto/tools/uic/tst_uic.cpp
index c6e8466d89..02a19c0c33 100644
--- a/tests/auto/tools/uic/tst_uic.cpp
+++ b/tests/auto/tools/uic/tst_uic.cpp
@@ -64,9 +64,13 @@ private Q_SLOTS:
void run();
void run_data() const;
+ void runTranslation();
+
void compare();
void compare_data() const;
+ void runCompare();
+
private:
const QString m_command;
QString m_baseline;
@@ -220,5 +224,53 @@ void tst_uic::compare_data() const
}
}
+void tst_uic::runTranslation()
+{
+ QProcess process;
+
+ QDir baseline(m_baseline);
+
+ QDir generated(m_generated.path());
+ generated.mkdir(QLatin1String("translation"));
+ QString generatedFile = generated.absolutePath() + QLatin1String("/translation/Dialog_without_Buttons_tr.h");
+
+ process.start(m_command, QStringList(baseline.filePath("Dialog_without_Buttons.ui"))
+ << QString(QLatin1String("-tr")) << "i18n"
+ << QString(QLatin1String("-include")) << "ki18n.h"
+ << QString(QLatin1String("-o")) << generatedFile);
+ QVERIFY2(process.waitForStarted(), msgProcessStartFailed(m_command, process.errorString()));
+ QVERIFY(process.waitForFinished());
+ QCOMPARE(process.exitStatus(), QProcess::NormalExit);
+ QCOMPARE(process.exitCode(), 0);
+ QCOMPARE(QFileInfo(generatedFile).exists(), true);
+}
+
+
+void tst_uic::runCompare()
+{
+ QFile orgFile(m_baseline + QLatin1String("/translation/Dialog_without_Buttons_tr.h"));
+
+ QDir generated(m_generated.path());
+ QFile genFile(generated.absolutePath() + QLatin1String("/translation/Dialog_without_Buttons_tr.h"));
+
+ if (!orgFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QString err(QLatin1String("Could not read file: %1..."));
+ QFAIL(err.arg(orgFile.fileName()).toUtf8());
+ }
+
+ if (!genFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QString err(QLatin1String("Could not read file: %1..."));
+ QFAIL(err.arg(genFile.fileName()).toUtf8());
+ }
+
+ QString originalFile = orgFile.readAll();
+ originalFile.replace(QRegExp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}")), "");
+
+ QString generatedFile = genFile.readAll();
+ generatedFile.replace(QRegExp(QLatin1String("Created by: Qt User Interface Compiler version [.\\d]{5,5}")), "");
+
+ QCOMPARE(generatedFile, originalFile);
+}
+
QTEST_MAIN(tst_uic)
#include "tst_uic.moc"