mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
Fix #4441
This commit is contained in:
parent
d165e307bc
commit
6996946a85
@ -301,7 +301,7 @@ class CORE_EXPORT QgsExpression
|
||||
virtual QVariant eval( QgsExpression* parent, QgsFeature* f );
|
||||
virtual QString dump() const;
|
||||
virtual QStringList referencedColumns() const { QStringList lst; if ( !mArgs ) return lst; foreach( Node* n, mArgs->list() ) lst.append( n->referencedColumns() ); return lst; }
|
||||
virtual bool needsGeometry() const { return BuiltinFunctions[mFnIndex].mUsesGeometry; }
|
||||
virtual bool needsGeometry() const { bool needs = BuiltinFunctions[mFnIndex].mUsesGeometry; if ( mArgs ) { foreach( Node* n, mArgs->list() ) needs |= n->needsGeometry(); } return needs; }
|
||||
protected:
|
||||
//QString mName;
|
||||
int mFnIndex;
|
||||
|
@ -341,9 +341,16 @@ class TestQgsExpression: public QObject
|
||||
QTest::addColumn<bool>( "needsGeom" );
|
||||
|
||||
// literal evaluation
|
||||
QTest::newRow( "geom 1" ) << "x > 0" << false;
|
||||
QTest::newRow( "geom 2" ) << "$x > 0" << true;
|
||||
QTest::newRow( "geom 2" ) << "xat(0) > 0" << true;
|
||||
QTest::newRow( "x > 0" ) << "x > 0" << false;
|
||||
QTest::newRow( "1 = 1" ) << "1 = 1" << false;
|
||||
QTest::newRow( "$x > 0" ) << "$x > 0" << true;
|
||||
QTest::newRow( "xat(0) > 0" ) << "xat(0) > 0" << true;
|
||||
QTest::newRow( "$x" ) << "$x" << true;
|
||||
QTest::newRow( "$area" ) << "$area" << true;
|
||||
QTest::newRow( "$length" ) << "$length" << true;
|
||||
QTest::newRow( "$perimeter" ) << "$perimeter" << true;
|
||||
QTest::newRow( "toint($perimeter)" ) << "toint($perimeter)" << true;
|
||||
QTest::newRow( "toint(123)" ) << "toint(123)" << false;
|
||||
}
|
||||
|
||||
void needs_geometry()
|
||||
|
Loading…
x
Reference in New Issue
Block a user