Skip to content
Permalink
Browse files

[composer] Add tests for item rotation

  • Loading branch information
nyalldawson committed Dec 30, 2013
1 parent ddcfd06 commit adbeab29c4558f594a8306fb24f27ed8a8bc0df3
@@ -54,7 +54,7 @@ void QgsComposerPicture::paint( QPainter* painter, const QStyleOptionGraphicsIte

drawBackground( painter );

int newDpi = ( painter->device()->logicalDpiX() + painter->device()->logicalDpiY() ) / 2;
//int newDpi = ( painter->device()->logicalDpiX() + painter->device()->logicalDpiY() ) / 2;

if ( mMode != Unknown )
{
@@ -46,7 +46,9 @@ class TestQgsComposerRotation: public QObject
void mapRotation(); //test if composer map mapRotation is functioning
void mapItemRotation(); //test if composer map item rotation is functioning
void oldMapRotationApi(); //test if old deprectated composer map rotation api is functioning
void pictureRotation();
void pictureRotation(); //test if picture pictureRotation is functioning
void pictureItemRotation(); //test if composer picture item rotation is functioning
void oldPictureRotationApi(); //test if old deprectated composer picture rotation api is functioning

private:
QgsComposition* mComposition;
@@ -218,17 +220,42 @@ void TestQgsComposerRotation::oldMapRotationApi()

void TestQgsComposerRotation::pictureRotation()
{
//test map rotation
//test picture rotation
mComposition->addComposerPicture( mComposerPicture );
mComposerPicture->setPictureRotation( 45 );
//mComposerPicture->setSceneRect( QRectF( 70, 70, 100, 100 ) );

QgsCompositionChecker checker( "composerrotation_maprotation", mComposition );
QgsCompositionChecker checker( "composerrotation_picturerotation", mComposition );
QVERIFY( checker.testComposition( mReport ) );

mComposition->removeItem( mComposerPicture );
mComposerPicture->setPictureRotation( 0 );
}

void TestQgsComposerRotation::pictureItemRotation()
{
//test picture item rotation
mComposition->addComposerPicture( mComposerPicture );
mComposerPicture->setItemRotation( 45 );

QgsCompositionChecker checker( "composerrotation_pictureitemrotation", mComposition );
QVERIFY( checker.testComposition( mReport ) );

mComposition->removeItem( mComposerPicture );
mComposerPicture->setItemRotation( 0 );
}

void TestQgsComposerRotation::oldPictureRotationApi()
{
//test old style deprecated rotation api - remove test after 2.0 series
mComposition->addComposerPicture( mComposerPicture );
mComposerPicture->setRotation( 45 );

QgsCompositionChecker checker( "composerrotation_picturerotation_oldapi", mComposition );
QVERIFY( checker.testComposition( mReport ) );

mComposition->removeItem( mComposerPicture );
mComposerPicture->setRotation( 0 );
}

QTEST_MAIN( TestQgsComposerRotation )
#include "moc_testqgscomposerrotation.cxx"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit adbeab2

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