> -----Original Message-----
> From: Marc Van Daele <marc.van.dael...@gmail.com>
> Sent: Wednesday, 24 October 2018 11:43 AM
> To: Mitch Curtis <mitch.cur...@qt.io>
> Cc: interest@qt-project.org
> Subject: Re: [Interest] Failing to use QUICK_TEST_MAIN_WITH_SETUP
> 
> Thanks!
> Adding #include "main.moc" indeed worked!
> 
> I also tried to put Setup.h/cpp in a separate class (and no #include of the
> moc) but I couldn't get that one working.

Hmm, I'm not sure why that doesn't work - it should work the same as regular 
moc'd classes/files. Though it's worth mentioning that I've never seen an auto 
test (class) that wasn't solely contained within a .cpp file.

> Note also that the example on https://doc.qt.io/qt-5.11/qtquicktest-
> index.html#executing-c-before-qml-tests is missing a     Q_OBJECT!

Nicely spotted, will update the patch. :)

> Kind Regards,
> 
> Marc
> 
> 
> Op wo 24 okt. 2018 om 11:10 schreef Mitch Curtis <mitch.cur...@qt.io
> <mailto:mitch.cur...@qt.io> >:
> 
> 
>       > -----Original Message-----
>       > From: Interest <interest-bounces+mitch.curtis=qt.io@qt-
> project.org <mailto:qt...@qt-project.org> > On
>       > Behalf Of Marc Van Daele
>       > Sent: Wednesday, 24 October 2018 10:58 AM
>       > To: interest@qt-project.org <mailto:interest@qt-project.org>
>       > Subject: [Interest] Failing to use QUICK_TEST_MAIN_WITH_SETUP
>       >
>       > I'm trying to get an answer to
> https://forum.qt.io/topic/95715/qtest-failing-
>       > to-use-quick_test_main_with_setup
>       > (I hope it is not considered impolite to re-post it here )
>       >
>       >
>       > Basically I'm looking for a minimal but complete stand-alone
> example using
>       > the new QUICK_TEST_MAIN_WITH_SETUP macro.
>       > I'm using Qt 5.11.2
>       >
>       > Thanks in advance,
>       >
>       > Marc
> 
>       Hi Marc.
> 
>       The #include "tst_mytest.moc" is probably what's missing, as without
> that the QMetaObject::invokeMethod() call will fail. You should change the
> include to match the cpp file that the Setup type is in. For example, if your
> .cpp file is Setup.cpp:
> 
>       #include "Setup.moc"
> 
>       Sorry that the documentation is lacking here - it really should explain
> what to name that include. I'll submit a patch for it.
> 

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to