summaryrefslogtreecommitdiffstats
path: root/tests/auto/moc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/moc')
-rw-r--r--tests/auto/moc/os9-newlines.h2
-rw-r--r--tests/auto/moc/tst_moc.cpp49
2 files changed, 40 insertions, 11 deletions
diff --git a/tests/auto/moc/os9-newlines.h b/tests/auto/moc/os9-newlines.h
index fb9bbe4..85fa671 100644
--- a/tests/auto/moc/os9-newlines.h
+++ b/tests/auto/moc/os9-newlines.h
@@ -1 +1 @@
-/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ #include <QObject> class Os9Newlines : public QObject { Q_OBJECT public Q_SLOTS: inline void testSlot() {} };
+/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (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 http://www.qtsoftware.com/contact. ** $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/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 3a40ae0..488f068 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -488,6 +488,7 @@ private slots:
void warnOnPropertyWithoutREAD();
void constructors();
void typenameWithUnsigned();
+ void warnOnVirtualSignal();
signals:
void sigWithUnsignedArg(unsigned foo);
@@ -510,7 +511,7 @@ private:
void tst_Moc::initTestCase()
{
-#if defined(Q_OS_UNIX)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
QProcess proc;
proc.start("qmake", QStringList() << "-query" << "QT_INSTALL_HEADERS");
QVERIFY(proc.waitForFinished());
@@ -555,7 +556,7 @@ 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)
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
QProcess proc;
proc.start("moc", QStringList(srcify("/oldstyle-casts.h")));
QVERIFY(proc.waitForFinished());
@@ -585,7 +586,7 @@ 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)
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
QProcess proc;
proc.start("moc", QStringList(srcify("extraqualification.h")));
QVERIFY(proc.waitForFinished());
@@ -627,7 +628,7 @@ 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)
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
QProcess proc;
proc.setWorkingDirectory(QString(SRCDIR) + "/task71021");
proc.start("moc", QStringList("../Header"));
@@ -835,7 +836,7 @@ 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)
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
QProcess proc;
QStringList args;
args << "-I" << qtIncludePath + "/QtGui"
@@ -858,7 +859,7 @@ 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)
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
QProcess proc;
QStringList args;
args << "-I" << qtIncludePath + "/QtCore"
@@ -940,7 +941,7 @@ void tst_Moc::frameworkSearchPath()
#ifdef MOC_CROSS_COMPILED
QSKIP("Not tested when cross-compiled", SkipAll);
#endif
-#if defined(Q_OS_UNIX)
+#if defined(Q_OS_UNIX) && !defined(QT_NO_PROCESS)
QStringList args;
args << "-F" << srcify(".")
<< srcify("interface-from-framework.h")
@@ -978,7 +979,7 @@ 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)
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
QProcess proc;
proc.start("moc", QStringList(srcify("template-gtgt.h")));
QVERIFY(proc.waitForFinished());
@@ -994,7 +995,7 @@ void tst_Moc::templateGtGt()
void tst_Moc::defineMacroViaCmdline()
{
-#if defined(Q_OS_LINUX) && defined(Q_CC_GNU)
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
QProcess proc;
QStringList args;
@@ -1082,7 +1083,7 @@ 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)
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
QProcess proc;
proc.start("moc", QStringList(srcify("warn-on-property-without-read.h")));
QVERIFY(proc.waitForFinished());
@@ -1156,6 +1157,13 @@ void tst_Moc::constructors()
QObject *o3 = mo->newInstance(Q_ARG(QString, str));
QVERIFY(o3 != 0);
QCOMPARE(qobject_cast<CtorTestClass*>(o3)->m_str, str);
+
+ {
+ //explicit constructor
+ QObject *o = QObject::staticMetaObject.newInstance();
+ QVERIFY(o);
+ delete o;
+ }
}
#include "task234909.h"
@@ -1180,6 +1188,27 @@ void tst_Moc::typenameWithUnsigned()
QVERIFY(mobj->indexOfSlot("l(unsignedQImage)") != -1);
}
+
+void tst_Moc::warnOnVirtualSignal()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
+ QProcess proc;
+ proc.start("moc", QStringList(srcify("pure-virtual-signals.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("/pure-virtual-signals.h:48: Warning: Signals cannot be declared virtual\n") +
+ QString(SRCDIR) + QString("/pure-virtual-signals.h:50: Warning: Signals cannot be declared virtual\n"));
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
QTEST_MAIN(tst_Moc)
#include "tst_moc.moc"