Fix linking tests with MSVC

If the class is already exported from the library we cannot add the
.cpp file to the test again - MSVC then complains that the symbol is
exported twice (once from the test and once from the library that the
test is linked against)
2 jobs for master in 53 minutes and 42 seconds (queued for 666 minutes and 15 seconds)
Status Job ID Name Coverage
  Build
passed #76138
build_clazy_clang_tidy

00:30:39

passed #76137
linux kf5-qt5 qt5.12

00:23:02

25.0%