tests/auto/moc/tst_moc.cpp
changeset 33 3e2da88830cd
parent 30 5dc02b23752f
child 37 758a864f9613
equal deleted inserted replaced
30:5dc02b23752f 33:3e2da88830cd
   489     void warnOnPropertyWithoutREAD();
   489     void warnOnPropertyWithoutREAD();
   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 signals:
   495 signals:
   495     void sigWithUnsignedArg(unsigned foo);
   496     void sigWithUnsignedArg(unsigned foo);
   496     void sigWithSignedArg(signed foo);
   497     void sigWithSignedArg(signed foo);
   497     void sigWithConstSignedArg(const signed foo);
   498     void sigWithConstSignedArg(const signed foo);
   498     void sigWithVolatileConstSignedArg(volatile const signed foo);
   499     void sigWithVolatileConstSignedArg(volatile const signed foo);
  1320     void foo(struct constconst const &) {};
  1321     void foo(struct constconst const &) {};
  1321     void foo(struct constconst *) {};
  1322     void foo(struct constconst *) {};
  1322     void foo(struct const_ *) {};
  1323     void foo(struct const_ *) {};
  1323 };
  1324 };
  1324 
  1325 
       
  1326 
       
  1327 template<typename T1, typename T2>
       
  1328 class TestTemplate2
       
  1329 {
       
  1330 };
       
  1331 
       
  1332 class QTBUG11647_constInTemplateParameter : public QObject
       
  1333 { Q_OBJECT
       
  1334 public slots:
       
  1335     void testSlot(TestTemplate2<const int, const short*>) {}
       
  1336     void testSlot2(TestTemplate2<int, short const * const >) {}
       
  1337     void testSlot3(TestTemplate2<TestTemplate2 < const int, const short* > const *,
       
  1338                                 TestTemplate2< TestTemplate2 < void, int > , unsigned char *> > ) {}
       
  1339 
       
  1340 signals:
       
  1341     void testSignal(TestTemplate2<const int, const short*>);
       
  1342 };
       
  1343 
       
  1344 class QTBUG12260_defaultTemplate_Object : public QObject
       
  1345 { Q_OBJECT
       
  1346 public slots:
       
  1347 #if !(defined(Q_CC_GNU) && __GNUC__ == 4 && __GNUC_MINOR__ <= 3) || defined(Q_MOC_RUN)
       
  1348     void doSomething(QHash<QString, QVariant> values = QHash<QString, QVariant>() ) { Q_UNUSED(values); }
       
  1349 #else
       
  1350     // we want to test the previous function, but gcc < 4.4 seemed to have a bug similar to the one moc has.
       
  1351     typedef QHash<QString, QVariant> WorkaroundGCCBug;
       
  1352     void doSomething(QHash<QString, QVariant> values = WorkaroundGCCBug() ) { Q_UNUSED(values); }
       
  1353 #endif
       
  1354 
       
  1355     void doAnotherThing(bool a = (1 < 3), bool b = (1 > 4)) { Q_UNUSED(a); Q_UNUSED(b); }
       
  1356 };
       
  1357 
       
  1358 
       
  1359 void tst_Moc::QTBUG12260_defaultTemplate()
       
  1360 {
       
  1361     QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doSomething(QHash<QString,QVariant>)") != -1);
       
  1362     QVERIFY(QTBUG12260_defaultTemplate_Object::staticMetaObject.indexOfSlot("doAnotherThing(bool,bool)") != -1);
       
  1363 }
       
  1364 
       
  1365 
  1325 QTEST_APPLESS_MAIN(tst_Moc)
  1366 QTEST_APPLESS_MAIN(tst_Moc)
  1326 #include "tst_moc.moc"
  1367 #include "tst_moc.moc"
  1327 
  1368 
  1328 
  1369 
  1329 
  1370