[Qgis-developer] acecss to qgisapp / qgisappinterface from tests (c++ or python?)
wonder.sk at gmail.com
Tue Nov 20 09:08:35 PST 2012
On Tue, Nov 20, 2012 at 5:52 PM, Etienne Tourigny
<etourigny.dev at gmail.com>wrote:
> 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.
How to get the "real" QgsAppInterface like when using a plugin?
that's right, it's not possible to access QgisAppInterface outside of
running QGIS instance. This has a reason: the interface provides various
methods that make sense only when QGIS is running (e.g. access to map
canvas, main window, toolbars). For testing purposes you could create a
fake implmentation of QgisInterface, but that's most likely not what you
IIRC addVectorLayer() and addRasterLayer() are just relatively simple
wrappers around this code:
layer = new Qgs[Vector / Raster]Layer( ... );
I'm wondering what exactly are you trying to test... is it the "core" layer
(and provider) loading or the connection with other QGIS components?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer