add tests, and travis and coveralls - fixes minor bugs

I added a test-suite. I also fixed some issues where the indices where 1 off, and one bug where the page-padding would be one row of items even if page-padding was set to 0.

I also added travis (continuous integration) and coveralls (code coverage), which will run the test suite on each push and pull request. To enable travis and coveralls on your github repository, see here: http://docs.travis-ci.com/ and for coveralls: https://coveralls.io/docs

(It is already configured and fixed, so you only need to sign in to these two and login with your github account and enable this repository).