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
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Development mailing list Development@qt-project.org http://lists.qt-project.org/mailman/listinfo/development