Skip to content
Permalink
Browse files

Fixes for composer map grid test

  • Loading branch information
nyalldawson committed Jun 30, 2015
1 parent 6e6cb66 commit 5b97b7e318c96b762b0c09ea124050237e74d680
@@ -110,6 +110,7 @@ void TestQgsComposerMapGrid::init()
mComposerMap->grid()->setIntervalY( 2000 );
mComposerMap->grid()->setGridLineWidth( 0.5 );
mComposerMap->grid()->setGridLineColor( QColor( 0, 0, 0 ) );
mComposerMap->updateBoundingRect();
mComposition->addComposerMap( mComposerMap );
}

@@ -133,6 +134,7 @@ void TestQgsComposerMapGrid::grid()
mComposerMap->grid()->setAnnotationDirection( QgsComposerMapGrid::Horizontal, QgsComposerMapGrid::Bottom );
mComposerMap->grid()->setAnnotationFontColor( QColor( 255, 0, 0, 150 ) );
mComposerMap->grid()->setBlendMode( QPainter::CompositionMode_Overlay );
mComposerMap->updateBoundingRect();
qWarning() << "grid annotation font: " << mComposerMap->grid()->annotationFont().toString() << " exactMatch:" << mComposerMap->grid()->annotationFont().exactMatch();
QgsCompositionChecker checker( "composermap_grid", mComposition );

@@ -155,6 +157,7 @@ void TestQgsComposerMapGrid::reprojected()
mComposerMap->grid()->setFrameStyle( QgsComposerMapGrid::ExteriorTicks );
mComposerMap->grid()->setFrameWidth( 10 );
mComposerMap->setFrameEnabled( false );
mComposerMap->updateBoundingRect();
QgsCompositionChecker checker( "composermap_gridreprojected", mComposition );

bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -174,6 +177,7 @@ void TestQgsComposerMapGrid::crossGrid()
mComposerMap->grid()->setAnnotationEnabled( false );
mComposerMap->grid()->setGridLineColor( QColor( 0, 255, 0 ) );
mComposerMap->grid()->setBlendMode( QPainter::CompositionMode_SourceOver );
mComposerMap->updateBoundingRect();
QgsCompositionChecker checker( "composermap_crossgrid", mComposition );

bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -190,6 +194,7 @@ void TestQgsComposerMapGrid::markerGrid()
mComposerMap->grid()->setStyle( QgsComposerMapGrid::Markers );
mComposerMap->grid()->setAnnotationEnabled( false );
mComposerMap->grid()->setBlendMode( QPainter::CompositionMode_SourceOver );
mComposerMap->updateBoundingRect();
QgsCompositionChecker checker( "composermap_markergrid", mComposition );

bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -210,6 +215,7 @@ void TestQgsComposerMapGrid::frameOnly()
mComposerMap->grid()->setFrameWidth( 2.0 );
mComposerMap->grid()->setFramePenSize( 0.5 );
mComposerMap->grid()->setBlendMode( QPainter::CompositionMode_SourceOver );
mComposerMap->updateBoundingRect();
QgsCompositionChecker checker( "composermap_gridframeonly", mComposition );

bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -233,6 +239,7 @@ void TestQgsComposerMapGrid::zebraStyle()
mComposerMap->grid()->setFrameFillColor1( QColor( 50, 90, 50, 100 ) );
mComposerMap->grid()->setFrameFillColor2( QColor( 200, 220, 100, 60 ) );
mComposerMap->grid()->setEnabled( true );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_zebrastyle", mComposition );

@@ -258,17 +265,20 @@ void TestQgsComposerMapGrid::zebraStyleSides()
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameRight, false );
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameTop, false );
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameBottom, false );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_zebrastyle_left", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
QVERIFY( testResult );

mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameTop, true );
mComposerMap->updateBoundingRect();
QgsCompositionChecker checker2( "composermap_zebrastyle_lefttop", mComposition );
bool testResult2 = checker2.testComposition( mReport, 0, 0 );
QVERIFY( testResult2 );

mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameRight, true );
mComposerMap->updateBoundingRect();
QgsCompositionChecker checker3( "composermap_zebrastyle_lefttopright", mComposition );
bool testResult3 = checker3.testComposition( mReport, 0, 0 );
QVERIFY( testResult3 );
@@ -298,6 +308,7 @@ void TestQgsComposerMapGrid::frameDivisions()
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameRight, true );
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameTop, true );
mComposerMap->grid()->setFrameSideFlag( QgsComposerMapGrid::FrameBottom, true );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_rotatedframe", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -307,6 +318,7 @@ void TestQgsComposerMapGrid::frameDivisions()
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::LongitudeOnly, QgsComposerMapGrid::Right );
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::LatitudeOnly, QgsComposerMapGrid::Top );
mComposerMap->grid()->setFrameDivisions( QgsComposerMapGrid::LongitudeOnly, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker2( "composermap_framedivisions", mComposition );
testResult = checker2.testComposition( mReport, 0, 0 );
@@ -337,6 +349,7 @@ void TestQgsComposerMapGrid::annotationFilter()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_rotatedannotations", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -346,6 +359,7 @@ void TestQgsComposerMapGrid::annotationFilter()
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::LongitudeOnly, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::LatitudeOnly, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationDisplay( QgsComposerMapGrid::LongitudeOnly, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker2( "composermap_filteredannotations", mComposition );
testResult = checker2.testComposition( mReport, 0, 0 );
@@ -369,6 +383,7 @@ void TestQgsComposerMapGrid::interiorTicks()
mComposerMap->grid()->setFramePenColor( Qt::black );
mComposerMap->grid()->setEnabled( true );
mComposerMap->grid()->setStyle( QgsComposerMapGrid::FrameAnnotationsOnly );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_interiorticks", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -393,6 +408,7 @@ void TestQgsComposerMapGrid::interiorTicksAnnotated()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_interiorticks_annotated", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -402,6 +418,7 @@ void TestQgsComposerMapGrid::interiorTicksAnnotated()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker2( "composermap_interiorticks_annotated2", mComposition );
bool testResult2 = checker2.testComposition( mReport, 0, 0 );
@@ -421,6 +438,7 @@ void TestQgsComposerMapGrid::exteriorTicks()
mComposerMap->grid()->setFramePenColor( Qt::black );
mComposerMap->grid()->setEnabled( true );
mComposerMap->grid()->setStyle( QgsComposerMapGrid::FrameAnnotationsOnly );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_exteriorticks", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -445,6 +463,7 @@ void TestQgsComposerMapGrid::exteriorTicksAnnotated()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_exteriorticks_annotated", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -454,6 +473,7 @@ void TestQgsComposerMapGrid::exteriorTicksAnnotated()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker2( "composermap_exteriorticks_annotated2", mComposition );
bool testResult2 = checker2.testComposition( mReport, 0, 0 );
@@ -473,6 +493,7 @@ void TestQgsComposerMapGrid::interiorExteriorTicks()
mComposerMap->grid()->setFramePenColor( Qt::black );
mComposerMap->grid()->setEnabled( true );
mComposerMap->grid()->setStyle( QgsComposerMapGrid::FrameAnnotationsOnly );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_interiorexteriorticks", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -497,6 +518,7 @@ void TestQgsComposerMapGrid::interiorExteriorTicksAnnotated()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_interiorexteriorticks_annotated", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -506,6 +528,7 @@ void TestQgsComposerMapGrid::interiorExteriorTicksAnnotated()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker2( "composermap_interiorexteriorticks_annotated2", mComposition );
bool testResult2 = checker2.testComposition( mReport, 0, 0 );
@@ -525,6 +548,7 @@ void TestQgsComposerMapGrid::lineBorder()
mComposerMap->grid()->setFramePenColor( Qt::black );
mComposerMap->grid()->setEnabled( true );
mComposerMap->grid()->setStyle( QgsComposerMapGrid::FrameAnnotationsOnly );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_lineborder", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -549,6 +573,7 @@ void TestQgsComposerMapGrid::lineBorderAnnotated()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::InsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_lineborder_annotated", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -558,6 +583,7 @@ void TestQgsComposerMapGrid::lineBorderAnnotated()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker2( "composermap_lineborder_annotated2", mComposition );
bool testResult2 = checker2.testComposition( mReport, 0, 0 );
@@ -625,6 +651,7 @@ void TestQgsComposerMapGrid::descendingAnnotations()
mComposerMap->grid()->setAnnotationDirection( QgsComposerMapGrid::VerticalDescending, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationDirection( QgsComposerMapGrid::VerticalDescending, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationDirection( QgsComposerMapGrid::VerticalDescending, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker( "composermap_verticaldescending_inside", mComposition );
bool testResult = checker.testComposition( mReport, 0, 0 );
@@ -634,6 +661,7 @@ void TestQgsComposerMapGrid::descendingAnnotations()
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Right );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Top );
mComposerMap->grid()->setAnnotationPosition( QgsComposerMapGrid::OutsideMapFrame, QgsComposerMapGrid::Bottom );
mComposerMap->updateBoundingRect();

QgsCompositionChecker checker2( "composermap_verticaldescending_outside", mComposition );
bool testResult2 = checker2.testComposition( mReport, 0, 0 );
@@ -74,6 +74,7 @@ def testGrid(self):
self.mComposerMap.grid().setAnnotationDirection( QgsComposerMapGrid.Horizontal, QgsComposerMapGrid.Bottom )
self.mComposerMap.grid().setAnnotationFontColor( QColor( 255, 0, 0, 150 ) )
self.mComposerMap.grid().setBlendMode( QPainter.CompositionMode_Overlay )
self.mComposerMap.updateBoundingRect()

checker = QgsCompositionChecker('composermap_grid', self.mComposition)
myTestResult, myMessage = checker.testComposition()
@@ -94,6 +95,7 @@ def testCrossGrid(self):
self.mComposerMap.grid().setGridLineColor( QColor( 0, 255, 0 ) )
self.mComposerMap.grid().setGridLineWidth( 0.5 )
self.mComposerMap.grid().setBlendMode( QPainter.CompositionMode_SourceOver )
self.mComposerMap.updateBoundingRect()

checker = QgsCompositionChecker('composermap_crossgrid', self.mComposition)
myTestResult, myMessage = checker.testComposition()
@@ -114,6 +116,7 @@ def testMarkerGrid(self):
self.mComposerMap.grid().setIntervalY( 2000 )
self.mComposerMap.grid().setAnnotationEnabled( False )
self.mComposerMap.grid().setBlendMode( QPainter.CompositionMode_SourceOver )
self.mComposerMap.updateBoundingRect()

checker = QgsCompositionChecker('composermap_markergrid', self.mComposition)
myTestResult, myMessage = checker.testComposition()
@@ -135,6 +138,7 @@ def testFrameOnly(self):
self.mComposerMap.grid().setFrameStyle( QgsComposerMapGrid.Zebra )
self.mComposerMap.grid().setFramePenSize( 0.5 )
self.mComposerMap.grid().setBlendMode( QPainter.CompositionMode_SourceOver )
self.mComposerMap.updateBoundingRect()

checker = QgsCompositionChecker('composermap_gridframeonly', self.mComposition)
myTestResult, myMessage = checker.testComposition()
@@ -164,6 +168,7 @@ def testZebraStyle(self):
self.mComposerMap.grid().setFrameFillColor1( QColor( 50, 90, 50, 100 ) )
self.mComposerMap.grid().setFrameFillColor2( QColor( 200, 220, 100, 60 ) )
self.mComposerMap.grid().setEnabled( True )
self.mComposerMap.updateBoundingRect()

checker = QgsCompositionChecker('composermap_zebrastyle', self.mComposition)
myTestResult, myMessage = checker.testComposition( 0, 100 )
@@ -191,17 +196,20 @@ def testZebraStyleSides(self):
self.mComposerMap.grid().setFrameSideFlag( QgsComposerMapGrid.FrameRight, False )
self.mComposerMap.grid().setFrameSideFlag( QgsComposerMapGrid.FrameTop, False )
self.mComposerMap.grid().setFrameSideFlag( QgsComposerMapGrid.FrameBottom, False )
self.mComposerMap.updateBoundingRect()

checker = QgsCompositionChecker('composermap_zebrastyle_left', self.mComposition)
myTestResult, myMessage = checker.testComposition( 0, 100 )
assert myTestResult, myMessage

self.mComposerMap.grid().setFrameSideFlag( QgsComposerMapGrid.FrameTop, True )
self.mComposerMap.updateBoundingRect()
checker = QgsCompositionChecker('composermap_zebrastyle_lefttop', self.mComposition)
myTestResult, myMessage = checker.testComposition( 0, 100 )
assert myTestResult, myMessage

self.mComposerMap.grid().setFrameSideFlag( QgsComposerMapGrid.FrameRight, True )
self.mComposerMap.updateBoundingRect()
checker = QgsCompositionChecker('composermap_zebrastyle_lefttopright', self.mComposition)
myTestResult, myMessage = checker.testComposition( 0, 100 )
assert myTestResult, myMessage
@@ -223,6 +231,7 @@ def testInteriorTicks(self):
self.mComposerMap.grid().setFramePenColor( QColor( 0, 0, 0 ) )
self.mComposerMap.grid().setEnabled( True )
self.mComposerMap.grid().setStyle( QgsComposerMapGrid.FrameAnnotationsOnly )
self.mComposerMap.updateBoundingRect()

checker = QgsCompositionChecker('composermap_interiorticks', self.mComposition)
myTestResult, myMessage = checker.testComposition( 0, 100 )
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 5b97b7e

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