Skip to content

Commit ab42edc

Browse files
committedDec 28, 2013
[tests] Update composer shape tests
1 parent 3b1f789 commit ab42edc

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed
 

‎tests/src/core/testqgscomposershapes.cpp

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class TestQgsComposerShapes: public QObject
4040
private:
4141
QgsComposition* mComposition;
4242
QgsComposerShape* mComposerShape;
43+
QString mReport;
4344
};
4445

4546
void TestQgsComposerShapes::initTestCase()
@@ -53,11 +54,22 @@ void TestQgsComposerShapes::initTestCase()
5354
mComposerShape = new QgsComposerShape( 20, 20, 150, 100, mComposition );
5455
mComposerShape->setBackgroundColor( QColor::fromRgb( 255, 150, 0 ) );
5556
mComposition->addComposerShape( mComposerShape );
57+
58+
mReport = "<h1>Composer Shape Tests</h1>\n";
5659
}
5760

5861
void TestQgsComposerShapes::cleanupTestCase()
5962
{
6063
delete mComposition;
64+
65+
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
66+
QFile myFile( myReportFile );
67+
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
68+
{
69+
QTextStream myQTextStream( &myFile );
70+
myQTextStream << mReport;
71+
myFile.close();
72+
}
6173
}
6274

6375
void TestQgsComposerShapes::init()
@@ -74,37 +86,33 @@ void TestQgsComposerShapes::rectangle()
7486
{
7587
mComposerShape->setShapeType( QgsComposerShape::Rectangle );
7688

77-
QgsCompositionChecker checker( "Composer shapes", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
78-
"control_images" + QDir::separator() + "expected_composershapes" + QDir::separator() + "composershape_rectangle.png" ) );
79-
QVERIFY( checker.testComposition() );
89+
QgsCompositionChecker checker( "composershapes_rectangle", mComposition );
90+
QVERIFY( checker.testComposition( mReport ) );
8091
}
8192

8293
void TestQgsComposerShapes::triangle()
8394
{
8495
mComposerShape->setShapeType( QgsComposerShape::Triangle );
8596

86-
QgsCompositionChecker checker( "Composer shapes", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
87-
"control_images" + QDir::separator() + "expected_composershapes" + QDir::separator() + "composershape_triangle.png" ) );
88-
QVERIFY( checker.testComposition() );
97+
QgsCompositionChecker checker( "composershapes_triangle", mComposition );
98+
QVERIFY( checker.testComposition( mReport ) );
8999
}
90100

91101
void TestQgsComposerShapes::ellipse()
92102
{
93103
mComposerShape->setShapeType( QgsComposerShape::Ellipse );
94104

95-
QgsCompositionChecker checker( "Composer shapes", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
96-
"control_images" + QDir::separator() + "expected_composershapes" + QDir::separator() + "composershape_ellipse.png" ) );
97-
QVERIFY( checker.testComposition() );
105+
QgsCompositionChecker checker( "composershapes_ellipse", mComposition );
106+
QVERIFY( checker.testComposition( mReport ) );
98107
}
99108

100109
void TestQgsComposerShapes::roundedRectangle()
101110
{
102111
mComposerShape->setShapeType( QgsComposerShape::Rectangle );
103112
mComposerShape->setCornerRadius( 30 );
104113

105-
QgsCompositionChecker checker( "Composer shapes", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
106-
"control_images" + QDir::separator() + "expected_composershapes" + QDir::separator() + "composershape_roundedrectangle.png" ) );
107-
QVERIFY( checker.testComposition() );
114+
QgsCompositionChecker checker( "composershapes_roundedrect", mComposition );
115+
QVERIFY( checker.testComposition( mReport ) );
108116
mComposerShape->setCornerRadius( 0 );
109117
}
110118

0 commit comments

Comments
 (0)
Please sign in to comment.