summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-04-06 08:38:54 (GMT)
committerJason McDonald <jason.mcdonald@nokia.com>2009-04-07 01:00:52 (GMT)
commit08bfe19304e6f7cb2e47205ed36fa52a55972c22 (patch)
tree9d01617a3b0014088c0cfdb48a7460db712e1686 /tests/auto
parente1bd6e3e69be7ae4612d4c2b5bae6f694cd420c8 (diff)
downloadQt-08bfe19304e6f7cb2e47205ed36fa52a55972c22.zip
Qt-08bfe19304e6f7cb2e47205ed36fa52a55972c22.tar.gz
Qt-08bfe19304e6f7cb2e47205ed36fa52a55972c22.tar.bz2
Fix moc autotest failures
We have to pass the correct include paths when testing the multiple inheritance warning, because we want moc to find the QtGui and QObject headers. In addition we have to adjust the line numbers and include QObject in the qobject test to avoid a warning about the unknown QObject superclass. Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> (cherry picked from commit 73cffd26dcfbfee48caf86329d636361d02e5c03)
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/moc/forgotten-qinterface.h2
-rw-r--r--tests/auto/moc/tst_moc.cpp12
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/auto/moc/forgotten-qinterface.h b/tests/auto/moc/forgotten-qinterface.h
index a11793b..370a3d0 100644
--- a/tests/auto/moc/forgotten-qinterface.h
+++ b/tests/auto/moc/forgotten-qinterface.h
@@ -39,6 +39,8 @@
**
****************************************************************************/
+#include <QObject>
+
struct MyInterface
{
virtual ~MyInterface() {}
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 39f4f23..1499536 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -851,7 +851,10 @@ void tst_Moc::warnOnMultipleInheritance()
QVERIFY(!qgetenv("QTDIR").isNull());
QProcess proc;
- proc.start("moc", QStringList(srcify("warn-on-multiple-qobject-subclasses.h")));
+ QStringList args;
+ args << "-I" << qgetenv("QTDIR") + "/include/QtGui"
+ << srcify("warn-on-multiple-qobject-subclasses.h");
+ proc.start("moc", args);
QVERIFY(proc.waitForFinished());
QCOMPARE(proc.exitCode(), 0);
QByteArray mocOut = proc.readAllStandardOutput();
@@ -873,14 +876,17 @@ void tst_Moc::forgottenQInterface()
QVERIFY(!qgetenv("QTDIR").isNull());
QProcess proc;
- proc.start("moc", QStringList(srcify("forgotten-qinterface.h")));
+ QStringList args;
+ args << "-I" << qgetenv("QTDIR") + "/include/QtCore"
+ << srcify("forgotten-qinterface.h");
+ proc.start("moc", args);
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("/forgotten-qinterface.h:53: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
+ QString("/forgotten-qinterface.h:55: Warning: Class Test implements the interface MyInterface but does not list it in Q_INTERFACES. qobject_cast to MyInterface will not work!\n"));
#else
QSKIP("Only tested on linux/gcc", SkipAll);
#endif