1 /* 2 * Copyright (c) 2024 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 TEST_UNITTEST_CORE_PIPELINE_PIPELINE_CONTEXT_TEST_NG_H 17 #define TEST_UNITTEST_CORE_PIPELINE_PIPELINE_CONTEXT_TEST_NG_H 18 19 #include "gtest/gtest.h" 20 21 #define private public 22 #define protected public 23 #include "common_constants.h" 24 #include "mock_schedule_task.h" 25 #include "test/mock/core/common/mock_font_manager.h" 26 #include "test/mock/core/common/mock_frontend.h" 27 28 #include "core/pipeline_ng/pipeline_context.h" 29 30 namespace OHOS::Ace { 31 namespace NG { 32 namespace { 33 constexpr int32_t DEFAULT_INSTANCE_ID = 0; 34 constexpr int32_t DEFAULT_INT0 = 0; 35 constexpr int32_t DEFAULT_INT1 = 1; 36 constexpr int32_t DEFAULT_INT3 = 3; 37 constexpr int32_t DEFAULT_INT10 = 10; 38 constexpr int32_t DEFAULT_RESTORE_ID0 = 100; 39 constexpr int32_t DEFAULT_RESTORE_ID1 = 101; 40 constexpr int32_t DEFAULT_RESTORE_ID2 = 102; 41 constexpr int32_t NOT_REGISTER_ID = 307; 42 constexpr uint32_t DEFAULT_SIZE1 = 1; 43 constexpr uint32_t DEFAULT_SIZE2 = 2; 44 constexpr uint32_t DEFAULT_SIZE3 = 3; 45 constexpr uint32_t FRAME_COUNT = 10; 46 constexpr uint64_t NANO_TIME_STAMP = 10; 47 constexpr uint64_t DEFAULT_UINT64_1 = 39; 48 constexpr uint64_t DEFAULT_UINT64_2 = 41; 49 constexpr double DEFAULT_DOUBLE0 = 0.0; 50 constexpr double DEFAULT_DOUBLE1 = 1.0; 51 constexpr double DEFAULT_DOUBLE2 = 2.0; 52 constexpr double DEFAULT_DOUBLE4 = 4.0; 53 constexpr int32_t CLOSE_BUTTON_INDEX = 5; 54 const std::string TEST_TAG("test"); 55 const std::string ACCESS_TAG("-accessibility"); 56 const std::string TEST_FORM_INFO("test_info"); 57 const int64_t RENDER_EVENT_ID = 10; 58 constexpr int32_t EXCEPTIONAL_CURSOR = 99; 59 constexpr int8_t RENDERINGMODE_FULL_COLOR = 0; 60 constexpr int8_t RENDERINGMODE_SINGLE_COLOR = 1; 61 } // namespace 62 63 class PipelineContextTestNg : public testing::Test { 64 public: 65 static void ResetEventFlag(int32_t testFlag); 66 67 static bool GetEventFlag(int32_t testFlag); 68 69 static void SetUpTestSuite(); 70 71 static void TearDownTestSuite(); 72 73 static void CreateCycleDirtyNode(int cycle, bool& flagUpdate); 74 75 private: 76 static ElementIdType frameNodeId_; 77 static ElementIdType customNodeId_; 78 static RefPtr<FrameNode> frameNode_; 79 static RefPtr<CustomNode> customNode_; 80 static RefPtr<PipelineContext> context_; 81 }; 82 } // namespace NG 83 } // namespace OHOS::Ace 84 #endif // TEST_UNITTEST_CORE_PIPELINE_PIPELINE_CONTEXT_TEST_NG_H