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