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 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_RECT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_RECT_H 18 19 namespace OHOS::Ace::Testing { 20 class TestingRect { 21 public: 22 TestingRect() = default; 23 virtual ~TestingRect() = default; 24 25 TestingRect(const TestingRect& rect) = default; 26 TestingRect(const float left,const float top,const float right,const float bottom)27 TestingRect(const float left, const float top, const float right, const float bottom) 28 : left_(left), right_(right), top_(top), bottom_(bottom) 29 {} 30 IsValid()31 virtual bool IsValid() const 32 { 33 return true; 34 } 35 GetLeft()36 virtual float GetLeft() const 37 { 38 return left_; 39 } 40 GetTop()41 virtual float GetTop() const 42 { 43 return top_; 44 } 45 GetRight()46 virtual float GetRight() const 47 { 48 return right_; 49 } 50 GetBottom()51 virtual float GetBottom() const 52 { 53 return bottom_; 54 } 55 GetWidth()56 virtual float GetWidth() const 57 { 58 return left_ - right_; 59 } 60 GetHeight()61 virtual float GetHeight() const 62 { 63 return bottom_ - top_; 64 } 65 SetLeft(float pos)66 virtual void SetLeft(float pos) {} SetTop(float pos)67 virtual void SetTop(float pos) {} SetRight(float pos)68 virtual void SetRight(float pos) {} SetBottom(float pos)69 virtual void SetBottom(float pos) {} Offset(float dx,float dy)70 virtual void Offset(float dx, float dy) {} 71 Join(const TestingRect & other)72 bool Join(const TestingRect& other) 73 { 74 return true; 75 } 76 77 private: 78 float left_; 79 float right_; 80 float top_; 81 float bottom_; 82 }; 83 84 } // namespace OHOS::Ace::Testing 85 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_MOCK_ROSEN_TEST_TESTING_RECT_H 86