Skip to content
Permalink
Browse files

Add equality operator for QgsProcessingFeatureSourceDefinition

  • Loading branch information
nyalldawson committed Jul 6, 2017
1 parent 3601138 commit 3cbcd75d2fabeac810af523aaa88cfa541187629
@@ -45,6 +45,12 @@ class QgsProcessingFeatureSourceDefinition
True if only selected features in the source should be used by algorithms.
%End

bool operator==( const QgsProcessingFeatureSourceDefinition &other );

bool operator!=( const QgsProcessingFeatureSourceDefinition &other );
%Docstring
:rtype: bool
%End

operator QVariant() const;
%Docstring
@@ -72,6 +72,15 @@ class CORE_EXPORT QgsProcessingFeatureSourceDefinition
*/
bool selectedFeaturesOnly;

bool operator==( const QgsProcessingFeatureSourceDefinition &other )
{
return source == other.source && selectedFeaturesOnly == other.selectedFeaturesOnly;
}

bool operator!=( const QgsProcessingFeatureSourceDefinition &other )
{
return !( *this == other );
}

//! Allows direct construction of QVariants.
operator QVariant() const
@@ -932,6 +932,10 @@ void TestQgsProcessing::features()
ids = getIds( source->getFeatures() );
QVERIFY( !encountered );

// equality operator
QVERIFY( QgsProcessingFeatureSourceDefinition( layer->id(), true ) == QgsProcessingFeatureSourceDefinition( layer->id(), true ) );
QVERIFY( QgsProcessingFeatureSourceDefinition( layer->id(), true ) != QgsProcessingFeatureSourceDefinition( "b", true ) );
QVERIFY( QgsProcessingFeatureSourceDefinition( layer->id(), true ) != QgsProcessingFeatureSourceDefinition( layer->id(), false ) );
}

void TestQgsProcessing::uniqueValues()

0 comments on commit 3cbcd75

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