mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Follow up 6a17a60ae2 - Fix error when passing usesgeometry to qgsfunction
This commit is contained in:
parent
c8d874889f
commit
d9042f590f
@ -84,6 +84,5 @@ def qgsfunction(args, group, **kwargs):
|
||||
"""
|
||||
|
||||
def wrapper(func):
|
||||
usesgeometry = kwargs.get('usesgeometry', False)
|
||||
return register_function(func, args, group, usesgeometry, **kwargs)
|
||||
return register_function(func, args, group, **kwargs)
|
||||
return wrapper
|
||||
|
@ -31,6 +31,10 @@ class TestQgsExpressionCustomFunctions(TestCase):
|
||||
def sqrt(values, feature, parent):
|
||||
pass
|
||||
|
||||
@qgsfunction(1, 'testing', register=False, usesgeometry=True)
|
||||
def geomtest(values, feature, parent):
|
||||
pass
|
||||
|
||||
def tearDown(self):
|
||||
QgsExpression.unregisterFunction('testfun')
|
||||
|
||||
@ -79,6 +83,10 @@ class TestQgsExpressionCustomFunctions(TestCase):
|
||||
success = QgsExpression.registerFunction(self.sqrt)
|
||||
self.assertFalse(success)
|
||||
|
||||
def testCanRegisterGeometryFunction(self):
|
||||
success = QgsExpression.registerFunction(self.geomtest)
|
||||
self.assertTrue(success)
|
||||
|
||||
def testCantOverrideBuiltinsWithUnregister(self):
|
||||
success = QgsExpression.unregisterFunction("sqrt")
|
||||
self.assertFalse(success)
|
||||
@ -98,7 +106,7 @@ class TestQgsExpressionCustomFunctions(TestCase):
|
||||
expressions = {
|
||||
"'test' /* comment */": 'test',
|
||||
"/* comment */'test'": 'test',
|
||||
"/* comment */'test*/'": 'test*/',
|
||||
"/* comment */'test*/'": 'test*/',
|
||||
"/** comment */'test*/'": 'test*/',
|
||||
"/* comment **/'test*/' /* comment */": 'test*/',
|
||||
"'test/*'/* comment */": 'test/*',
|
||||
|
Loading…
x
Reference in New Issue
Block a user