-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/*************************************************************************** | ||
testqgscomposerhtml.cpp | ||
----------------------- | ||
begin : August 2012 | ||
copyright : (C) 2012 by Marco Hugentobler | ||
email : marco at sourcepole dot ch | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgscomposerhtml.h" | ||
#include "qgscomposition.h" | ||
#include "qgscompositionchecker.h" | ||
#include <QObject> | ||
#include <QtTest> | ||
|
||
class TestQgsComposerHtml: public QObject | ||
{ | ||
Q_OBJECT; | ||
private slots: | ||
void initTestCase();// will be called before the first testfunction is executed. | ||
void cleanupTestCase();// will be called after the last testfunction was executed. | ||
void init();// will be called before each testfunction is executed. | ||
void cleanup();// will be called after every testfunction. | ||
void table(); //test if rendering of the composition with composr map is correct | ||
|
||
private: | ||
QgsComposition* mComposition; | ||
}; | ||
|
||
void TestQgsComposerHtml::initTestCase() | ||
{ | ||
mComposition = new QgsComposition( 0 ); | ||
mComposition->setPaperSize( 297, 210 ); //A4 landscape | ||
} | ||
|
||
void TestQgsComposerHtml::cleanupTestCase() | ||
{ | ||
delete mComposition; | ||
} | ||
|
||
void TestQgsComposerHtml::init() | ||
{ | ||
|
||
} | ||
|
||
void TestQgsComposerHtml::cleanup() | ||
{ | ||
|
||
} | ||
|
||
void TestQgsComposerHtml::table() | ||
{ | ||
QgsComposerHtml* htmlItem = new QgsComposerHtml( mComposition, 0, 0, 100, 200 ); | ||
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() + | ||
"control_images" + QDir::separator() + "expected_composerhtml" + QDir::separator() + "composerhtml_table.png" ) ); | ||
QVERIFY( checker.testComposition() ); | ||
} | ||
|
||
|
||
QTEST_MAIN( TestQgsComposerHtml ) | ||
#include "moc_testqgscomposerhtml.cxx" |
Binary file added
BIN
+110 KB
tests/testdata/control_images/expected_composerhtml/composerhtml_table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<table border="1" style="font-size:12pt; "> | ||
<tbody> | ||
<tr><td>1 Foo data</td><td>Bar data</td></tr> | ||
<tr><td>2 Foo data</td><td>Bar data</td></tr> | ||
<tr><td>3 Foo data</td><td>Bar data</td></tr> | ||
<tr><td>4 Foo data</td><td>Bar data</td></tr> | ||
<tr><td>5 Foo data</td><td>Bar data</td></tr> | ||
</tbody> | ||
</table> | ||
<table> |