Skip to content
Permalink
Browse files

Added tests for PointDisplacementRenderer labels.

  • Loading branch information
henrik authored and nyalldawson committed Mar 24, 2019
1 parent e8584c0 commit cf63e0050008bed8e755b0efdcafbc333b1add9f
@@ -113,13 +113,17 @@ Sets a factor for increasing the label distances from the symbol.
:param factor: addition factor

.. seealso:: :py:func:`labelDistanceFactor`

.. versionadded:: 3.8
%End

double labelDistanceFactor() const;
%Docstring
Returns the factor for label distance from the symbol.

.. seealso:: :py:func:`setLabelDistanceFactor`

.. versionadded:: 3.8
%End

Placement placement() const;
@@ -101,16 +101,16 @@ class CORE_EXPORT QgsPointDisplacementRenderer: public QgsPointDistanceRenderer

/**
* Sets a factor for increasing the label distances from the symbol.
* /since QGIS 3.8
* \param factor addition factor
* \see labelDistanceFactor()
* \since QGIS 3.8
*/
void setLabelDistanceFactor( double factor ) { mLabelDistanceFactor = factor; }

/**
* Returns the factor for label distance from the symbol.
* /since QGIS 3.8
* \see setLabelDistanceFactor()
* \since QGIS 3.8
*/
double labelDistanceFactor() const { return mLabelDistanceFactor; }

@@ -303,10 +303,45 @@ def testClusterConcentricLabelsDifferetSizes(self):
self.layer.renderer().setPlacement(QgsPointDisplacementRenderer.ConcentricRings)
renderchecker = QgsMultiRenderChecker()
renderchecker.setMapSettings(self.mapsettings)
renderchecker.setControlPathPrefix('displacement_renderer')
renderchecker.setControlPathPrefix('displacement_renderer')
renderchecker.setControlName('expected_displacement_cluster_concentric_labels_diff_size')
self.assertTrue(renderchecker.runTest('expected_displacement_cluster_concentric_labels_diff_size'))

def testClusterRingLabelsDifferetSizesFurther(self):
self._set_categorized_renderer()
self.layer.renderer().setTolerance(10)
self.layer.renderer().setLabelAttributeName('Class')
self.layer.renderer().setLabelDistanceFactor(1)
renderchecker = QgsMultiRenderChecker()
renderchecker.setMapSettings(self.mapsettings)
renderchecker.setControlPathPrefix('displacement_renderer')
renderchecker.setControlName('expected_displacement_cluster_ring_labels_diff_size_further')
self.assertTrue(renderchecker.runTest('expected_displacement_cluster_ring_labels_diff_size_further'))

def testClusterGridLabelsDifferetSizesFurther(self):
self._set_categorized_renderer()
self.layer.renderer().setTolerance(10)
self.layer.renderer().setLabelAttributeName('Class')
self.layer.renderer().setLabelDistanceFactor(1)
self.layer.renderer().setPlacement(QgsPointDisplacementRenderer.Grid)
renderchecker = QgsMultiRenderChecker()
renderchecker.setMapSettings(self.mapsettings)
renderchecker.setControlPathPrefix('displacement_renderer')
renderchecker.setControlName('expected_displacement_cluster_grid_labels_diff_size_further')
self.assertTrue(renderchecker.runTest('expected_displacement_cluster_grid_labels_diff_size_further'))

def testClusterConcentricLabelsDifferetSizesFurther(self):
self._set_categorized_renderer()
self.layer.renderer().setTolerance(10)
self.layer.renderer().setLabelAttributeName('Class')
self.layer.renderer().setLabelDistanceFactor(1)
self.layer.renderer().setPlacement(QgsPointDisplacementRenderer.ConcentricRings)
renderchecker = QgsMultiRenderChecker()
renderchecker.setMapSettings(self.mapsettings)
renderchecker.setControlPathPrefix('displacement_renderer')
renderchecker.setControlName('expected_displacement_cluster_concentric_labels_diff_size_further')
self.assertTrue(renderchecker.runTest('expected_displacement_cluster_concentric_labels_diff_size_further'))



if __name__ == '__main__':
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit cf63e00

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