Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[composer] Add tests for item rotation
  • Loading branch information
nyalldawson committed Dec 30, 2013
1 parent ddcfd06 commit adbeab2
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerpicture.cpp
Expand Up @@ -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 )
{
Expand Down
35 changes: 31 additions & 4 deletions tests/src/core/testqgscomposerrotation.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/testdata/sample_image.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit adbeab2

Please sign in to comment.