• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-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_CLIP_H
17 #define UI_TEST_CLIP_H
18 
19 #include "components/ui_image_view.h"
20 #include "components/ui_label_button.h"
21 #include "components/ui_scroll_view.h"
22 #include "draw/clip_utils.h"
23 #include "ui_test.h"
24 
25 namespace OHOS {
26 constexpr char* UI_TEST_RADIUS_1 = "radius+1";
27 constexpr char* UI_TEST_RADIUS_2 = "radius-1";
28 constexpr char* UI_TEST_RADIUS_3 = "radius+5";
29 constexpr char* UI_TEST_RADIUS_4 = "radius-5";
30 class UITestClip : public UITest, public UIView::OnClickListener {
31 public:
UITestClip()32     UITestClip() {}
~UITestClip()33     ~UITestClip() {}
34     void SetUp() override;
35     void TearDown() override;
36     UIView* GetTestView() override;
37     bool OnClick(UIView& view, const ClickEvent& event) override;
38 
39     void UIKitClipTest001();
40     void UIKitClipTest002();
41     void UIKitClipTest003();
42     void UIKitClipTest004();
43     void UIKitClipTest005();
44 
45 private:
46     const static int32_t BUFFER_SIZE = 20;
47     const static int16_t GAP = 10;
48     const static int16_t TITLE_HEIGHT = 29;
49     const static uint16_t BLOCK_WIDTH = 454;
50     const static uint16_t BLOCK_HEIGHT = 200;
51     const static uint16_t IMAGE_POSITION_X = 20;
52     const static uint16_t IMAGE_POSITION_Y = 20;
53     const static int16_t ANGLE_STEP = 5;
54     const static int16_t RADIUS_STEP_1 = 1;
55     const static int16_t RADIUS_STEP_5 = 5;
56 
57     void CreateTitleLabel(const char* title);
58     UIImageView* CreateImageView();
59     void ClipImage(UIImageView* imageView, ClipPath& path);
60     void SetUpButton(UILabelButton* btn, const char* title, int16_t x, int16_t y, const char* id = nullptr);
61 
62     UILabelButton* btnRadiusInc1_ = nullptr;
63     UILabelButton* btnRadiusInc5_ = nullptr;
64     UILabelButton* btnRadiusDec1_ = nullptr;
65     UILabelButton* btnRadiusDec5_ = nullptr;
66     UILabelButton* btnStartAngleInc_ = nullptr;
67     UILabelButton* btnStartAngleDec_ = nullptr;
68     UILabelButton* btnEndAngleInc_ = nullptr;
69     UILabelButton* btnEndAngleDec_ = nullptr;
70     UILabel* radiusText_ = nullptr;
71     UIImageView* imageView1_ = nullptr;
72     UIImageView* imageView2_ = nullptr;
73     UIScrollView* container_ = nullptr;
74 };
75 } // namespace OHOS
76 #endif
77