MCPcopy Create free account
hub / github.com/Snapchat/Valdi / loadAsset

Method loadAsset

valdi/test/utils/MockAssetLoaderFactory.cpp:22–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20}
21
22Shared<snap::valdi_core::Cancelable> MockedAssetLoaderWithDownloader::loadAsset(
23 const Value& requestPayload,
24 int32_t preferredWidth,
25 int32_t preferredHeight,
26 const Value& filter,
27 const Ref<AssetLoaderCompletion>& completion) {
28 return downloader->downloadItem(requestPayload.toStringBox(), [completion](auto result) {
29 if (result) {
30 Ref<LoadedAsset> asset = makeShared<StandaloneLoadedAsset>(result.value(), 0, 0);
31 completion->onLoadComplete(asset);
32 } else {
33 completion->onLoadComplete(result.moveError());
34 }
35 });
36}
37
38MockAssetLoaderFactory::MockAssetLoaderFactory(snap::valdi_core::AssetOutputType outputType) : outputType(outputType) {}
39

Callers

nothing calls this directly

Calls 4

valueMethod · 0.65
downloadItemMethod · 0.45
toStringBoxMethod · 0.45
onLoadCompleteMethod · 0.45

Tested by

no test coverage detected