summaryrefslogtreecommitdiffstats
path: root/tests/auto/moc/tst_moc.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-08-18 16:10:01 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-08-19 13:21:26 (GMT)
commit6cf0ad80bb8a168115772aa5c3b4abec3e372ccc (patch)
tree653e5ca61f01394888122a9d6e6745a6618df7bb /tests/auto/moc/tst_moc.cpp
parent380b3dbd3ec3de31fb9be72a5cfd02543d291a62 (diff)
downloadQt-6cf0ad80bb8a168115772aa5c3b4abec3e372ccc.zip
Qt-6cf0ad80bb8a168115772aa5c3b4abec3e372ccc.tar.gz
Qt-6cf0ad80bb8a168115772aa5c3b4abec3e372ccc.tar.bz2
moc: Error if the NOTIFY signal is invalid.
Previously, an invalid NOTIFY signal would be silently ignored. Now it throws an error Reviewed-by: Joao Task-number: QTBUG-7684
Diffstat (limited to 'tests/auto/moc/tst_moc.cpp')
-rw-r--r--tests/auto/moc/tst_moc.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index d3a7e03..f9c3ccb 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -492,6 +492,7 @@ private slots:
void warnOnVirtualSignal();
void QTBUG5590_dummyProperty();
void QTBUG12260_defaultTemplate();
+ void notifyError();
signals:
void sigWithUnsignedArg(unsigned foo);
void sigWithSignedArg(signed foo);
@@ -1362,6 +1363,27 @@ void tst_Moc::QTBUG12260_defaultTemplate()
QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1);
}
+void tst_Moc::notifyError()
+{
+#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("error-on-wrong-notify.h")));
+ QVERIFY(proc.waitForFinished());
+ QCOMPARE(proc.exitCode(), 1);
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+ QByteArray mocOut = proc.readAllStandardOutput();
+ QVERIFY(mocOut.isEmpty());
+ QString mocError = QString::fromLocal8Bit(proc.readAllStandardError());
+ QCOMPARE(mocError, QString(SRCDIR) +
+ QString("/error-on-wrong-notify.h:52: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n"));
+#else
+ QSKIP("Only tested on linux/gcc", SkipAll);
+#endif
+}
+
QTEST_APPLESS_MAIN(tst_Moc)
#include "tst_moc.moc"