Skip to content
Permalink
Browse files

Add accessor for individual frame to QgsComposerMultiFrame. Adapt uni…

…t tests because composer items without frames are now the default
  • Loading branch information
mhugent committed Aug 24, 2012
1 parent 1f53221 commit d0bf482683658e1eb81c989809b8882e87cfb969
@@ -43,4 +43,5 @@ public:
void deleteFrames();

int nFrames() const;
QgsComposerFrame* frame( int i );
};
@@ -238,6 +238,15 @@ void QgsComposerMultiFrame::deleteFrames()
mResizeMode = bkResizeMode;
}

QgsComposerFrame* QgsComposerMultiFrame::frame( int i )
{
if ( i >= mFrameItems.size() )
{
return 0;
}
return mFrameItems.at( i );
}

bool QgsComposerMultiFrame::_writeXML( QDomElement& elem, QDomDocument& doc, bool ignoreFrames ) const
{
elem.setAttribute( "resizeMode", mResizeMode );
@@ -70,6 +70,7 @@ class CORE_EXPORT QgsComposerMultiFrame: public QObject
void deleteFrames();

int nFrames() const { return mFrameItems.size(); }
QgsComposerFrame* frame( int i );

protected:
QgsComposition* mComposition;
@@ -61,6 +61,7 @@ void TestQgsComposerHtml::table()
{
QgsComposerHtml* htmlItem = new QgsComposerHtml( mComposition, false );
QgsComposerFrame* htmlFrame = new QgsComposerFrame( mComposition, htmlItem, 0, 0, 100, 200 );
htmlFrame->setFrame( true );
htmlItem->addFrame( htmlFrame );
htmlItem->setUrl( QUrl( QString( "file:///%1" ).arg( QString( TEST_DATA_DIR ) + QDir::separator() + "html_table.html" ) ) );
QgsCompositionChecker checker( "Composer html table", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
@@ -77,6 +78,12 @@ void TestQgsComposerHtml::tableMultiFrame()
QgsComposerFrame* htmlFrame = new QgsComposerFrame( mComposition, htmlItem, 10, 10, 100, 50 );
htmlItem->addFrame( htmlFrame );
htmlItem->setResizeMode( QgsComposerMultiFrame::RepeatUntilFinished );
int nFrames = htmlItem->nFrames();
for ( int i = 0; i < nFrames; ++i )
{
htmlItem->frame( i )->setFrame( true );
}

bool result = true;
//page1
htmlItem->setUrl( QUrl( QString( "file:///%1" ).arg( QString( TEST_DATA_DIR ) + QDir::separator() + "html_table.html" ) ) );
@@ -67,6 +67,7 @@ void TestQgsComposerMap::initTestCase()
mComposition = new QgsComposition( mMapRenderer );
mComposition->setPaperSize( 297, 210 ); //A4 landscape
mComposerMap = new QgsComposerMap( mComposition, 20, 20, 200, 100 );
mComposerMap->setFrame( true );
mComposition->addComposerMap( mComposerMap );
}

@@ -121,6 +122,7 @@ void TestQgsComposerMap::grid()
void TestQgsComposerMap::overviewMap()
{
QgsComposerMap* overviewMap = new QgsComposerMap( mComposition, 20, 130, 70, 70 );
overviewMap->setFrame( true );
mComposition->addComposerMap( overviewMap );
mComposerMap->setNewExtent( QgsRectangle( 785462.375, 3341423.125, 789262.375, 3343323.125 ) ); //zoom in
overviewMap->setNewExtent( QgsRectangle( 781662.375, 3339523.125, 793062.375, 3350923.125 ) );

0 comments on commit d0bf482

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