Skip to content
Permalink
Browse files

Fix #9057, offset value misplaced when exporting composer to image

- Add unit test and control images
  • Loading branch information
dakcarto committed Feb 22, 2014
1 parent ef7a036 commit 7e33fdec37c52bd3428c8a1c5324874fa201ba17
@@ -4591,8 +4591,8 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context,
p->save();
p->translate( QPointF( component.center().x(), component.center().y() ) );
p->rotate( component.rotation() );
double xoff = tmpLyr.scaleToPixelContext( tmpLyr.shapeOffset.x(), context, tmpLyr.shapeOffsetUnits, true );
double yoff = tmpLyr.scaleToPixelContext( tmpLyr.shapeOffset.y(), context, tmpLyr.shapeOffsetUnits, true );
double xoff = tmpLyr.scaleToPixelContext( tmpLyr.shapeOffset.x(), context, tmpLyr.shapeOffsetUnits, false );
double yoff = tmpLyr.scaleToPixelContext( tmpLyr.shapeOffset.y(), context, tmpLyr.shapeOffsetUnits, false );
p->translate( QPointF( xoff, yoff ) );
p->rotate( component.rotationOffset() );

@@ -58,6 +58,25 @@ def test_text_color(self):
self.lyr.textColor = Qt.blue
self.checkTest()

def test_background_rect(self):
self.lyr.shapeDraw = True
self.checkTest()

def test_background_rect_w_offset(self):
# Label rectangular background
# verify fix for issues
# http://hub.qgis.org/issues/9057
# http://gis.stackexchange.com/questions/86900
self.lyr.fontSizeInMapUnits = True
font = QFont(self._TestFont)
font.setPointSizeF(460)
self.lyr.textFont = font

self.lyr.shapeDraw = True
self.lyr.shapeOffsetUnits = QgsPalLayerSettings.MapUnits
self.lyr.shapeOffset = QPointF(-2900.0, -450.0 )
self.checkTest()

def test_partials_labels_enabled(self):
# Set Big font size
font = QFont(self._TestFont)
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 7e33fde

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