Skip to content

Commit 09ab569

Browse files
committedNov 19, 2014
Boost coverage of raster fill unit tests
Also add missing sip bindings for GUI widget
1 parent 3c2d45f commit 09ab569

File tree

8 files changed

+72
-4
lines changed

8 files changed

+72
-4
lines changed
 

‎python/gui/symbology-ng/qgssymbollayerv2widget.sip

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,24 @@ class QgsSvgMarkerSymbolLayerV2Widget : QgsSymbolLayerV2Widget
253253
void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer );
254254
};
255255

256+
///////////
257+
258+
class QgsRasterFillSymbolLayerWidget : QgsSymbolLayerV2Widget
259+
{
260+
%TypeHeaderCode
261+
#include <qgssymbollayerv2widget.h>
262+
%End
263+
264+
public:
265+
QgsRasterFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
266+
267+
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) /Factory/;
268+
269+
// from base class
270+
virtual void setSymbolLayer( QgsSymbolLayerV2* layer );
271+
virtual QgsSymbolLayerV2* symbolLayer();
272+
273+
};
256274

257275
///////////
258276

‎tests/src/core/testqgsrasterfill.cpp

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@ class TestQgsRasterFill: public QObject
4545
private slots:
4646
void initTestCase();// will be called before the first testfunction is executed.
4747
void cleanupTestCase();// will be called after the last testfunction was executed.
48-
void init() {};// will be called before each testfunction is executed.
49-
void cleanup() {};// will be called after every testfunction.
48+
void init(); // will be called before each testfunction is executed.
49+
void cleanup();// will be called after every testfunction.
5050

5151
void rasterFillSymbol();
52+
void coordinateMode();
53+
void alpha();
54+
void offset();
55+
void width();
5256

5357
private:
5458
bool mTestHasError;
@@ -119,15 +123,61 @@ void TestQgsRasterFill::cleanupTestCase()
119123
}
120124
}
121125

122-
void TestQgsRasterFill::rasterFillSymbol()
126+
void TestQgsRasterFill::init()
123127
{
124-
mReport += "<h2>Raster fill symbol renderer test</h2>\n";
125128
mRasterFill->setImageFilePath( mTestDataDir + QString( "sample_image.png" ) );
126129
mRasterFill->setWidth( 30.0 );
130+
mRasterFill->setWidthUnit( QgsSymbolV2::Pixel );
131+
mRasterFill->setCoordinateMode( QgsRasterFillSymbolLayer::Feature );
132+
mRasterFill->setAlpha( 1.0 );
133+
mRasterFill->setOffset( QPointF( 0, 0 ) );
134+
}
135+
136+
void TestQgsRasterFill::cleanup()
137+
{
138+
139+
}
140+
141+
void TestQgsRasterFill::rasterFillSymbol()
142+
{
143+
mReport += "<h2>Raster fill symbol renderer test</h2>\n";
127144
bool result = imageCheck( "rasterfill" );
128145
QVERIFY( result );
129146
}
130147

148+
void TestQgsRasterFill::coordinateMode()
149+
{
150+
mReport += "<h2>Raster fill viewport mode</h2>\n";
151+
mRasterFill->setCoordinateMode( QgsRasterFillSymbolLayer::Viewport );
152+
bool result = imageCheck( "rasterfill_viewport" );
153+
QVERIFY( result );
154+
}
155+
156+
void TestQgsRasterFill::alpha()
157+
{
158+
mReport += "<h2>Raster fill alpha</h2>\n";
159+
mRasterFill->setAlpha( 0.5 );
160+
bool result = imageCheck( "rasterfill_alpha" );
161+
QVERIFY( result );
162+
}
163+
164+
void TestQgsRasterFill::offset()
165+
{
166+
mReport += "<h2>Raster fill offset</h2>\n";
167+
mRasterFill->setOffset( QPointF( 5, 10 ) );;
168+
bool result = imageCheck( "rasterfill_offset" );
169+
QVERIFY( result );
170+
}
171+
172+
void TestQgsRasterFill::width()
173+
{
174+
mReport += "<h2>Raster fill width</h2>\n";
175+
mRasterFill->setWidthUnit( QgsSymbolV2::MM );
176+
mRasterFill->setWidth( 5.0 );
177+
bool result = imageCheck( "rasterfill_width" );
178+
QVERIFY( result );
179+
}
180+
131181
//
132182
// Private helper functions not called directly by CTest
133183
//
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.