1 /* 2 * Copyright (c) 2022-2023 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_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_PATH_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_PATH_H 18 19 #include <vector> 20 21 #include "testing_point.h" 22 #include "testing_rect.h" 23 24 namespace OHOS::Ace::Testing { 25 enum class TestingPathDirection { 26 CW_DIRECTION, 27 CCW_DIRECTION, 28 }; 29 30 enum class TestingPathFillType { 31 WINDING, 32 EVENTODD, 33 INVERSE_WINDING, 34 INVERSE_EVENTODD, 35 }; 36 37 enum class TestingPathOp { 38 DIFFERENCE, 39 INTERSECT, 40 UNION, 41 XOR, 42 REVERSE_DIFFERENCE, 43 }; 44 45 class TestingPath { 46 public: 47 TestingPath() = default; 48 virtual ~TestingPath() = default; 49 AddArc(TestingRect oval,float startAngle,float sweepAngle)50 virtual void AddArc(TestingRect oval, float startAngle, float sweepAngle) {} 51 virtual void AddRect(const TestingRect& rect, TestingPathDirection dir = TestingPathDirection::CW_DIRECTION) {} 52 53 virtual void AddRect( 54 float left, float top, float right, float bottom, TestingPathDirection dir = TestingPathDirection::CW_DIRECTION) 55 {} 56 57 virtual void AddRoundRect(const TestingRect& rect, float xRadius, float yRadius, 58 TestingPathDirection dir = TestingPathDirection::CW_DIRECTION) 59 {} 60 MoveTo(float xs,float ys)61 virtual void MoveTo(float xs, float ys) {} LineTo(float xs,float ys)62 virtual void LineTo(float xs, float ys) {} 63 virtual void AddCircle( 64 float dx, float dy, float radius, TestingPathDirection dir = TestingPathDirection::CW_DIRECTION) 65 {} Reset()66 virtual void Reset() {} Close()67 virtual void Close() {} QuadTo(float ctrlPtX,float ctrlPtY,float endPtX,float endPtY)68 virtual void QuadTo(float ctrlPtX, float ctrlPtY, float endPtX, float endPtY) {} ArcTo(float rx,float ry,float angle,TestingPathDirection direction,float endX,float endY)69 virtual void ArcTo(float rx, float ry, float angle, TestingPathDirection direction, float endX, float endY) {} ArcTo(float pt1X,float pt1Y,float pt2X,float pt2Y,float startAngle,float sweepAngle)70 virtual void ArcTo(float pt1X, float pt1Y, float pt2X, float pt2Y, float startAngle, float sweepAngle) {} ArcTo(const TestingPoint & pt1,const TestingPoint & pt2,float startAngle,float sweepAngle)71 virtual void ArcTo(const TestingPoint& pt1, const TestingPoint& pt2, float startAngle, float sweepAngle) {} 72 Offset(float dx,float dy)73 virtual void Offset(float dx, float dy) {} AddPoly(const std::vector<TestingPoint> & points,int count,bool close)74 virtual void AddPoly(const std::vector<TestingPoint>& points, int count, bool close) {} Op(const TestingPath & path1,TestingPath & path2,TestingPathOp op)75 virtual bool Op(const TestingPath& path1, TestingPath& path2, TestingPathOp op) 76 { 77 return true; 78 } 79 GetBounds()80 virtual TestingRect GetBounds() 81 { 82 return {}; 83 } SetFillStyle(TestingPathFillType fillStyle)84 virtual void SetFillStyle(TestingPathFillType fillStyle) {} 85 }; 86 } // namespace OHOS::Ace::Testing 87 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_PATH_H 88