tests/auto/moc/tst_moc.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   490     void constructors();
   490     void constructors();
   491     void typenameWithUnsigned();
   491     void typenameWithUnsigned();
   492     void warnOnVirtualSignal();
   492     void warnOnVirtualSignal();
   493     void QTBUG5590_dummyProperty();
   493     void QTBUG5590_dummyProperty();
   494     void QTBUG12260_defaultTemplate();
   494     void QTBUG12260_defaultTemplate();
       
   495     void notifyError();
   495 signals:
   496 signals:
   496     void sigWithUnsignedArg(unsigned foo);
   497     void sigWithUnsignedArg(unsigned foo);
   497     void sigWithSignedArg(signed foo);
   498     void sigWithSignedArg(signed foo);
   498     void sigWithConstSignedArg(const signed foo);
   499     void sigWithConstSignedArg(const signed foo);
   499     void sigWithVolatileConstSignedArg(volatile const signed foo);
   500     void sigWithVolatileConstSignedArg(volatile const signed foo);
  1360 {
  1361 {
  1361     QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomething(QHash<QString,QVariant>)") != -1);
  1362     QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomething(QHash<QString,QVariant>)") != -1);
  1362     QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1);
  1363     QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1);
  1363 }
  1364 }
  1364 
  1365 
       
  1366 void tst_Moc::notifyError()
       
  1367 {
       
  1368 #ifdef MOC_CROSS_COMPILED
       
  1369     QSKIP("Not tested when cross-compiled", SkipAll);
       
  1370 #endif
       
  1371 #if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS)
       
  1372     QProcess proc;
       
  1373     proc.start("moc", QStringList(srcify("error-on-wrong-notify.h")));
       
  1374     QVERIFY(proc.waitForFinished());
       
  1375     QCOMPARE(proc.exitCode(), 1);
       
  1376     QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
       
  1377     QByteArray mocOut = proc.readAllStandardOutput();
       
  1378     QVERIFY(mocOut.isEmpty());
       
  1379     QString mocError = QString::fromLocal8Bit(proc.readAllStandardError());
       
  1380     QCOMPARE(mocError, QString(SRCDIR) +
       
  1381         QString("/error-on-wrong-notify.h:52: Error: NOTIFY signal 'fooChanged' of property 'foo' does not exist in class ClassWithWrongNOTIFY.\n"));
       
  1382 #else
       
  1383     QSKIP("Only tested on linux/gcc", SkipAll);
       
  1384 #endif
       
  1385 }
       
  1386 
  1365 
  1387 
  1366 QTEST_APPLESS_MAIN(tst_Moc)
  1388 QTEST_APPLESS_MAIN(tst_Moc)
  1367 #include "tst_moc.moc"
  1389 #include "tst_moc.moc"
  1368 
  1390 
  1369 
  1391