1 /* 2 * Copyright (c) 2022 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 UI_TEST_COMMON_H 17 #define UI_TEST_COMMON_H 18 19 #include "engines/gfx/soft_engine.h" 20 #include "macros_updater.h" 21 22 class TestGraphicEngine : public OHOS::SoftEngine { 23 DISALLOW_COPY_MOVE(TestGraphicEngine); 24 public: 25 TestGraphicEngine() = default; 26 virtual ~TestGraphicEngine() = default; GetInstance()27 static TestGraphicEngine &GetInstance() 28 { 29 static TestGraphicEngine instance; 30 static bool isRegister = false; 31 if (!isRegister) { 32 OHOS::SoftEngine::InitGfxEngine(&instance); 33 isRegister = true; 34 } 35 return instance; 36 } Flush(const OHOS::Rect & flushRect)37 void Flush(const OHOS::Rect& flushRect) override {} GetFBBufferInfo()38 OHOS::BufferInfo *GetFBBufferInfo() override 39 { 40 return nullptr; 41 } GetScreenWidth()42 uint16_t GetScreenWidth() override 43 { 44 return 1000u; 45 } GetScreenHeight()46 uint16_t GetScreenHeight() override 47 { 48 return 1000u; 49 } 50 }; 51 52 #endif