1 /*
2  * Copyright (c) 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 #include <array>
17 
18 #include "gtest/gtest.h"
19 #include "include/core/SkCanvas.h"
20 
21 #include "core/components_ng/base/frame_node.h"
22 #include "core/components_ng/pattern/shape/shape_abstract_model_ng.h"
23 
24 namespace OHOS::Ace::NG {
25 
26 class BaseShapePatternTestNg : public testing::Test {
27 public:
28     BaseShapePatternTestNg() = default;
29     void CheckSize(bool hasValue);
30     void CheckFill(bool hasValue);
31     void CheckFillOpacity(bool hasValue);
32     void CheckStroke(bool hasValue);
33     void CheckStrokeWidth(bool hasValue);
34     void CheckStrokeOpacity(bool hasValue);
35     void CheckStrokeDashArray(bool hasValue);
36     void CheckStrokeDashOffset(bool hasValue);
37     void CheckStrokeLineCap(bool hasValue);
38     void CheckStrokeLineJoin(bool hasValue);
39     void CheckStrokeMiterLimit(bool hasValue);
40     void CheckAntiAlias(bool hasValue);
41     void SetSize(ShapeAbstractModelNG& shapeAbstractModelNG) const;
42     virtual RefPtr<FrameNode> CreadFrameNode();
43     virtual void Draw(RefPtr<FrameNode> frameNode);
44     ~BaseShapePatternTestNg() = default;
45 
46     static constexpr float WIDTH = 200.0f;
47     static constexpr float HEIGHT = 300.0f;
48     static constexpr float OPACITY = 0.5f;
49     static constexpr float STROKE_WIDTH = 3.0f;
50     static constexpr bool ANTIALIAS = false;
51     static constexpr float STROKE_LIMIT = 5.0f;
52     static constexpr float DASHOFFSET = 3;
53     static constexpr int32_t LINE_JOIN = 1;
54     static constexpr int32_t LINE_CAP = 1;
55     static constexpr std::array<float, 2> STROKE_DASH_ARRAY = { 3, 5 };
56 };
57 
58 } // namespace OHOS::Ace::NG