[Interest] Using QSignalSpy/QTest::mousePress(..) etc. with googletest

Elvis Stansvik elvstone at gmail.com
Thu Oct 12 10:10:35 CEST 2017


Hi all,

I've began using googletest and googlemock for some unit tests.

I've read through the slides for this webinar:

   https://www.slideshare.net/ICSinc/webinar-qt-testdriven-development-using-google-test-and-google-mock

On some slides [1], the author talks about using QSignalSpy,
QTest::mousePress et.c. inside googletest unit tests, and even
provides a code sample of doing that [2].

The slides are nice. However, one crucial detail I think is missing: I
can't find any explanation of how the author makes sure there's a
Q(Core)Application/event loop available when such tests run. It's not
explained in the code samples nor the text AFAICS.

Anyone doing Qt event based testing with QSignalSpy, QTest::mouseClick
et.c. in a googletest unit test? How do you set up your
Q(Core)Application in those tests? Do you have any boilerplate/helper
that you use?

Thankful for any advice/tips on this.

Elvis

[1] https://www.slideshare.net/ICSinc/webinar-qt-testdriven-development-using-google-test-and-google-mock/43?src=clipshare

[2] https://www.slideshare.net/ICSinc/webinar-qt-testdriven-development-using-google-test-and-google-mock/19?src=clipshare



More information about the Interest mailing list