[Qgis-developer] acecss to qgisapp / qgisappinterface from tests (c++ or python?)

Etienne Tourigny etourigny.dev at gmail.com
Tue Nov 20 08:52:42 PST 2012


Hi,

I am trying to add some tests for the addRasterLayer() and
addVectorLayer() members in QgisApp, and it seems I cannot have access
to them from the test environment.

I tried including qgisapp.h, but that needed an extra rule in
CMakeLists (to add src/app to INCLUDE_DIRECTORIES), but this generated
the following error when building

In file included from /data/src/qgis/qgis-etiennesky/src/app/qgisapp.h:91:0,
                 from
/data/src/qgis/qgis-etiennesky/tests/src/core/testqgsvectorlayer.cpp:34:
/data/src/qgis/qgis-etiennesky/src/app/qgssnappingdialog.h:22:38:
fatal error: ui_qgssnappingdialogbase.h: No such file or directory
compilation terminated.


I also tried using QgsInterface from a python test, but it doesn't
work because in tests/src/python/utilities.py
"QgisInterface is a stub implementation of the QGIS plugin interface"

How to get the "real" QgsAppInterface like when using a plugin?

thanks
Etienne


More information about the Qgis-developer mailing list