• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-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_CANVAS_H
17 #define UI_TEST_CANVAS_H
18 
19 #include "components/ui_canvas.h"
20 #include "components/ui_label_button.h"
21 #include "components/ui_scroll_view.h"
22 #include "layout/grid_layout.h"
23 #include "ui_test.h"
24 
25 namespace OHOS {
26 class UITestCanvas : public UITest {
27 public:
UITestCanvas()28     UITestCanvas() {}
~UITestCanvas()29     ~UITestCanvas() {}
30     void SetUp() override;
31     void TearDown() override;
32     const UIView* GetTestView() override;
33 
34     void UIKitCanvasTestDrawLine001();
35     void UIKitCanvasTestDrawLine002();
36     void UIKitCanvasTestDrawCurve001();
37     void UIKitCanvasTestDrawCurve002();
38     void UIKitCanvasTestDrawRect001();
39     void UIKitCanvasTestDrawRect002();
40     void UIKitCanvasTestDrawRect003();
41     void UIKitCanvasTestDrawCircle001();
42     void UIKitCanvasTestDrawCircle002();
43     void UIKitCanvasTestDrawCircle003();
44     void UIKitCanvasTestDrawArc001();
45     void UIKitCanvasTestDrawImage001();
46     void UIKitCanvasTestDrawLabel001();
47     void UIKitCanvasTestDrawSector001();
48     void UIKitCanvasTestClear001();
49     void UIKitCanvasTestDrawPath001();
50     void UIKitCanvasTestDrawPath002();
51     void UIKitCanvasTestDrawPath003();
52     void UIKitCanvasTestDrawPath004();
53     void UIKitCanvasTestDrawPath005();
54     void UIKitCanvasTestDrawPath006();
55     void UIKitCanvasTestDrawPath007();
56     void UIKitCanvasTestDrawPath008();
57     void UIKitCanvasTestDrawPath009();
58     void UIKitCanvasTestDrawPath010();
59     void UIKitCanvasTestDrawPath011();
60     void UIKitCanvasTestDrawPath012();
61     void UIKitCanvasTestDrawPath013();
62     void UIKitCanvasTestDrawPath014();
63     void UIKitCanvasTestDrawPath015();
64     void UIKitCanvasTestDrawPath016();
65     void UIKitCanvasTestDrawPath017();
66     void UIKitCanvasTestDrawPath018();
67     void UIKitCanvasTestDrawPath019();
68     void UIKitCanvasTestDrawPath020();
69     void UIKitCanvasTestDrawPath021();
70     void UIKitCanvasTestDrawPath022();
71     void UIKitCanvasTestDrawPath023();
72     void UIKitCanvasTestDrawPath024();
73     void UIKitCanvasTestDrawPath025();
74     void UIKitCanvasTestDrawPath026();
75     void UIKitCanvasTestDrawPath027();
76     void UIKitCanvasTestDrawPath028();
77     void UIKitCanvasTestDrawPath029();
78     void UIKitCanvasTestDrawPath030();
79     void UIKitCanvasTestDrawPath031();
80     void UIKitCanvasTestDrawPath032();
81     void UIKitCanvasTestDrawPath033();
82     void UIKitCanvasTestDrawPath034();
83 
84 private:
85     const static int16_t GAP = 10;
86     const static int16_t TITLE_HEIGHT = 29;
87     const static uint16_t CANVAS_WIDTH = 454;
88     const static uint16_t CANVAS_HEIGHT = 200;
89 
90     static constexpr int16_t START1_X = 10;
91     static constexpr int16_t START1_Y = 10;
92     static constexpr int16_t START2_X = 80;
93     static constexpr int16_t START2_Y = 10;
94     static constexpr int16_t LINE1_X = 40;
95     static constexpr int16_t LINE1_Y = 100;
96     static constexpr int16_t LINE2_X = 100;
97     static constexpr int16_t LINE2_Y = 120;
98     static constexpr int16_t CENTER_X = 150;
99     static constexpr int16_t CENTER_Y = 150;
100     static constexpr int16_t RADIUS = 50;
101     static constexpr int16_t START_ANGLE = 30;
102     static constexpr int16_t END_ANGLE = 250;
103     static constexpr int16_t RECT_X = 250;
104     static constexpr int16_t RECT_Y = 50;
105     static constexpr int16_t RECT_WIDTH = 100;
106     static constexpr int16_t RECT_HEIGHT = 50;
107     void CreateTitleLabel(const char* title);
108     UICanvas* CreateCanvas();
109 
110     UIScrollView* container_ = nullptr;
111 };
112 } // namespace OHOS
113 #endif // UI_TEST_CANVAS_H
114