Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Followup 71e7aab, add unit tests
  • Loading branch information
nyalldawson committed Aug 8, 2015
1 parent ce0eb2b commit d8da4b8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/src/core/testqgsvectorlayer.cpp
Expand Up @@ -101,6 +101,9 @@ class TestQgsVectorLayer : public QObject
void QgsVectorLayersetRendererV2();
void QgsVectorLayersetFeatureBlendMode();
void QgsVectorLayersetLayerTransparency();
void uniqueValues();
void minimumValue();
void maximumValue();
};

void TestQgsVectorLayer::initTestCase()
Expand Down Expand Up @@ -312,5 +315,31 @@ void TestQgsVectorLayer::QgsVectorLayersetLayerTransparency()
QCOMPARE( vLayer->layerTransparency(), 50 );
}

void TestQgsVectorLayer::uniqueValues()
{
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );

//test with invalid field
QList<QVariant> values;
vLayer->uniqueValues( 1000, values );
QCOMPARE( values.length(), 0 );
}

void TestQgsVectorLayer::minimumValue()
{
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );

//test with invalid field
QCOMPARE( vLayer->minimumValue( 1000 ), QVariant() );
}

void TestQgsVectorLayer::maximumValue()
{
QgsVectorLayer* vLayer = static_cast< QgsVectorLayer * >( mpPointsLayer );

//test with invalid field
QCOMPARE( vLayer->maximumValue( 1000 ), QVariant() );
}

QTEST_MAIN( TestQgsVectorLayer )
#include "testqgsvectorlayer.moc"

0 comments on commit d8da4b8

Please sign in to comment.