From: Eunki Hong Date: Thu, 7 Jul 2022 04:46:03 +0000 (+0000) Subject: Merge "Fix RemoteSVG UTC failed due to the proxy block (2)" into devel/master X-Git-Tag: dali_2.1.30~5 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=dc218b02943379a5fa00bc3fed964e9233bf0e0a;hp=6ec9962e44d7f8c761f62ad2be3f684c319e94e8 Merge "Fix RemoteSVG UTC failed due to the proxy block (2)" into devel/master --- diff --git a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-image-renderer.cpp b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-image-renderer.cpp index 3093fcb..78252b8 100644 --- a/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-image-renderer.cpp +++ b/automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-vector-image-renderer.cpp @@ -34,7 +34,38 @@ namespace Adaptor namespace { Dali::Internal::Adaptor::VectorImageRenderer* gVectorImageRenderer = nullptr; + +/** + * @brief Check whether the data contain keyword as substring or not. + * It can be used as Naive Check-up to determine vector image loaded successfully or not. + * + * @param[in] data Raw data + * @param[in] keyword Keyword to check data holded or not. + * @return True if data contain keyword. + */ +bool CheckKeywordExist(const Vector& data, std::string keyword) +{ + std::string trimedString; + + // Remove useless character in data. + for(const uint8_t& it : data) + { + if(keyword.find(it) != std::string::npos) + { + trimedString.push_back(it); + } + } + + if(trimedString.length() >= keyword.length()) + { + if(trimedString.find(keyword) != std::string::npos) + { + return true; + } + } + return false; } +} // namespace class VectorImageRenderer : public Dali::BaseObject { @@ -58,6 +89,11 @@ public: { mRasterizeSuccess = false; } + // Naive check-up whether data is valid format or not. Currently we only check svg and tvg file format. + else if(!CheckKeywordExist(data, "") && !CheckKeywordExist(data, "ThorVG")) + { + return false; + } mLoadSuccess = true; return true; }