• 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 <random>
40 
41 using namespace testing;
42 using namespace testing::ext;
43 
44 namespace OHOS {
45 namespace Rosen {
46 namespace Drawing {
47 class DrawingRecordCmdUtilsDestroyTest : public testing::Test {
48     protected:
49     // 在每个测试用例执行前调用
SetUp()50     void SetUp() override
51     {
52         // 设置代码
53         std::cout << "DrawingRecordCmdUtilsDestroyTest Setup code called before each test case." << std::endl;
54         OH_Drawing_ErrorCodeReset();
55         std::cout << "DrawingRecordCmdUtilsDestroyTest errorCodeReset before each test case." << std::endl;
56     }
TearDown()57     void TearDown() override
58     {
59         std::cout << "DrawingRecordCmdUtilsDestroyTest Setup code called after each test case." << std::endl;
60         OH_Drawing_ErrorCodeReset();
61         std::cout << "DrawingRecordCmdUtilsDestroyTest errorCodeReset after each test case." << std::endl;
62     }
63 };
64 
65 /*
66  * @tc.number: SUB_BASIC_GRAPHICS_SPECIAL_API_C_DRAWING_RECORDER_0200
67  * @tc.name: testRecordCmdUtilsDestroyNormal
68  * @tc.desc: test for testRecordCmdUtilsDestroyNormal.
69  * @tc.size  : SmallTest
70  * @tc.type  : Function
71  * @tc.level : Level 0
72  */
73 HWTEST_F(DrawingRecordCmdUtilsDestroyTest, testRecordCmdUtilsDestroyNormal, Function | SmallTest | Level0) {
74     // 1. OH_Drawing_RecordCmdUtilsCreate
75     OH_Drawing_ErrorCode drawingErrorCode = OH_DRAWING_ERROR_INVALID_PARAMETER;
76     OH_Drawing_RecordCmdUtils* recordcmd1 = OH_Drawing_RecordCmdUtilsCreate ();
77     // add assert
78     EXPECT_NE(recordcmd1, nullptr);
79     // 2. OH_Drawing_RecordCmdUtilsDestroy
80     drawingErrorCode = OH_Drawing_RecordCmdUtilsDestroy (recordcmd1);
81     EXPECT_EQ(drawingErrorCode, OH_DRAWING_SUCCESS);
82 }
83 
84 } // namespace Drawing
85 } // namespace Rosen
86 } // namespace OHOS
87