Add some tests

And fix a bug of contour plugin