• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development 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 "gtest/gtest.h"
17 #include "drawing_bitmap.h"
18 #include "drawing_brush.h"
19 #include "drawing_canvas.h"
20 #include "drawing_color.h"
21 #include "drawing_color_filter.h"
22 #include "drawing_filter.h"
23 #include "drawing_font.h"
24 #include "drawing_image.h"
25 #include "drawing_mask_filter.h"
26 #include "drawing_matrix.h"
27 #include "drawing_memory_stream.h"
28 #include "drawing_path.h"
29 #include "drawing_pen.h"
30 #include "drawing_point.h"
31 #include "drawing_rect.h"
32 #include "drawing_region.h"
33 #include "drawing_round_rect.h"
34 #include "drawing_sampling_options.h"
35 #include "drawing_shader_effect.h"
36 #include "drawing_text_blob.h"
37 #include "drawing_typeface.h"
38 #include "drawing_record_cmd.h"
39 #include "utils/scalar.h"
40 #include <random>
41 
42 using namespace testing;
43 using namespace testing::ext;
44 
45 namespace OHOS {
46 namespace Rosen {
47 namespace Drawing {
48 class DrawingRecordCmdUtilsDestroyTest : public testing::Test {
49     protected:
50     // 在每个测试用例执行前调用
SetUp()51     void SetUp() override
52     {
53         // 设置代码
54         std::cout << "DrawingRecordCmdUtilsDestroyTest Setup code called before each test case." << std::endl;
55         OH_Drawing_ErrorCodeReset();
56         std::cout << "DrawingRecordCmdUtilsDestroyTest errorCodeReset before each test case." << std::endl;
57     }
TearDown()58     void TearDown() override
59     {
60         std::cout << "DrawingRecordCmdUtilsDestroyTest Setup code called after each test case." << std::endl;
61         OH_Drawing_ErrorCodeReset();
62         std::cout << "DrawingRecordCmdUtilsDestroyTest errorCodeReset after each test case." << std::endl;
63     }
64 };
65 
66 /*
67  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_RECORDER_0200
68  * @tc.name: testRecordCmdUtilsDestroyNormal
69  * @tc.desc: test for testRecordCmdUtilsDestroyNormal.
70  * @tc.size  : SmallTest
71  * @tc.type  : Function
72  * @tc.level : Level 0
73  */
74 HWTEST_F(DrawingRecordCmdUtilsDestroyTest, testRecordCmdUtilsDestroyNormal, TestSize.Level0) {
75     // 1. OH_Drawing_RecordCmdUtilsCreate
76     OH_Drawing_ErrorCode drawingErrorCode = OH_DRAWING_ERROR_INVALID_PARAMETER;
77     OH_Drawing_RecordCmdUtils* recordcmd1 = OH_Drawing_RecordCmdUtilsCreate ();
78     // add assert
79     EXPECT_NE(recordcmd1, nullptr);
80     // 2. OH_Drawing_RecordCmdUtilsDestroy
81     drawingErrorCode = OH_Drawing_RecordCmdUtilsDestroy (recordcmd1);
82     EXPECT_EQ(drawingErrorCode, OH_DRAWING_SUCCESS);
83 }
84 
85 } // namespace Drawing
86 } // namespace Rosen
87 } // namespace OHOS
88