1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEST_UNITTEST_THEME_THEME_MOCK_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEST_UNITTEST_THEME_THEME_MOCK_H 18 19 #include "core/components/theme/resource_adapter.h" 20 21 namespace OHOS::Ace { 22 23 class ResourceAdapterMock : public virtual ResourceAdapter { 24 DECLARE_ACE_TYPE(ResourceAdapterMock, ResourceAdapter); 25 26 public: 27 ResourceAdapterMock(); 28 ~ResourceAdapterMock() override = default; 29 30 void Initialize(); 31 32 RefPtr<ThemeStyle> GetTheme(int32_t themeId) override; 33 34 Color GetColor(uint32_t resId) override; 35 Dimension GetDimension(uint32_t resId) override; 36 std::string GetString(uint32_t resId) override; 37 std::vector<std::string> GetStringArray(uint32_t resId) const override; 38 double GetDouble(uint32_t resId) override; 39 int32_t GetInt(uint32_t resId) override; 40 41 Color GetColorByName(const std::string& resName) override; 42 Dimension GetDimensionByName(const std::string& resName) override; 43 std::string GetStringByName(const std::string& resName) override; 44 std::vector<std::string> GetStringArrayByName(const std::string& resName) const override; 45 double GetDoubleByName(const std::string& resName) override; 46 int32_t GetIntByName(const std::string& resName) override; 47 std::string GetMediaPathByName(const std::string& resName) override; 48 std::vector<uint32_t> GetIntArrayByName(const std::string& resName) const override; 49 50 private: 51 ACE_DISALLOW_COPY_AND_MOVE(ResourceAdapterMock); 52 }; 53 54 } // namespace OHOS::Ace 55 56 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_TEST_UNITTEST_THEME_THEME_MOCK_H 57