summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp19
-rw-r--r--tests/auto/tools/rcc/data/images/images.expected47
2 files changed, 49 insertions, 17 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 2e1504383f..97a2f366c5 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -174,6 +174,9 @@ class TestClassinfoWithEscapes: public QObject
Q_OBJECT
Q_CLASSINFO("escaped", "\"bar\"")
Q_CLASSINFO("\"escaped\"", "foo")
+ Q_CLASSINFO("cpp c*/omment", "f/*oo")
+ Q_CLASSINFO("endswith\\", "Or?\?/")
+ Q_CLASSINFO("newline\n inside\n", "Or \r")
public slots:
void slotWithAReallyLongName(int)
{ }
@@ -800,6 +803,14 @@ void tst_Moc::classinfoWithEscapes()
const QMetaObject *mobj = &TestClassinfoWithEscapes::staticMetaObject;
QCOMPARE(mobj->methodCount() - mobj->methodOffset(), 1);
+ QCOMPARE(mobj->classInfoCount(), 5);
+ QCOMPARE(mobj->classInfo(2).name(), "cpp c*/omment");
+ QCOMPARE(mobj->classInfo(2).value(), "f/*oo");
+ QCOMPARE(mobj->classInfo(3).name(), "endswith\\");
+ QCOMPARE(mobj->classInfo(3).value(), "Or?\?/");
+ QCOMPARE(mobj->classInfo(4).name(), "newline\n inside\n");
+ QCOMPARE(mobj->classInfo(4).value(), "Or \r");
+
QMetaMethod mm = mobj->method(mobj->methodOffset());
QCOMPARE(mm.methodSignature(), QByteArray("slotWithAReallyLongName(int)"));
}
@@ -1781,6 +1792,14 @@ void tst_Moc::warnings_data()
<< QString("IGNORE_ALL_STDOUT")
<< QString("standard input:1: Warning: Property declaration x has no READ accessor function or associated MEMBER variable. The property will be invalid.");
+ // This should output a warning
+ QTest::newRow("Duplicate property warning")
+ << QByteArray("class X : public QObject { Q_OBJECT Q_PROPERTY(int x READ x) Q_PROPERTY(int x READ y) };")
+ << QStringList()
+ << 0
+ << QString("IGNORE_ALL_STDOUT")
+ << QString("standard input:1: Warning: The property 'x' is defined multiple times in class X.");
+
// Passing "-nn" should NOT suppress the warning
QTest::newRow("Invalid property warning with -nn")
<< QByteArray("class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };")
diff --git a/tests/auto/tools/rcc/data/images/images.expected b/tests/auto/tools/rcc/data/images/images.expected
index 9334443ccc..ae470db336 100644
--- a/tests/auto/tools/rcc/data/images/images.expected
+++ b/tests/auto/tools/rcc/data/images/images.expected
@@ -1,13 +1,11 @@
/****************************************************************************
** Resource object code
**
-IGNORE: ** Created by: The Resource Compiler for Qt version 5.0.0
+IGNORE: ** Created by: The Resource Compiler for Qt version 5.3.1
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
-#include <QtCore/qglobal.h>
-
static const unsigned char qt_resource_data[] = {
IGNORE: // /dev/qt5/qtbase/tests/auto/tools/rcc/data/images/images/circle.png
0x0,0x0,0x0,0xa5,
@@ -94,32 +92,47 @@ static const unsigned char qt_resource_struct[] = {
};
-QT_BEGIN_NAMESPACE
+#ifdef QT_NAMESPACE
+# define QT_RCC_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name
+# define QT_RCC_MANGLE_NAMESPACE0(x) x
+# define QT_RCC_MANGLE_NAMESPACE1(a, b) a##_##b
+# define QT_RCC_MANGLE_NAMESPACE2(a, b) QT_RCC_MANGLE_NAMESPACE1(a,b)
+# define QT_RCC_MANGLE_NAMESPACE(name) QT_RCC_MANGLE_NAMESPACE2( \
+ QT_RCC_MANGLE_NAMESPACE0(name), QT_RCC_MANGLE_NAMESPACE0(QT_NAMESPACE))
+#else
+# define QT_RCC_PREPEND_NAMESPACE(name) name
+# define QT_RCC_MANGLE_NAMESPACE(name) name
+#endif
-extern Q_CORE_EXPORT bool qRegisterResourceData
- (int, const unsigned char *, const unsigned char *, const unsigned char *);
+#ifdef QT_NAMESPACE
+namespace QT_NAMESPACE {
+#endif
-extern Q_CORE_EXPORT bool qUnregisterResourceData
- (int, const unsigned char *, const unsigned char *, const unsigned char *);
+bool qRegisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
-QT_END_NAMESPACE
+bool qUnregisterResourceData(int, const unsigned char *, const unsigned char *, const unsigned char *);
+#ifdef QT_NAMESPACE
+}
+#endif
-int QT_MANGLE_NAMESPACE(qInitResources)()
+int QT_RCC_MANGLE_NAMESPACE(qInitResources)()
{
- QT_PREPEND_NAMESPACE(qRegisterResourceData)
+ QT_RCC_PREPEND_NAMESPACE(qRegisterResourceData)
(0x01, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
-Q_CONSTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qInitResources))
-
-int QT_MANGLE_NAMESPACE(qCleanupResources)()
+int QT_RCC_MANGLE_NAMESPACE(qCleanupResources)()
{
- QT_PREPEND_NAMESPACE(qUnregisterResourceData)
+ QT_RCC_PREPEND_NAMESPACE(qUnregisterResourceData)
(0x01, qt_resource_struct, qt_resource_name, qt_resource_data);
return 1;
}
-Q_DESTRUCTOR_FUNCTION(QT_MANGLE_NAMESPACE(qCleanupResources))
-
+namespace {
+ struct initializer {
+ initializer() { QT_RCC_MANGLE_NAMESPACE(qInitResources)(); }
+ ~initializer() { QT_RCC_MANGLE_NAMESPACE(qCleanupResources)(); }
+ } dummy;
+}