Skip to content

Commit 3af68f4

Browse files
committedSep 21, 2014
Rebuild composer test images at 96 dpi to speed up unit tests
1 parent 3766537 commit 3af68f4

File tree

104 files changed

+66
-65
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+66
-65
lines changed
 

‎tests/src/core/qgscompositionchecker.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,26 @@ bool QgsCompositionChecker::testComposition( QString &report, int page, int pixe
4343
return false;
4444
}
4545

46+
setControlName( "expected_" + mTestName );
47+
4648
#if 0
4749
//fake mode to generate expected image
48-
//assume 300 dpi and size of the control image 3507 * 2480
49-
QImage outputImage( QSize( 3507, 2480 ), QImage::Format_ARGB32 );
50+
//assume 96 dpi and size of the control image 1122 * 794
51+
QImage newImage( QSize( 1122, 794 ), QImage::Format_ARGB32 );
5052
mComposition->setPlotStyle( QgsComposition::Print );
51-
outputImage.setDotsPerMeterX( 300 / 25.4 * 1000 );
52-
outputImage.setDotsPerMeterY( 300 / 25.4 * 1000 );
53-
outputImage.fill( 0 );
54-
QPainter p( &outputImage );
53+
newImage.setDotsPerMeterX( 96 / 25.4 * 1000 );
54+
newImage.setDotsPerMeterY( 96 / 25.4 * 1000 );
55+
newImage.fill( 0 );
56+
QPainter expectedPainter( &newImage );
5557
//QRectF sourceArea( 0, 0, mComposition->paperWidth(), mComposition->paperHeight() );
5658
//QRectF targetArea( 0, 0, 3507, 2480 );
57-
mComposition->renderPage( &p, page );
58-
p.end();
59-
outputImage.save( "/tmp/composerhtml_table_control.png", "PNG" );
60-
return false;
59+
mComposition->renderPage( &expectedPainter, page );
60+
expectedPainter.end();
61+
newImage.save( mExpectedImageFile, "PNG" );
62+
return true;
6163
#endif //0
6264

6365
//load expected image
64-
setControlName( "expected_" + mTestName );
6566
QImage expectedImage( mExpectedImageFile );
6667

6768
//get width/height, create image and render the composition to it

‎tests/src/core/testqgsatlascomposition.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void TestQgsAtlasComposition::autoscale_render()
216216
mLabel1->adjustSizeToText();
217217

218218
QgsCompositionChecker checker( QString( "atlas_autoscale%1" ).arg((( int )fit ) + 1 ), mComposition );
219-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
219+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
220220
}
221221
mAtlas->endRender();
222222
mAtlasMap->setAtlasDriven( false );
@@ -239,7 +239,7 @@ void TestQgsAtlasComposition::autoscale_render_2_0_api()
239239
mLabel1->adjustSizeToText();
240240

241241
QgsCompositionChecker checker( QString( "atlas_autoscale_old_api%1" ).arg((( int )fit ) + 1 ), mComposition );
242-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
242+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
243243
}
244244
mAtlas->endRender();
245245
Q_NOWARN_DEPRECATED_PUSH
@@ -263,7 +263,7 @@ void TestQgsAtlasComposition::fixedscale_render()
263263
mLabel1->adjustSizeToText();
264264

265265
QgsCompositionChecker checker( QString( "atlas_fixedscale%1" ).arg((( int )fit ) + 1 ), mComposition );
266-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
266+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
267267
}
268268
mAtlas->endRender();
269269

@@ -285,7 +285,7 @@ void TestQgsAtlasComposition::fixedscale_render_2_0_api()
285285
mLabel1->adjustSizeToText();
286286

287287
QgsCompositionChecker checker( QString( "atlas_fixedscale_old_api%1" ).arg((( int )fit ) + 1 ), mComposition );
288-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
288+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
289289
}
290290
mAtlas->endRender();
291291
Q_NOWARN_DEPRECATED_PUSH
@@ -321,7 +321,7 @@ void TestQgsAtlasComposition::predefinedscales_render()
321321
mLabel1->adjustSizeToText();
322322

323323
QgsCompositionChecker checker( QString( "atlas_predefinedscales%1" ).arg((( int )fit ) + 1 ), mComposition );
324-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
324+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
325325
}
326326
mAtlas->endRender();
327327

@@ -345,7 +345,7 @@ void TestQgsAtlasComposition::two_map_autoscale_render()
345345
mLabel1->adjustSizeToText();
346346

347347
QgsCompositionChecker checker( QString( "atlas_two_maps%1" ).arg((( int )fit ) + 1 ), mComposition );
348-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
348+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
349349
}
350350
mAtlas->endRender();
351351
mAtlasMap->setAtlasDriven( false );
@@ -368,7 +368,7 @@ void TestQgsAtlasComposition::hiding_render()
368368
mLabel1->adjustSizeToText();
369369

370370
QgsCompositionChecker checker( QString( "atlas_hiding%1" ).arg((( int )fit ) + 1 ), mComposition );
371-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
371+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
372372
}
373373
mAtlas->endRender();
374374
}
@@ -392,7 +392,7 @@ void TestQgsAtlasComposition::sorting_render()
392392
mLabel1->adjustSizeToText();
393393

394394
QgsCompositionChecker checker( QString( "atlas_sorting%1" ).arg((( int )fit ) + 1 ), mComposition );
395-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
395+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
396396
}
397397
mAtlas->endRender();
398398
}
@@ -417,7 +417,7 @@ void TestQgsAtlasComposition::filtering_render()
417417
mLabel1->adjustSizeToText();
418418

419419
QgsCompositionChecker checker( QString( "atlas_filtering%1" ).arg((( int )fit ) + 1 ), mComposition );
420-
QVERIFY( checker.testComposition( mReport, 0, 200 ) );
420+
QVERIFY( checker.testComposition( mReport, 0, 0 ) );
421421
}
422422
mAtlas->endRender();
423423
}

0 commit comments

Comments
 (0)