1f6603c60Sopenharmony_ci/* 2f6603c60Sopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3f6603c60Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4f6603c60Sopenharmony_ci * you may not use this file except in compliance with the License. 5f6603c60Sopenharmony_ci * You may obtain a copy of the License at 6f6603c60Sopenharmony_ci * 7f6603c60Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8f6603c60Sopenharmony_ci * 9f6603c60Sopenharmony_ci * Unless required by applicable law or agreed to in writing, Hardware 10f6603c60Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11f6603c60Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12f6603c60Sopenharmony_ci * See the License for the specific language governing permissions and 13f6603c60Sopenharmony_ci * limitations under the License. 14f6603c60Sopenharmony_ci */ 15f6603c60Sopenharmony_ci 16f6603c60Sopenharmony_ci#include <cstdio> 17f6603c60Sopenharmony_ci#include "gtest/gtest.h" 18f6603c60Sopenharmony_ci 19f6603c60Sopenharmony_ci#include "drawing_path.h" 20f6603c60Sopenharmony_ci#include "drawing_matrix.h" 21f6603c60Sopenharmony_ci#include "drawing_rect.h" 22f6603c60Sopenharmony_ci#include "drawing_round_rect.h" 23f6603c60Sopenharmony_ci#include "draw/path.h" 24f6603c60Sopenharmony_ci#include "utils/scalar.h" 25f6603c60Sopenharmony_ci 26f6603c60Sopenharmony_ciusing namespace testing; 27f6603c60Sopenharmony_ciusing namespace testing::ext; 28f6603c60Sopenharmony_ci 29f6603c60Sopenharmony_cinamespace OHOS { 30f6603c60Sopenharmony_cinamespace Rosen { 31f6603c60Sopenharmony_cinamespace Drawing { 32f6603c60Sopenharmony_ciclass NativeDrawingPathTest : public testing::Test { 33f6603c60Sopenharmony_cipublic: 34f6603c60Sopenharmony_ci static void SetUpTestCase(); 35f6603c60Sopenharmony_ci static void TearDownTestCase(); 36f6603c60Sopenharmony_ci void SetUp() override; 37f6603c60Sopenharmony_ci void TearDown() override; 38f6603c60Sopenharmony_ci}; 39f6603c60Sopenharmony_ci 40f6603c60Sopenharmony_civoid NativeDrawingPathTest::SetUpTestCase() {} 41f6603c60Sopenharmony_civoid NativeDrawingPathTest::TearDownTestCase() {} 42f6603c60Sopenharmony_civoid NativeDrawingPathTest::SetUp() {} 43f6603c60Sopenharmony_civoid NativeDrawingPathTest::TearDown() {} 44f6603c60Sopenharmony_ci 45f6603c60Sopenharmony_ci/* 46f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathCreate001 47f6603c60Sopenharmony_ci * @tc.desc: test for create drawing_path. 48f6603c60Sopenharmony_ci * @tc.size : MediumTest 49f6603c60Sopenharmony_ci * @tc.type : Function 50f6603c60Sopenharmony_ci * @tc.level : Level 1 51f6603c60Sopenharmony_ci */ 52f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathCreate001, TestSize.Level1) 53f6603c60Sopenharmony_ci{ 54f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 55f6603c60Sopenharmony_ci EXPECT_EQ(path == nullptr, false); 56f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 57f6603c60Sopenharmony_ci} 58f6603c60Sopenharmony_ci 59f6603c60Sopenharmony_ci/* 60f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathMoveTo002 61f6603c60Sopenharmony_ci * @tc.desc: test for PathMoveTo func. 62f6603c60Sopenharmony_ci * @tc.size : MediumTest 63f6603c60Sopenharmony_ci * @tc.type : Function 64f6603c60Sopenharmony_ci * @tc.level : Level 1 65f6603c60Sopenharmony_ci */ 66f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathMoveTo002, TestSize.Level1) 67f6603c60Sopenharmony_ci{ 68f6603c60Sopenharmony_ci OH_Drawing_Path* path1 = OH_Drawing_PathCreate(); 69f6603c60Sopenharmony_ci OH_Drawing_PathMoveTo(path1, 20, 20); 70f6603c60Sopenharmony_ci OH_Drawing_PathMoveTo(path1, -1, 20.6f); 71f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path1); 72f6603c60Sopenharmony_ci} 73f6603c60Sopenharmony_ci 74f6603c60Sopenharmony_ci/* 75f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathLineTo003 76f6603c60Sopenharmony_ci * @tc.desc: test for PathLineTo func. 77f6603c60Sopenharmony_ci * @tc.size : MediumTest 78f6603c60Sopenharmony_ci * @tc.type : Function 79f6603c60Sopenharmony_ci * @tc.level : Level 1 80f6603c60Sopenharmony_ci */ 81f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathLineTo003, TestSize.Level1) 82f6603c60Sopenharmony_ci{ 83f6603c60Sopenharmony_ci OH_Drawing_Path* path2 = OH_Drawing_PathCreate(); 84f6603c60Sopenharmony_ci OH_Drawing_PathLineTo(path2, 50, 40); 85f6603c60Sopenharmony_ci OH_Drawing_PathLineTo(path2, -50, 10.2f); 86f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path2); 87f6603c60Sopenharmony_ci} 88f6603c60Sopenharmony_ci 89f6603c60Sopenharmony_ci/* 90f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathReset004 91f6603c60Sopenharmony_ci * @tc.desc: test for PathReset func. 92f6603c60Sopenharmony_ci * @tc.size : MediumTest 93f6603c60Sopenharmony_ci * @tc.type : Function 94f6603c60Sopenharmony_ci * @tc.level : Level 1 95f6603c60Sopenharmony_ci */ 96f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathReset004, TestSize.Level1) 97f6603c60Sopenharmony_ci{ 98f6603c60Sopenharmony_ci OH_Drawing_Path* path3 = OH_Drawing_PathCreate(); 99f6603c60Sopenharmony_ci OH_Drawing_PathMoveTo(path3, 20, 20); 100f6603c60Sopenharmony_ci OH_Drawing_PathReset(path3); 101f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path3); 102f6603c60Sopenharmony_ci} 103f6603c60Sopenharmony_ci 104f6603c60Sopenharmony_ci/* 105f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathArcTo005 106f6603c60Sopenharmony_ci * @tc.desc: test for PathArcTo func. 107f6603c60Sopenharmony_ci * @tc.size : MediumTest 108f6603c60Sopenharmony_ci * @tc.type : Function 109f6603c60Sopenharmony_ci * @tc.level : Level 1 110f6603c60Sopenharmony_ci */ 111f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathArcTo005, TestSize.Level1) 112f6603c60Sopenharmony_ci{ 113f6603c60Sopenharmony_ci OH_Drawing_Path* path4 = OH_Drawing_PathCreate(); 114f6603c60Sopenharmony_ci OH_Drawing_PathArcTo(path4, 10, 10, 20, 0, 0, 90); 115f6603c60Sopenharmony_ci OH_Drawing_PathArcTo(path4, -10, 10, 10, -10, 0, 90); 116f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path4); 117f6603c60Sopenharmony_ci} 118f6603c60Sopenharmony_ci 119f6603c60Sopenharmony_ci/* 120f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathQuadTo006 121f6603c60Sopenharmony_ci * @tc.desc: test for PathQuadTo func. 122f6603c60Sopenharmony_ci * @tc.size : MediumTest 123f6603c60Sopenharmony_ci * @tc.type : Function 124f6603c60Sopenharmony_ci * @tc.level : Level 1 125f6603c60Sopenharmony_ci */ 126f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathQuadTo006, TestSize.Level1) 127f6603c60Sopenharmony_ci{ 128f6603c60Sopenharmony_ci OH_Drawing_Path* path5 = OH_Drawing_PathCreate(); 129f6603c60Sopenharmony_ci OH_Drawing_PathQuadTo(path5, 0, 0, 30, 30); 130f6603c60Sopenharmony_ci OH_Drawing_PathQuadTo(path5, -20.5f, -20.5f, 30, 0); 131f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path5); 132f6603c60Sopenharmony_ci} 133f6603c60Sopenharmony_ci 134f6603c60Sopenharmony_ci/* 135f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathCubicTo007 136f6603c60Sopenharmony_ci * @tc.desc: test for PathCubicTo func. 137f6603c60Sopenharmony_ci * @tc.size : MediumTest 138f6603c60Sopenharmony_ci * @tc.type : Function 139f6603c60Sopenharmony_ci * @tc.level : Level 1 140f6603c60Sopenharmony_ci */ 141f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathCubicTo007, TestSize.Level1) 142f6603c60Sopenharmony_ci{ 143f6603c60Sopenharmony_ci OH_Drawing_Path* path6 = OH_Drawing_PathCreate(); 144f6603c60Sopenharmony_ci OH_Drawing_PathCubicTo(path6, 30, 40, 60, 0, 50, 20); 145f6603c60Sopenharmony_ci OH_Drawing_PathCubicTo(path6, -30, 40, 60, -30.6f, 50, -20); 146f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path6); 147f6603c60Sopenharmony_ci} 148f6603c60Sopenharmony_ci 149f6603c60Sopenharmony_ci/* 150f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathClose008 151f6603c60Sopenharmony_ci * @tc.desc: test for PathClose func. 152f6603c60Sopenharmony_ci * @tc.size : MediumTest 153f6603c60Sopenharmony_ci * @tc.type : Function 154f6603c60Sopenharmony_ci * @tc.level : Level 1 155f6603c60Sopenharmony_ci */ 156f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathClose008, TestSize.Level1) 157f6603c60Sopenharmony_ci{ 158f6603c60Sopenharmony_ci OH_Drawing_Path* path7 = OH_Drawing_PathCreate(); 159f6603c60Sopenharmony_ci OH_Drawing_PathLineTo(path7, 50, 40); 160f6603c60Sopenharmony_ci OH_Drawing_PathClose(path7); 161f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path7); 162f6603c60Sopenharmony_ci} 163f6603c60Sopenharmony_ci 164f6603c60Sopenharmony_ci/* 165f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathCopy009 166f6603c60Sopenharmony_ci * @tc.desc: test for PathCopy func. 167f6603c60Sopenharmony_ci * @tc.size : MediumTest 168f6603c60Sopenharmony_ci * @tc.type : Function 169f6603c60Sopenharmony_ci * @tc.level : Level 1 170f6603c60Sopenharmony_ci */ 171f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathCopy009, TestSize.Level1) 172f6603c60Sopenharmony_ci{ 173f6603c60Sopenharmony_ci OH_Drawing_Path* path7 = OH_Drawing_PathCreate(); 174f6603c60Sopenharmony_ci OH_Drawing_PathLineTo(path7, 50, 40); 175f6603c60Sopenharmony_ci OH_Drawing_PathClose(path7); 176f6603c60Sopenharmony_ci EXPECT_EQ(OH_Drawing_PathCopy(nullptr), nullptr); 177f6603c60Sopenharmony_ci OH_Drawing_Path* pathCopy = OH_Drawing_PathCopy(path7); 178f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(pathCopy)->GetBounds().GetWidth(), 50.0)); 179f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(pathCopy)->GetBounds().GetHeight(), 40.0)); 180f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path7); 181f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(pathCopy); 182f6603c60Sopenharmony_ci} 183f6603c60Sopenharmony_ci 184f6603c60Sopenharmony_ci/* 185f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathAddRect010 186f6603c60Sopenharmony_ci * @tc.desc: test for PathAddRect func. 187f6603c60Sopenharmony_ci * @tc.size : MediumTest 188f6603c60Sopenharmony_ci * @tc.type : Function 189f6603c60Sopenharmony_ci * @tc.level : Level 1 190f6603c60Sopenharmony_ci */ 191f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddRect010, TestSize.Level1) 192f6603c60Sopenharmony_ci{ 193f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 194f6603c60Sopenharmony_ci OH_Drawing_PathAddRect(nullptr, 50, 50, 250, 250, OH_Drawing_PathDirection::PATH_DIRECTION_CW); 195f6603c60Sopenharmony_ci OH_Drawing_PathAddRect(path, 50, 50, 250, 250, OH_Drawing_PathDirection::PATH_DIRECTION_CW); 196f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetWidth(), 200.0)); 197f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetHeight(), 200.0)); 198f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 199f6603c60Sopenharmony_ci} 200f6603c60Sopenharmony_ci 201f6603c60Sopenharmony_ci/* 202f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathAddRoundRect011 203f6603c60Sopenharmony_ci * @tc.desc: test for PathAddRoundRect func. 204f6603c60Sopenharmony_ci * @tc.size : MediumTest 205f6603c60Sopenharmony_ci * @tc.type : Function 206f6603c60Sopenharmony_ci * @tc.level : Level 1 207f6603c60Sopenharmony_ci */ 208f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddRoundRect011, TestSize.Level1) 209f6603c60Sopenharmony_ci{ 210f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 211f6603c60Sopenharmony_ci OH_Drawing_PathAddRect(nullptr, 50, 50, 250, 250, OH_Drawing_PathDirection::PATH_DIRECTION_CW); 212f6603c60Sopenharmony_ci OH_Drawing_Rect* rect = OH_Drawing_RectCreate(50, 50, 250, 250); 213f6603c60Sopenharmony_ci OH_Drawing_RoundRect* roundRect = OH_Drawing_RoundRectCreate(rect, 20, 20); 214f6603c60Sopenharmony_ci OH_Drawing_PathAddRoundRect(path, roundRect, OH_Drawing_PathDirection::PATH_DIRECTION_CW); 215f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetWidth(), 200.0)); 216f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetHeight(), 200.0)); 217f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 218f6603c60Sopenharmony_ci OH_Drawing_RoundRectDestroy(roundRect); 219f6603c60Sopenharmony_ci OH_Drawing_RectDestroy(rect); 220f6603c60Sopenharmony_ci} 221f6603c60Sopenharmony_ci 222f6603c60Sopenharmony_ci/* 223f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathAddArc012 224f6603c60Sopenharmony_ci * @tc.desc: test for PathAddArc func. 225f6603c60Sopenharmony_ci * @tc.size : MediumTest 226f6603c60Sopenharmony_ci * @tc.type : Function 227f6603c60Sopenharmony_ci * @tc.level : Level 1 228f6603c60Sopenharmony_ci */ 229f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddArc012, TestSize.Level1) 230f6603c60Sopenharmony_ci{ 231f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 232f6603c60Sopenharmony_ci OH_Drawing_Rect* rect = OH_Drawing_RectCreate(50, 50, 250, 250); 233f6603c60Sopenharmony_ci OH_Drawing_PathAddArc(nullptr, rect, 0, 180); 234f6603c60Sopenharmony_ci OH_Drawing_PathAddArc(path, nullptr, 0, 180); 235f6603c60Sopenharmony_ci OH_Drawing_PathAddArc(path, rect, 0, 180); 236f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetWidth(), 200.0)); 237f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetHeight(), 100.0)); 238f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 239f6603c60Sopenharmony_ci OH_Drawing_RectDestroy(rect); 240f6603c60Sopenharmony_ci} 241f6603c60Sopenharmony_ci 242f6603c60Sopenharmony_ci/* 243f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathContains013 244f6603c60Sopenharmony_ci * @tc.desc: test for PathContains func. 245f6603c60Sopenharmony_ci * @tc.size : MediumTest 246f6603c60Sopenharmony_ci * @tc.type : Function 247f6603c60Sopenharmony_ci * @tc.level : Level 1 248f6603c60Sopenharmony_ci */ 249f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathContains013, TestSize.Level1) 250f6603c60Sopenharmony_ci{ 251f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 252f6603c60Sopenharmony_ci OH_Drawing_PathAddRect(path, 50, 50, 250, 250, OH_Drawing_PathDirection::PATH_DIRECTION_CW); 253f6603c60Sopenharmony_ci OH_Drawing_PathContains(nullptr, 0, 0); 254f6603c60Sopenharmony_ci bool ret = OH_Drawing_PathContains(path, 0, 0); 255f6603c60Sopenharmony_ci EXPECT_EQ(ret, false); 256f6603c60Sopenharmony_ci ret = OH_Drawing_PathContains(path, 60, 60); 257f6603c60Sopenharmony_ci EXPECT_EQ(ret, true); 258f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 259f6603c60Sopenharmony_ci} 260f6603c60Sopenharmony_ci 261f6603c60Sopenharmony_ci/* 262f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathTransform014 263f6603c60Sopenharmony_ci * @tc.desc: test for PathTransform func. 264f6603c60Sopenharmony_ci * @tc.size : MediumTest 265f6603c60Sopenharmony_ci * @tc.type : Function 266f6603c60Sopenharmony_ci * @tc.level : Level 1 267f6603c60Sopenharmony_ci */ 268f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathTransform014, TestSize.Level1) 269f6603c60Sopenharmony_ci{ 270f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 271f6603c60Sopenharmony_ci OH_Drawing_PathAddRect(path, 50, 50, 250, 250, OH_Drawing_PathDirection::PATH_DIRECTION_CW); 272f6603c60Sopenharmony_ci OH_Drawing_Matrix* matrix = OH_Drawing_MatrixCreateTranslation(1, 1); 273f6603c60Sopenharmony_ci OH_Drawing_PathTransform(nullptr, matrix); 274f6603c60Sopenharmony_ci OH_Drawing_PathTransform(path, nullptr); 275f6603c60Sopenharmony_ci 276f6603c60Sopenharmony_ci bool ret = OH_Drawing_PathContains(path, 50, 50); 277f6603c60Sopenharmony_ci EXPECT_EQ(ret, true); 278f6603c60Sopenharmony_ci OH_Drawing_PathTransform(path, matrix); 279f6603c60Sopenharmony_ci ret = OH_Drawing_PathContains(path, 50, 50); 280f6603c60Sopenharmony_ci EXPECT_EQ(ret, false); 281f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 282f6603c60Sopenharmony_ci} 283f6603c60Sopenharmony_ci 284f6603c60Sopenharmony_ci/* 285f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathSetFilltype015 286f6603c60Sopenharmony_ci * @tc.desc: test for PathSetFillType func. 287f6603c60Sopenharmony_ci * @tc.size : MediumTest 288f6603c60Sopenharmony_ci * @tc.type : Function 289f6603c60Sopenharmony_ci * @tc.level : Level 1 290f6603c60Sopenharmony_ci */ 291f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathSetFilltype015, TestSize.Level1) 292f6603c60Sopenharmony_ci{ 293f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 294f6603c60Sopenharmony_ci OH_Drawing_PathSetFillType(nullptr, PATH_FILL_TYPE_WINDING); 295f6603c60Sopenharmony_ci OH_Drawing_PathSetFillType(path, PATH_FILL_TYPE_WINDING); 296f6603c60Sopenharmony_ci 297f6603c60Sopenharmony_ci OH_Drawing_PathLineTo(path, 50, 40); 298f6603c60Sopenharmony_ci OH_Drawing_PathClose(path); 299f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetWidth(), 50.0)); 300f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetHeight(), 40.0)); 301f6603c60Sopenharmony_ci float ret = OH_Drawing_PathGetLength(path, true); 302f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(ret, 128.062485)); // 128.062485 is length of path 303f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 304f6603c60Sopenharmony_ci} 305f6603c60Sopenharmony_ci/* 306f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathConicTo016 307f6603c60Sopenharmony_ci * @tc.desc: test for PathConicTo func. 308f6603c60Sopenharmony_ci * @tc.size : MediumTest 309f6603c60Sopenharmony_ci * @tc.type : Function 310f6603c60Sopenharmony_ci * @tc.level : Level 1 311f6603c60Sopenharmony_ci */ 312f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathConicTo016, TestSize.Level1) 313f6603c60Sopenharmony_ci{ 314f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 315f6603c60Sopenharmony_ci OH_Drawing_PathConicTo(path, 0, 0, 30, 30, 1); 316f6603c60Sopenharmony_ci OH_Drawing_PathConicTo(path, -20.5f, -20.5f, 30, 0, 1); 317f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetWidth(), 50.5)); 318f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetHeight(), 50.5)); 319f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 320f6603c60Sopenharmony_ci} 321f6603c60Sopenharmony_ci 322f6603c60Sopenharmony_ci/* 323f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathAddRectWithInitialCorner017 324f6603c60Sopenharmony_ci * @tc.desc: test for PathAddRectWithInitialCorner func. 325f6603c60Sopenharmony_ci * @tc.size : MediumTest 326f6603c60Sopenharmony_ci * @tc.type : Function 327f6603c60Sopenharmony_ci * @tc.level : Level 1 328f6603c60Sopenharmony_ci */ 329f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddRectWithInitialCorner017, TestSize.Level1) 330f6603c60Sopenharmony_ci{ 331f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 332f6603c60Sopenharmony_ci OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 200.0f, 300.0f); 333f6603c60Sopenharmony_ci OH_Drawing_PathAddRectWithInitialCorner(path, rect, PATH_DIRECTION_CW, 0); 334f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetWidth(), 200.0)); 335f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetHeight(), 300.0)); 336f6603c60Sopenharmony_ci OH_Drawing_PathClose(path); 337f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 338f6603c60Sopenharmony_ci OH_Drawing_RectDestroy(rect); 339f6603c60Sopenharmony_ci} 340f6603c60Sopenharmony_ci 341f6603c60Sopenharmony_ci/* 342f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathAddPathWithMode018 343f6603c60Sopenharmony_ci * @tc.desc: test for PathAddPathWithMode func. 344f6603c60Sopenharmony_ci * @tc.size : MediumTest 345f6603c60Sopenharmony_ci * @tc.type : Function 346f6603c60Sopenharmony_ci * @tc.level : Level 1 347f6603c60Sopenharmony_ci */ 348f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddPathWithMode018, TestSize.Level1) 349f6603c60Sopenharmony_ci{ 350f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 351f6603c60Sopenharmony_ci OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 200.0f, 300.0f); 352f6603c60Sopenharmony_ci OH_Drawing_PathAddRectWithInitialCorner(path, rect, PATH_DIRECTION_CW, 0); 353f6603c60Sopenharmony_ci OH_Drawing_Path* path2 = OH_Drawing_PathCreate(); 354f6603c60Sopenharmony_ci OH_Drawing_PathAddPathWithMode(path2, path, PATH_ADD_MODE_APPEND); 355f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path2)->GetBounds().GetWidth(), 200.0)); 356f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path2)->GetBounds().GetHeight(), 300.0)); 357f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 358f6603c60Sopenharmony_ci OH_Drawing_RectDestroy(rect); 359f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path2); 360f6603c60Sopenharmony_ci} 361f6603c60Sopenharmony_ci 362f6603c60Sopenharmony_ci/* 363f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathAddPathWithOffsetAndMode019 364f6603c60Sopenharmony_ci * @tc.desc: test for PathAddPathWithOffsetAndMode func. 365f6603c60Sopenharmony_ci * @tc.size : MediumTest 366f6603c60Sopenharmony_ci * @tc.type : Function 367f6603c60Sopenharmony_ci * @tc.level : Level 1 368f6603c60Sopenharmony_ci */ 369f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddPathWithOffsetAndMode019, TestSize.Level1) 370f6603c60Sopenharmony_ci{ 371f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 372f6603c60Sopenharmony_ci OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 200.0f, 300.0f); 373f6603c60Sopenharmony_ci OH_Drawing_PathAddRectWithInitialCorner(path, rect, PATH_DIRECTION_CW, 0); 374f6603c60Sopenharmony_ci OH_Drawing_Path* path2 = OH_Drawing_PathCreate(); 375f6603c60Sopenharmony_ci OH_Drawing_PathAddPathWithOffsetAndMode(path2, path, 0, 0, PATH_ADD_MODE_APPEND); 376f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path2)->GetBounds().GetWidth(), 200.0)); 377f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path2)->GetBounds().GetHeight(), 300.0)); 378f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 379f6603c60Sopenharmony_ci OH_Drawing_RectDestroy(rect); 380f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path2); 381f6603c60Sopenharmony_ci} 382f6603c60Sopenharmony_ci 383f6603c60Sopenharmony_ci/* 384f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathAddPathWithMatrixAndMode020 385f6603c60Sopenharmony_ci * @tc.desc: test for PathAddPathWithMatrixAndMode func. 386f6603c60Sopenharmony_ci * @tc.size : MediumTest 387f6603c60Sopenharmony_ci * @tc.type : Function 388f6603c60Sopenharmony_ci * @tc.level : Level 1 389f6603c60Sopenharmony_ci */ 390f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddPathWithMatrixAndMode020, TestSize.Level1) 391f6603c60Sopenharmony_ci{ 392f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 393f6603c60Sopenharmony_ci OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0.0f, 0.0f, 200.0f, 300.0f); 394f6603c60Sopenharmony_ci OH_Drawing_PathAddRectWithInitialCorner(path, rect, PATH_DIRECTION_CW, 0); 395f6603c60Sopenharmony_ci OH_Drawing_Path* path2 = OH_Drawing_PathCreate(); 396f6603c60Sopenharmony_ci OH_Drawing_Matrix* matrix = OH_Drawing_MatrixCreate(); 397f6603c60Sopenharmony_ci 398f6603c60Sopenharmony_ci OH_Drawing_PathAddPathWithMatrixAndMode(path2, path, matrix, PATH_ADD_MODE_APPEND); 399f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path2)->GetBounds().GetWidth(), 200.0)); 400f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path2)->GetBounds().GetHeight(), 300.0)); 401f6603c60Sopenharmony_ci 402f6603c60Sopenharmony_ci OH_Drawing_Path* pathRect = OH_Drawing_PathCreate(); 403f6603c60Sopenharmony_ci OH_Drawing_PathAddRect(pathRect, 0.0f, 0.0f, 200.0f, 300.0f, OH_Drawing_PathDirection::PATH_DIRECTION_CW); 404f6603c60Sopenharmony_ci OH_Drawing_MatrixSetMatrix( 405f6603c60Sopenharmony_ci matrix, 406f6603c60Sopenharmony_ci 5, 4, 0, 407f6603c60Sopenharmony_ci 0, -1, 0, 408f6603c60Sopenharmony_ci 0, 0, 1); 409f6603c60Sopenharmony_ci OH_Drawing_PathAddPath(pathRect, pathRect, nullptr); 410f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(pathRect)->GetBounds().GetWidth(), 200.0)); 411f6603c60Sopenharmony_ci OH_Drawing_PathAddPath(pathRect, pathRect, matrix); 412f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(pathRect)->GetBounds().GetWidth(), 2200.0)); 413f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(pathRect)->GetBounds().GetHeight(), 600.0)); 414f6603c60Sopenharmony_ci OH_Drawing_PathAddPath(nullptr, pathRect, matrix); 415f6603c60Sopenharmony_ci OH_Drawing_PathAddPath(pathRect, nullptr, matrix); 416f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 417f6603c60Sopenharmony_ci OH_Drawing_RectDestroy(rect); 418f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path2); 419f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(pathRect); 420f6603c60Sopenharmony_ci OH_Drawing_MatrixDestroy(matrix); 421f6603c60Sopenharmony_ci} 422f6603c60Sopenharmony_ci 423f6603c60Sopenharmony_ci/* 424f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathOffset021 425f6603c60Sopenharmony_ci * @tc.desc: test for PathOffset func. 426f6603c60Sopenharmony_ci * @tc.size : MediumTest 427f6603c60Sopenharmony_ci * @tc.type : Function 428f6603c60Sopenharmony_ci * @tc.level : Level 1 429f6603c60Sopenharmony_ci */ 430f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathOffset021, TestSize.Level1) 431f6603c60Sopenharmony_ci{ 432f6603c60Sopenharmony_ci OH_Drawing_Path* path = OH_Drawing_PathCreate(); 433f6603c60Sopenharmony_ci OH_Drawing_Path* path2 = OH_Drawing_PathCreate(); 434f6603c60Sopenharmony_ci OH_Drawing_PathOffset(path, path2, 50, 40); 435f6603c60Sopenharmony_ci OH_Drawing_PathReset(path); 436f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetWidth(), 0.0)); 437f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path)->GetBounds().GetHeight(), 0.0)); 438f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path); 439f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path2); 440f6603c60Sopenharmony_ci} 441f6603c60Sopenharmony_ci 442f6603c60Sopenharmony_ci/* 443f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathAddOvalWithInitialPoint022 444f6603c60Sopenharmony_ci * @tc.desc: test for PathAddOvalWithInitialPoint func. 445f6603c60Sopenharmony_ci * @tc.size : MediumTest 446f6603c60Sopenharmony_ci * @tc.type : Function 447f6603c60Sopenharmony_ci * @tc.level : Level 1 448f6603c60Sopenharmony_ci */ 449f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddOvalWithInitialPoint022, TestSize.Level1) 450f6603c60Sopenharmony_ci{ 451f6603c60Sopenharmony_ci OH_Drawing_Path* path9 = OH_Drawing_PathCreate(); 452f6603c60Sopenharmony_ci OH_Drawing_Rect *rect = OH_Drawing_RectCreate(0, 100, 500, 400); 453f6603c60Sopenharmony_ci OH_Drawing_PathAddOvalWithInitialPoint(path9, rect, 10, PATH_DIRECTION_CW); 454f6603c60Sopenharmony_ci OH_Drawing_PathClose(path9); 455f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path9)->GetBounds().GetWidth(), 500.0)); 456f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path9)->GetBounds().GetHeight(), 300.0)); 457f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path9); 458f6603c60Sopenharmony_ci OH_Drawing_RectDestroy(rect); 459f6603c60Sopenharmony_ci} 460f6603c60Sopenharmony_ci 461f6603c60Sopenharmony_ci/* 462f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathRMoveTo023 463f6603c60Sopenharmony_ci * @tc.desc: test for PathRMoveTo func. 464f6603c60Sopenharmony_ci * @tc.size : MediumTest 465f6603c60Sopenharmony_ci * @tc.type : Function 466f6603c60Sopenharmony_ci * @tc.level : Level 1 467f6603c60Sopenharmony_ci */ 468f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathRMoveTo023, TestSize.Level1) 469f6603c60Sopenharmony_ci{ 470f6603c60Sopenharmony_ci OH_Drawing_Path* path10 = OH_Drawing_PathCreate(); 471f6603c60Sopenharmony_ci OH_Drawing_PathRMoveTo(path10, 100, 100); 472f6603c60Sopenharmony_ci OH_Drawing_PathLineTo(path10, 300, 300); 473f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path10)->GetBounds().GetWidth(), 200.0)); 474f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path10)->GetBounds().GetHeight(), 200.0)); 475f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path10); 476f6603c60Sopenharmony_ci} 477f6603c60Sopenharmony_ci 478f6603c60Sopenharmony_ci/* 479f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathRLineTo024 480f6603c60Sopenharmony_ci * @tc.desc: test for PathRLineTo func. 481f6603c60Sopenharmony_ci * @tc.size : MediumTest 482f6603c60Sopenharmony_ci * @tc.type : Function 483f6603c60Sopenharmony_ci * @tc.level : Level 1 484f6603c60Sopenharmony_ci */ 485f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathRLineTo024, TestSize.Level1) 486f6603c60Sopenharmony_ci{ 487f6603c60Sopenharmony_ci OH_Drawing_Path* path11 = OH_Drawing_PathCreate(); 488f6603c60Sopenharmony_ci OH_Drawing_PathMoveTo(path11, 100, 100); 489f6603c60Sopenharmony_ci OH_Drawing_PathRLineTo(path11, 300, 300); 490f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path11)->GetBounds().GetWidth(), 300.0)); 491f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path11)->GetBounds().GetHeight(), 300.0)); 492f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path11); 493f6603c60Sopenharmony_ci} 494f6603c60Sopenharmony_ci 495f6603c60Sopenharmony_ci/* 496f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathRQuadTo025 497f6603c60Sopenharmony_ci * @tc.desc: test for PathRQuadTo func. 498f6603c60Sopenharmony_ci * @tc.size : MediumTest 499f6603c60Sopenharmony_ci * @tc.type : Function 500f6603c60Sopenharmony_ci * @tc.level : Level 1 501f6603c60Sopenharmony_ci */ 502f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathRQuadTo025, TestSize.Level1) 503f6603c60Sopenharmony_ci{ 504f6603c60Sopenharmony_ci OH_Drawing_Path* path12 = OH_Drawing_PathCreate(); 505f6603c60Sopenharmony_ci OH_Drawing_PathQuadTo(path12, 0, 0, 30, 30); 506f6603c60Sopenharmony_ci OH_Drawing_PathRQuadTo(path12, 100, 100, 100, 300); 507f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path12)->GetBounds().GetWidth(), 130.0)); 508f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path12)->GetBounds().GetHeight(), 330.0)); 509f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path12); 510f6603c60Sopenharmony_ci} 511f6603c60Sopenharmony_ci 512f6603c60Sopenharmony_ci/* 513f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathRConicTo026 514f6603c60Sopenharmony_ci * @tc.desc: test for PathRConicTo func. 515f6603c60Sopenharmony_ci * @tc.size : MediumTest 516f6603c60Sopenharmony_ci * @tc.type : Function 517f6603c60Sopenharmony_ci * @tc.level : Level 1 518f6603c60Sopenharmony_ci */ 519f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathRConicTo026, TestSize.Level1) 520f6603c60Sopenharmony_ci{ 521f6603c60Sopenharmony_ci OH_Drawing_Path* path13 = OH_Drawing_PathCreate(); 522f6603c60Sopenharmony_ci OH_Drawing_PathRConicTo(path13, 100, 100, 100, 300, 5); 523f6603c60Sopenharmony_ci OH_Drawing_PathRConicTo(path13, 100, 100, 100, 300, 5); 524f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path13)->GetBounds().GetWidth(), 200.0)); 525f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path13)->GetBounds().GetHeight(), 600.0)); 526f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path13); 527f6603c60Sopenharmony_ci} 528f6603c60Sopenharmony_ci 529f6603c60Sopenharmony_ci/* 530f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathRCubicTo027 531f6603c60Sopenharmony_ci * @tc.desc: test for PathRCubicTo func. 532f6603c60Sopenharmony_ci * @tc.size : MediumTest 533f6603c60Sopenharmony_ci * @tc.type : Function 534f6603c60Sopenharmony_ci * @tc.level : Level 1 535f6603c60Sopenharmony_ci */ 536f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathRCubicTo027, TestSize.Level1) 537f6603c60Sopenharmony_ci{ 538f6603c60Sopenharmony_ci OH_Drawing_Path* path14 = OH_Drawing_PathCreate(); 539f6603c60Sopenharmony_ci OH_Drawing_PathCubicTo(path14, 30, 40, 60, 0, 50, 20); 540f6603c60Sopenharmony_ci OH_Drawing_PathRCubicTo(path14, 30, 40, 60, 0, 50, 20); 541f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path14)->GetBounds().GetWidth(), 110.0)); 542f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path14)->GetBounds().GetHeight(), 60.0)); 543f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path14); 544f6603c60Sopenharmony_ci} 545f6603c60Sopenharmony_ci 546f6603c60Sopenharmony_ci/* 547f6603c60Sopenharmony_ci * @tc.name: NativeDrawingPathTest_pathTransformWithPerspectiveClip028 548f6603c60Sopenharmony_ci * @tc.desc: test for PathTransformWithPerspectiveClip func. 549f6603c60Sopenharmony_ci * @tc.size : MediumTest 550f6603c60Sopenharmony_ci * @tc.type : Function 551f6603c60Sopenharmony_ci * @tc.level : Level 1 552f6603c60Sopenharmony_ci */ 553f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathTransformWithPerspectiveClip028, TestSize.Level1) 554f6603c60Sopenharmony_ci{ 555f6603c60Sopenharmony_ci OH_Drawing_Path* path15 = OH_Drawing_PathCreate(); 556f6603c60Sopenharmony_ci OH_Drawing_PathAddRect(path15, 100, 500, 500, 100, PATH_DIRECTION_CW); 557f6603c60Sopenharmony_ci OH_Drawing_Matrix *matrix = OH_Drawing_MatrixCreateTranslation(100, 100); 558f6603c60Sopenharmony_ci OH_Drawing_PathTransformWithPerspectiveClip(path15, matrix, path15, true); 559f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path15)->GetBounds().GetWidth(), 400.0)); 560f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path15)->GetBounds().GetHeight(), 400.0)); 561f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path15); 562f6603c60Sopenharmony_ci OH_Drawing_MatrixDestroy(matrix); 563f6603c60Sopenharmony_ci} 564f6603c60Sopenharmony_ci/* 565f6603c60Sopenharmony_ci * @tc.name : NativeDrawingPathTest_pathAddPath029 566f6603c60Sopenharmony_ci * @tc.desc : test for PathAddPath func. 567f6603c60Sopenharmony_ci * @tc.size : MediumTest 568f6603c60Sopenharmony_ci * @tc.type : Function 569f6603c60Sopenharmony_ci * @tc.level : Level 1 570f6603c60Sopenharmony_ci */ 571f6603c60Sopenharmony_ciHWTEST_F(NativeDrawingPathTest, NativeDrawingPathTest_pathAddPath029, TestSize.Level1) 572f6603c60Sopenharmony_ci{ 573f6603c60Sopenharmony_ci OH_Drawing_Path* path16 = OH_Drawing_PathCreate(); 574f6603c60Sopenharmony_ci OH_Drawing_PathAddRect(path16, 100, 500, 500, 100, OH_Drawing_PathDirection::PATH_DIRECTION_CW); 575f6603c60Sopenharmony_ci OH_Drawing_Matrix* matrix = OH_Drawing_MatrixCreate(); 576f6603c60Sopenharmony_ci OH_Drawing_MatrixSetMatrix( 577f6603c60Sopenharmony_ci matrix, 578f6603c60Sopenharmony_ci 1, 0, 0, 579f6603c60Sopenharmony_ci 0, -1, 0, 580f6603c60Sopenharmony_ci 0, 0, 1); 581f6603c60Sopenharmony_ci OH_Drawing_PathAddPath(path16, path16, matrix); 582f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path16)->GetBounds().GetWidth(), 400.0)); 583f6603c60Sopenharmony_ci EXPECT_TRUE(IsScalarAlmostEqual(reinterpret_cast<Path*>(path16)->GetBounds().GetHeight(), 1000.0)); 584f6603c60Sopenharmony_ci OH_Drawing_PathDestroy(path16); 585f6603c60Sopenharmony_ci OH_Drawing_MatrixDestroy(matrix); 586f6603c60Sopenharmony_ci} 587f6603c60Sopenharmony_ci} // namespace Drawing 588f6603c60Sopenharmony_ci} // namespace Rosen 589f6603c60Sopenharmony_ci} // namespace OHOS