summaryrefslogtreecommitdiffstats
path: root/tests/auto/moc/tst_moc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/moc/tst_moc.cpp')
-rw-r--r--tests/auto/moc/tst_moc.cpp49
1 files changed, 39 insertions, 10 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 3a40ae074..488f068e2 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"