patches: cherry-pick test case fixups from master

Fix up test cases to run correctly once again. It's only the headless ones
we want to (or can) run during build for Debian admittedly, but they do
prove that brushlib is working. Worth having.
debian/rules: run headless tests

Run the headless parts of the upstream test suite, unless nocheck is
present in $DEB_BUILD_OPTIONS.