Only require QtTest if needed

Fixe upstream part of https://bugs.gentoo.org/show_bug.cgi?id=507086