Skip to content

Commit adbeab2

Browse files
committedDec 30, 2013
[composer] Add tests for item rotation
1 parent ddcfd06 commit adbeab2

File tree

6 files changed

+32
-5
lines changed

6 files changed

+32
-5
lines changed
 

‎src/core/composer/qgscomposerpicture.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void QgsComposerPicture::paint( QPainter* painter, const QStyleOptionGraphicsIte
5454

5555
drawBackground( painter );
5656

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

5959
if ( mMode != Unknown )
6060
{

‎tests/src/core/testqgscomposerrotation.cpp

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ class TestQgsComposerRotation: public QObject
4646
void mapRotation(); //test if composer map mapRotation is functioning
4747
void mapItemRotation(); //test if composer map item rotation is functioning
4848
void oldMapRotationApi(); //test if old deprectated composer map rotation api is functioning
49-
void pictureRotation();
49+
void pictureRotation(); //test if picture pictureRotation is functioning
50+
void pictureItemRotation(); //test if composer picture item rotation is functioning
51+
void oldPictureRotationApi(); //test if old deprectated composer picture rotation api is functioning
5052

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

219221
void TestQgsComposerRotation::pictureRotation()
220222
{
221-
//test map rotation
223+
//test picture rotation
222224
mComposition->addComposerPicture( mComposerPicture );
223225
mComposerPicture->setPictureRotation( 45 );
224-
//mComposerPicture->setSceneRect( QRectF( 70, 70, 100, 100 ) );
225226

226-
QgsCompositionChecker checker( "composerrotation_maprotation", mComposition );
227+
QgsCompositionChecker checker( "composerrotation_picturerotation", mComposition );
227228
QVERIFY( checker.testComposition( mReport ) );
228229

229230
mComposition->removeItem( mComposerPicture );
230231
mComposerPicture->setPictureRotation( 0 );
231232
}
232233

234+
void TestQgsComposerRotation::pictureItemRotation()
235+
{
236+
//test picture item rotation
237+
mComposition->addComposerPicture( mComposerPicture );
238+
mComposerPicture->setItemRotation( 45 );
239+
240+
QgsCompositionChecker checker( "composerrotation_pictureitemrotation", mComposition );
241+
QVERIFY( checker.testComposition( mReport ) );
242+
243+
mComposition->removeItem( mComposerPicture );
244+
mComposerPicture->setItemRotation( 0 );
245+
}
246+
247+
void TestQgsComposerRotation::oldPictureRotationApi()
248+
{
249+
//test old style deprecated rotation api - remove test after 2.0 series
250+
mComposition->addComposerPicture( mComposerPicture );
251+
mComposerPicture->setRotation( 45 );
252+
253+
QgsCompositionChecker checker( "composerrotation_picturerotation_oldapi", mComposition );
254+
QVERIFY( checker.testComposition( mReport ) );
255+
256+
mComposition->removeItem( mComposerPicture );
257+
mComposerPicture->setRotation( 0 );
258+
}
259+
233260
QTEST_MAIN( TestQgsComposerRotation )
234261
#include "moc_testqgscomposerrotation.cxx"

‎tests/testdata/sample_image.png

93.8 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.