mirror of
https://github.com/sebastiandine/Card-Collection-Manager-3.git
synced 2026-08-28 17:01:02 +00:00
patch: Feature/pkm autodetect (#15)
This commit is contained in:
@@ -17,6 +17,20 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class AutoDetectPreviewSource final : public ICardPreviewSource {
|
||||
public:
|
||||
[[nodiscard]] bool supportsAutoDetectPrint() const noexcept override {
|
||||
return true;
|
||||
}
|
||||
|
||||
Result<std::string, PreviewLookupError>
|
||||
fetchImageUrl(std::string_view,
|
||||
std::string_view,
|
||||
std::string_view) override {
|
||||
return Result<std::string, PreviewLookupError>::ok("https://example.test/card.png");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_SUITE("ICardPreviewSource defaults") {
|
||||
@@ -25,6 +39,11 @@ TEST_SUITE("ICardPreviewSource defaults") {
|
||||
CHECK_FALSE(src.supportsAutoDetectPrint());
|
||||
}
|
||||
|
||||
TEST_CASE("implementations may override supportsAutoDetectPrint") {
|
||||
AutoDetectPreviewSource src;
|
||||
CHECK(src.supportsAutoDetectPrint());
|
||||
}
|
||||
|
||||
TEST_CASE("default detectFirstPrint returns explicit unsupported error") {
|
||||
MinimalPreviewSource src;
|
||||
const auto out = src.detectFirstPrint("Card", "Set");
|
||||
|
||||
Reference in New Issue
Block a user