Boost coverage of raster fill unit tests

Also add missing sip bindings for GUI widget
This commit is contained in:
Nyall Dawson 2014-11-19 20:15:41 +11:00
parent 3c2d45ffd7
commit 09ab5696b1
8 changed files with 72 additions and 4 deletions

View File

@ -253,6 +253,24 @@ class QgsSvgMarkerSymbolLayerV2Widget : QgsSymbolLayerV2Widget
void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer );
};
///////////
class QgsRasterFillSymbolLayerWidget : QgsSymbolLayerV2Widget
{
%TypeHeaderCode
#include <qgssymbollayerv2widget.h>
%End
public:
QgsRasterFillSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent = NULL );
static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) /Factory/;
// from base class
virtual void setSymbolLayer( QgsSymbolLayerV2* layer );
virtual QgsSymbolLayerV2* symbolLayer();
};
///////////

View File

@ -45,10 +45,14 @@ class TestQgsRasterFill: public QObject
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 init(); // will be called before each testfunction is executed.
void cleanup();// will be called after every testfunction.
void rasterFillSymbol();
void coordinateMode();
void alpha();
void offset();
void width();
private:
bool mTestHasError;
@ -119,15 +123,61 @@ void TestQgsRasterFill::cleanupTestCase()
}
}
void TestQgsRasterFill::init()
{
mRasterFill->setImageFilePath( mTestDataDir + QString( "sample_image.png" ) );
mRasterFill->setWidth( 30.0 );
mRasterFill->setWidthUnit( QgsSymbolV2::Pixel );
mRasterFill->setCoordinateMode( QgsRasterFillSymbolLayer::Feature );
mRasterFill->setAlpha( 1.0 );
mRasterFill->setOffset( QPointF( 0, 0 ) );
}
void TestQgsRasterFill::cleanup()
{
}
void TestQgsRasterFill::rasterFillSymbol()
{
mReport += "<h2>Raster fill symbol renderer test</h2>\n";
mRasterFill->setImageFilePath( mTestDataDir + QString( "sample_image.png" ) );
mRasterFill->setWidth( 30.0 );
bool result = imageCheck( "rasterfill" );
QVERIFY( result );
}
void TestQgsRasterFill::coordinateMode()
{
mReport += "<h2>Raster fill viewport mode</h2>\n";
mRasterFill->setCoordinateMode( QgsRasterFillSymbolLayer::Viewport );
bool result = imageCheck( "rasterfill_viewport" );
QVERIFY( result );
}
void TestQgsRasterFill::alpha()
{
mReport += "<h2>Raster fill alpha</h2>\n";
mRasterFill->setAlpha( 0.5 );
bool result = imageCheck( "rasterfill_alpha" );
QVERIFY( result );
}
void TestQgsRasterFill::offset()
{
mReport += "<h2>Raster fill offset</h2>\n";
mRasterFill->setOffset( QPointF( 5, 10 ) );;
bool result = imageCheck( "rasterfill_offset" );
QVERIFY( result );
}
void TestQgsRasterFill::width()
{
mReport += "<h2>Raster fill width</h2>\n";
mRasterFill->setWidthUnit( QgsSymbolV2::MM );
mRasterFill->setWidth( 5.0 );
bool result = imageCheck( "rasterfill_width" );
QVERIFY( result );
}
//
// Private helper functions not called directly by CTest
//

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB