Fix error test. Better to use QgsMapLayerRegistry instead of manipulating QgsMapCanvas