diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-21 17:32:28 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-07-22 08:18:48 (GMT) |
commit | e43eae35b242bf90c801e719d61fff4a20549ead (patch) | |
tree | 2441fac7af61071e9d1ceb76db1369b42570822a /tests/auto/moc | |
parent | 96ee22d27e3f7c54ae622a956435bfc84cdb0e90 (diff) | |
download | Qt-e43eae35b242bf90c801e719d61fff4a20549ead.zip Qt-e43eae35b242bf90c801e719d61fff4a20549ead.tar.gz Qt-e43eae35b242bf90c801e719d61fff4a20549ead.tar.bz2 |
Fix Warning saying that signal cannot be made virtual
The test for virtual signal did not work.
But we cannot make an error right now or it might break existing code
(exemple in task 210879)
Reviewed-by: Kent Hansen
Diffstat (limited to 'tests/auto/moc')
-rw-r--r-- | tests/auto/moc/tst_moc.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index 898cfe1..d66791f 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); @@ -1180,6 +1181,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" |