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 FOUNDATION_ACE_TEST_UNITTEST_CORE_PATTERN_SCROLL_BAR_SCROLL_BAR_TEST_NG_H 17 #define FOUNDATION_ACE_TEST_UNITTEST_CORE_PATTERN_SCROLL_BAR_SCROLL_BAR_TEST_NG_H 18 19 #include "test/unittest/core/pattern/test_ng.h" 20 21 #define private public 22 #define protected public 23 #include "core/components_ng/pattern/scroll/scroll_pattern.h" 24 #include "core/components_ng/pattern/scroll_bar/scroll_bar_pattern.h" 25 26 namespace OHOS::Ace::NG { 27 using namespace testing; 28 using namespace testing::ext; 29 constexpr float SCROLL_WIDTH = 480.f; 30 constexpr float SCROLL_HEIGHT = 800.f; 31 constexpr float CONTENT_MAIN_SIZE = 1000.f; 32 constexpr float SCROLL_BAR_CHILD_WIDTH = 20.f; 33 constexpr float SCROLL_BAR_CHILD_HEIGHT = 160.f; 34 35 class ScrollBarTestNg : public TestNG { 36 public: 37 static void SetUpTestSuite(); 38 static void TearDownTestSuite(); 39 void SetUp() override; 40 void TearDown() override; 41 void GetScrollBar(); 42 43 RefPtr<FrameNode> CreateMainFrameNode(); 44 void CreateStack(Alignment align = Alignment::CENTER_RIGHT); 45 void CreateScroll(float mainSize = CONTENT_MAIN_SIZE, Axis axis = Axis::VERTICAL); 46 void CreateContent(float mainSize = CONTENT_MAIN_SIZE, Axis axis = Axis::VERTICAL); 47 void CreateScrollBar(bool infoflag, bool proxyFlag, Axis axis, DisplayMode displayMode); 48 void CreateScrollBarChild(float mainSize = SCROLL_BAR_CHILD_HEIGHT); 49 void SetScrollContentMainSize(float mainSize); 50 51 RefPtr<FrameNode> stackNode_; 52 53 RefPtr<FrameNode> scrollNode_; 54 RefPtr<ScrollPattern> scrollPattern_; 55 56 RefPtr<FrameNode> frameNode_; 57 RefPtr<ScrollBarPattern> pattern_; 58 RefPtr<ScrollBarLayoutProperty> layoutProperty_; 59 RefPtr<ScrollablePaintProperty> paintProperty_; 60 RefPtr<ScrollBarAccessibilityProperty> accessibilityProperty_; 61 }; 62 } // namespace OHOS::Ace::NG 63 64 #endif // FOUNDATION_ACE_TEST_UNITTEST_CORE_PATTERN_SCROLL_BAR_SCROLL_BAR_TEST_NG_H 65