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 #include <gtest/gtest.h> 17 #include <arpa/inet.h> 18 #include <fstream> 19 #include "png_ninepatch_res.h" 20 21 using namespace testing::ext; 22 namespace OHOS { 23 namespace Multimedia { 24 class PngNinepatchResTest : public testing::Test { 25 public: PngNinepatchResTest()26 PngNinepatchResTest() {} ~PngNinepatchResTest()27 ~PngNinepatchResTest() {} 28 }; 29 30 /** 31 * @tc.name: DeviceToFile001 32 * @tc.desc: test DeviceToFile 33 * @tc.type: FUNC 34 */ 35 HWTEST_F(PngNinepatchResTest, DeviceToFile001, TestSize.Level3) 36 { 37 GTEST_LOG_(INFO) << "PngNinepatchResTest: DeviceToFile001 start"; 38 ImagePlugin::PngNinePatchRes pngnp; 39 pngnp.DeviceToFile(); 40 ASSERT_NE(&pngnp, nullptr); 41 GTEST_LOG_(INFO) << "PngNinepatchResTest: DeviceToFile001 end"; 42 } 43 44 /** 45 * @tc.name: FileToDevice001 46 * @tc.desc: test FileToDevice 47 * @tc.type: FUNC 48 */ 49 HWTEST_F(PngNinepatchResTest, FileToDevice001, TestSize.Level3) 50 { 51 GTEST_LOG_(INFO) << "PngNinepatchResTest: FileToDevice001 start"; 52 ImagePlugin::PngNinePatchRes pngnp; 53 pngnp.FileToDevice(); 54 ASSERT_NE(&pngnp, nullptr); 55 GTEST_LOG_(INFO) << "PngNinepatchResTest: FileToDevice001 end"; 56 } 57 58 /** 59 * @tc.name: SerializedSize001 60 * @tc.desc: test SerializedSize 61 * @tc.type: FUNC 62 */ 63 HWTEST_F(PngNinepatchResTest, SerializedSize001, TestSize.Level3) 64 { 65 GTEST_LOG_(INFO) << "PngNinepatchResTest: SerializedSize001 start"; 66 ImagePlugin::PngNinePatchRes pngnp; 67 const size_t sersize = pngnp.SerializedSize(); 68 ASSERT_EQ(sersize, 32); 69 GTEST_LOG_(INFO) << "PngNinepatchResTest: SerializedSize001 end"; 70 } 71 } // namespace Multimedia 72 } // namespace OHOS