Fix Quadtree tests

Ever since my earlier refactoring, the Quadtree tests have been broken.
Fix this by re-templatizing Quadtree, since the unit tests rely on this
functionality.

Fixes #2768.