'Register a custom template test, available application wide.  Like
:meth:`Flask.add_template_test` but for a blueprint.  Works exactly
like the :meth:`app_template_test` decorator.
.. versionadded:: 0.10
:param name: the optional name of the test, otherwise the
function name will be used.'

def add_app_template_test(self, f, name=None):

    def register_template(state):
        state.app.jinja_env.tests[(name or f.__name__)] = f
    self.record_once(register_template)
