Skip to content
Permalink
Browse files

Followup 71e7aab, add unit tests

  • Loading branch information
nyalldawson committed Aug 8, 2015
1 parent ce0eb2b commit d8da4b8037e1d8b15b0a7670279e5df2bfbe3aa3
Showing with 29 additions and 0 deletions.
  1. +29 −0 tests/src/core/testqgsvectorlayer.cpp
@@ -101,6 +101,9 @@ class TestQgsVectorLayer : public QObject
void QgsVectorLayersetRendererV2();
void QgsVectorLayersetFeatureBlendMode();
void QgsVectorLayersetLayerTransparency();
void uniqueValues();
void minimumValue();
void maximumValue();
};

void TestQgsVectorLayer::initTestCase()
@@ -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.
You can’t perform that action at this time.