Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Follow up 6a17a60 - Fix error when passing usesgeometry to qgsfunction
  • Loading branch information
NathanW2 committed Jan 10, 2015
1 parent c8d8748 commit d9042f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 1 addition & 2 deletions python/core/__init__.py
Expand Up @@ -84,6 +84,5 @@ def add(values, *args):
"""

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
10 changes: 9 additions & 1 deletion tests/src/python/test_qgsexpression.py
Expand Up @@ -31,6 +31,10 @@ def special(values, feature, parent):
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')

Expand Down Expand Up @@ -79,6 +83,10 @@ def testCantOverrideBuiltinsWithRegister(self):
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)
Expand All @@ -98,7 +106,7 @@ def testBlockComment(self):
expressions = {
"'test' /* comment */": 'test',
"/* comment */'test'": 'test',
"/* comment */'test*/'": 'test*/',
"/* comment */'test*/'": 'test*/',
"/** comment */'test*/'": 'test*/',
"/* comment **/'test*/' /* comment */": 'test*/',
"'test/*'/* comment */": 'test/*',
Expand Down

0 comments on commit d9042f5

Please sign in to comment.