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 uint64_t AFTER_VSYNC_TIME = 1500; 50 constexpr uint64_t BEFORE_VSYNC_TIME = 500; 51 constexpr uint64_t DEFAULT_VSYNC_TIME = 1000; 52 constexpr double DEFAULT_DOUBLE0 = 0.0; 53 constexpr double DEFAULT_DOUBLE1 = 1.0; 54 constexpr double DEFAULT_DOUBLE2 = 2.0; 55 constexpr double DEFAULT_DOUBLE4 = 4.0; 56 constexpr int32_t CLOSE_BUTTON_INDEX = 5; 57 const std::string TEST_TAG("test"); 58 const std::string ACCESS_TAG("-accessibility"); 59 const std::string TEST_FORM_INFO("test_info"); 60 const int64_t RENDER_EVENT_ID = 10; 61 constexpr int32_t EXCEPTIONAL_CURSOR = 99; 62 constexpr int8_t RENDERINGMODE_FULL_COLOR = 0; 63 constexpr int8_t RENDERINGMODE_SINGLE_COLOR = 1; 64 constexpr uint32_t AI_CALL_SUCCESS = 0; 65 constexpr uint32_t AI_CALLER_INVALID = 1; 66 constexpr uint32_t AI_CALL_FUNCNAME_INVALID = 2; 67 constexpr uint32_t AI_CALL_NODE_INVALID = 3; 68 constexpr uint32_t AI_CALL_ENV_INVALID = 4; 69 } // namespace 70 71 class PipelineContextTestNg : public testing::Test { 72 public: 73 static void ResetEventFlag(int32_t testFlag); 74 75 static bool GetEventFlag(int32_t testFlag); 76 77 static void SetUpTestSuite(); 78 79 static void TearDownTestSuite(); 80 81 static void CreateCycleDirtyNode(int cycle, bool& flagUpdate); 82 83 private: 84 static ElementIdType frameNodeId_; 85 static ElementIdType customNodeId_; 86 static RefPtr<FrameNode> frameNode_; 87 static RefPtr<CustomNode> customNode_; 88 static RefPtr<PipelineContext> context_; 89 }; 90 } // namespace NG 91 } // namespace OHOS::Ace 92 #endif // TEST_UNITTEST_CORE_PIPELINE_PIPELINE_CONTEXT_TEST_NG_H