Skip to content
Permalink
Browse files

Add some missing tests for QgsImageOperation

  • Loading branch information
nyalldawson committed Jan 27, 2015
1 parent 6dd42ca commit e0adf89d8011429fc8bce9ad895212ee1d192fc1
@@ -64,6 +64,7 @@ class TestQgsImageOperation : public QObject
void distanceTransformMaxDist();
void distanceTransformSetSpread();
void distanceTransformInterior();
void distanceTransformMisc();

//stack blur
void stackBlur();
@@ -73,6 +74,7 @@ class TestQgsImageOperation : public QObject
//gaussian blur
void gaussianBlur();
void gaussianBlurSmall();
void gaussianBlurNoChange();

//flip
void flipHorizontal();
@@ -322,6 +324,31 @@ void TestQgsImageOperation::distanceTransformInterior()
QVERIFY( result );
}

void TestQgsImageOperation::distanceTransformMisc()
{
//no ramp
QImage image( mSampleImage );
QgsImageOperation::DistanceTransformProperties props;
props.useMaxDistance = true;
props.ramp = NULL;
props.shadeExterior = false;
QgsImageOperation::distanceTransform( image, props );
bool result = imageCheck( QString( "imageop_nochange" ), image, 0 );
QVERIFY( result );

//zero spread
QImage image2( mSampleImage );
QgsImageOperation::DistanceTransformProperties props2;
QgsVectorGradientColorRampV2 ramp;
props2.useMaxDistance = false;
props2.spread = 0;
props2.ramp = &ramp;
props2.shadeExterior = false;
QgsImageOperation::distanceTransform( image2, props2 );
result = imageCheck( QString( "imageop_zerospread" ), image2, 0 );
QVERIFY( result );
}

void TestQgsImageOperation::stackBlur()
{
QImage image( mSampleImage );
@@ -386,6 +413,16 @@ void TestQgsImageOperation::gaussianBlurSmall()
QVERIFY( result );
}

void TestQgsImageOperation::gaussianBlurNoChange()
{
QImage image( mSampleImage );
QImage* blurredImage = QgsImageOperation::gaussianBlur( image, 0 );

bool result = imageCheck( QString( "imageop_nochange" ), *blurredImage, 0 );
delete blurredImage;
QVERIFY( result );
}

void TestQgsImageOperation::flipHorizontal()
{
QImage image( mSampleImage );
Binary file not shown.
Binary file not shown.

0 comments on commit e0adf89

Please sign in to comment.
You can’t perform that action at this time.