Skip to content
Permalink
Browse files

add missing crsChanged signal in QgsProjectionSelectionWidget (#7079)

  • Loading branch information
3nids committed May 27, 2018
1 parent c8a5992 commit 487a6a8b707cb8d2515eeee23d294cae93b3cec0
@@ -256,7 +256,11 @@ void QgsProjectionSelectionWidget::setCrs( const QgsCoordinateReferenceSystem &c
currentCrsOptionText( crs ) );
}
}
mCrs = crs;
if ( mCrs != crs )
{
mCrs = crs;
emit crsChanged( crs );
}
}

void QgsProjectionSelectionWidget::setLayerCrs( const QgsCoordinateReferenceSystem &crs )
@@ -14,6 +14,7 @@

import qgis # NOQA

from qgis.PyQt.QtTest import QSignalSpy
from qgis.gui import (QgsProjectionSelectionWidget,
QgsProjectionSelectionTreeWidget,
QgsProjectionSelectionDialog)
@@ -115,6 +116,17 @@ def testShowingNotSetOption(self):
self.assertTrue(w.optionVisible(QgsProjectionSelectionWidget.CurrentCrs))
self.assertTrue(w.optionVisible(QgsProjectionSelectionWidget.CrsNotSet))

def testSignal(self):
w = QgsProjectionSelectionWidget()
w.show()
spy = QSignalSpy(w.crsChanged)
w.setCrs(QgsCoordinateReferenceSystem('EPSG:3111'))
self.assertEqual(w.crs().authid(), 'EPSG:3111')
self.assertEqual(len(spy), 1)
# setting the same crs doesn't emit the signal
w.setCrs(QgsCoordinateReferenceSystem('EPSG:3111'))
self.assertEqual(len(spy), 1)

def testTreeWidgetGettersSetters(self):
""" basic tests for QgsProjectionSelectionTreeWidget """
w = QgsProjectionSelectionTreeWidget()

0 comments on commit 487a6a8

Please sign in to comment.
You can’t perform that action at this time.