mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Boost coverage of raster fill unit tests
Also add missing sip bindings for GUI widget
This commit is contained in:
parent
3c2d45ffd7
commit
09ab5696b1
@ -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();
|
||||
|
||||
};
|
||||
|
||||
///////////
|
||||
|
||||
|
@ -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
|
||||
//
|
||||
|
BIN
tests/testdata/control_images/expected_rasterfill_alpha/default/expected_rasterfill_alpha.png
vendored
Normal file
BIN
tests/testdata/control_images/expected_rasterfill_alpha/default/expected_rasterfill_alpha.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
BIN
tests/testdata/control_images/expected_rasterfill_offset/default/expected_rasterfill_offset.png
vendored
Normal file
BIN
tests/testdata/control_images/expected_rasterfill_offset/default/expected_rasterfill_offset.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
BIN
tests/testdata/control_images/expected_rasterfill_offset/precise/expected_rasterfill_offset.png
vendored
Normal file
BIN
tests/testdata/control_images/expected_rasterfill_offset/precise/expected_rasterfill_offset.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
BIN
tests/testdata/control_images/expected_rasterfill_viewport/default/expected_rasterfill_viewport.png
vendored
Normal file
BIN
tests/testdata/control_images/expected_rasterfill_viewport/default/expected_rasterfill_viewport.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
BIN
tests/testdata/control_images/expected_rasterfill_width/default/expected_rasterfill_width.png
vendored
Normal file
BIN
tests/testdata/control_images/expected_rasterfill_width/default/expected_rasterfill_width.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 626 KiB |
BIN
tests/testdata/control_images/expected_rasterfill_width/precise/expected_rasterfill_width.png
vendored
Normal file
BIN
tests/testdata/control_images/expected_rasterfill_width/precise/expected_rasterfill_width.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
Loading…
x
Reference in New Issue
Block a user