Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Further refactoring of composer html tests and fixes so that html ele…
…ments consume all horizontal space
  • Loading branch information
timlinux committed Sep 20, 2012
1 parent ad78d7b commit 8489bd1
Show file tree
Hide file tree
Showing 6 changed files with 4,021 additions and 12 deletions.
13 changes: 12 additions & 1 deletion src/core/composer/qgscomposerhtml.cpp
Expand Up @@ -57,9 +57,20 @@ void QgsComposerHtml::setUrl( const QUrl& url )
{
qApp->processEvents();
}
QSize contentsSize = mWebPage->mainFrame()->contentsSize();

if ( nFrames() < 1) return;
//QSize contentsSize = mWebPage->mainFrame()->contentsSize();

QRectF contentRect = this->mFrameItems.at(0)->boundingRect();
//there is going to be a little rounding error converting from float to int
QSize contentsSize = QSize( (int)(contentRect.width() * mHtmlUnitsToMM),
(int)(contentRect.height() * mHtmlUnitsToMM));
mWebPage->setViewportSize( contentsSize );

//suppress scroll bars always
mWebPage->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
mWebPage->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);

mSize.setWidth( contentsSize.width() / mHtmlUnitsToMM );
mSize.setHeight( contentsSize.height() / mHtmlUnitsToMM );
recalculateFrameSizes();
Expand Down
2 changes: 2 additions & 0 deletions tests/src/python/test_qgscomposerhtml.py
Expand Up @@ -101,6 +101,7 @@ def testTableMultiFrame(self):
checker2 = QgsCompositionChecker()
myControlImage = self.controlImagePath(
"composerhtml_table_multiframe2.png")
print "Checking page 2"
myResult, myMessage = checker2.testComposition("Composer html table",
self.mComposition,
myControlImage,
Expand All @@ -115,6 +116,7 @@ def testTableMultiFrame(self):
self.mComposition,
myControlImage,
myPage)
print "Checking page 3"
assert myResult, myMessage

if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion tests/src/python/utilities.py
Expand Up @@ -10,7 +10,7 @@
from qgis_interface import QgisInterface
import hashlib

QGISAPP = None # Static vainasafele used to hold hand to running QGis app
QGISAPP = None # Static variable used to hold hand to running QGis app
CANVAS = None
PARENT = None
IFACE = None
Expand Down

0 comments on commit 8489bd1

Please sign in to comment.