[Development] Qt 4.8 autotests need attention; over 100 insignificant tests!

Thiago Macieira thiago.macieira at intel.com
Wed Jun 13 20:10:47 CEST 2012


On quarta-feira, 13 de junho de 2012 17.32.43, Friedemann Kleint wrote:
> In  Qt 5, this was solved by introducing the QFINDTESTDATA macro, but 
> porting it to Qt 4 is a non-trivial task.
> 
> https://codereview.qt-project.org/#change,28579 (Fix QLibrary test) and 
> https://codereview.qt-project.org/#change,27579 (QApplication) 
> illustrate what needs to be done for such cases:
> 
> - Removing CONFIG -= app_bundle causes the Mac binary to be created in 
> the test root folder
> 
> - On Windows, cd up one level if the current working directory is 
> 'debug' or 'release' in the test constructor

Another solution we used to use is to add to the test's .pro file:

DEFINES += SRCDIR=\\\"$$PWD/\\\"

Then all file references should be prefixed with SRCDIR. E.g:

	QFile f(SRCDIR "./testdata");

Don't forget the space! It's an error to write SRCDIR"./testdata" in C++11.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120613/6740164d/attachment.sig>


More information about the Development mailing list