|
28 | 28 | #include "qgssymbolv2.h"
|
29 | 29 | #include "qgssinglesymbolrendererv2.h"
|
30 | 30 | #include <QObject>
|
| 31 | +#include <QSignalSpy> |
31 | 32 | #include <QtTest>
|
32 | 33 |
|
33 | 34 | class TestQgsAtlasComposition: public QObject
|
@@ -57,6 +58,8 @@ class TestQgsAtlasComposition: public QObject
|
57 | 58 | void sorting_render();
|
58 | 59 | // test rendering with feature filtering
|
59 | 60 | void filtering_render();
|
| 61 | + // test render signals |
| 62 | + void test_signals(); |
60 | 63 | private:
|
61 | 64 | QgsComposition* mComposition;
|
62 | 65 | QgsComposerLabel* mLabel1;
|
@@ -365,5 +368,31 @@ void TestQgsAtlasComposition::filtering_render()
|
365 | 368 | mAtlas->endRender();
|
366 | 369 | }
|
367 | 370 |
|
| 371 | +void TestQgsAtlasComposition::test_signals() |
| 372 | +{ |
| 373 | + mAtlasMap->setNewExtent( QgsRectangle( 209838.166, 6528781.020, 610491.166, 6920530.620 ) ); |
| 374 | + mAtlasMap->setAtlasDriven( true ); |
| 375 | + mAtlasMap->setAtlasFixedScale( true ); |
| 376 | + mAtlas->setHideCoverage( false ); |
| 377 | + mAtlas->setSortFeatures( false ); |
| 378 | + mAtlas->setFilterFeatures( false ); |
| 379 | + |
| 380 | + QSignalSpy spyRenderBegun( mAtlas, SIGNAL(renderBegun()) ); |
| 381 | + QSignalSpy spyRenderEnded( mAtlas, SIGNAL(renderEnded()) ); |
| 382 | + QSignalSpy spyPreparedForAtlas( mAtlasMap, SIGNAL(preparedForAtlas()) ); |
| 383 | + mAtlas->beginRender(); |
| 384 | + |
| 385 | + QVERIFY( spyRenderBegun.count() == 1 ); |
| 386 | + |
| 387 | + for ( int fit = 0; fit < 2; ++fit ) |
| 388 | + { |
| 389 | + mAtlas->prepareForFeature( fit ); |
| 390 | + mLabel1->adjustSizeToText(); |
| 391 | + } |
| 392 | + QVERIFY( spyPreparedForAtlas.count() == 2 ); |
| 393 | + mAtlas->endRender(); |
| 394 | + QVERIFY( spyRenderEnded.count() == 1 ); |
| 395 | +} |
| 396 | + |
368 | 397 | QTEST_MAIN( TestQgsAtlasComposition )
|
369 | 398 | #include "moc_testqgsatlascomposition.cxx"
|
0 commit comments