@@ -40,6 +40,7 @@ class TestQgsComposerShapes: public QObject
40
40
private:
41
41
QgsComposition* mComposition ;
42
42
QgsComposerShape* mComposerShape ;
43
+ QString mReport ;
43
44
};
44
45
45
46
void TestQgsComposerShapes::initTestCase ()
@@ -53,11 +54,22 @@ void TestQgsComposerShapes::initTestCase()
53
54
mComposerShape = new QgsComposerShape ( 20 , 20 , 150 , 100 , mComposition );
54
55
mComposerShape ->setBackgroundColor ( QColor::fromRgb ( 255 , 150 , 0 ) );
55
56
mComposition ->addComposerShape ( mComposerShape );
57
+
58
+ mReport = " <h1>Composer Shape Tests</h1>\n " ;
56
59
}
57
60
58
61
void TestQgsComposerShapes::cleanupTestCase ()
59
62
{
60
63
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
+ }
61
73
}
62
74
63
75
void TestQgsComposerShapes::init ()
@@ -74,37 +86,33 @@ void TestQgsComposerShapes::rectangle()
74
86
{
75
87
mComposerShape ->setShapeType ( QgsComposerShape::Rectangle );
76
88
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 ) );
80
91
}
81
92
82
93
void TestQgsComposerShapes::triangle ()
83
94
{
84
95
mComposerShape ->setShapeType ( QgsComposerShape::Triangle );
85
96
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 ) );
89
99
}
90
100
91
101
void TestQgsComposerShapes::ellipse ()
92
102
{
93
103
mComposerShape ->setShapeType ( QgsComposerShape::Ellipse );
94
104
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 ) );
98
107
}
99
108
100
109
void TestQgsComposerShapes::roundedRectangle ()
101
110
{
102
111
mComposerShape ->setShapeType ( QgsComposerShape::Rectangle );
103
112
mComposerShape ->setCornerRadius ( 30 );
104
113
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 ) );
108
116
mComposerShape ->setCornerRadius ( 0 );
109
117
}
110
118
0 commit comments