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 "image_info.h"
18
19 using namespace testing::ext;
20
21 namespace OHOS {
22 namespace AAFwk {
23 class ImageInfoTest : public testing::Test {
24 public:
25 static void SetUpTestCase(void);
26 static void TearDownTestCase(void);
27 void SetUp();
28 void TearDown();
29 };
30
SetUpTestCase(void)31 void ImageInfoTest::SetUpTestCase(void)
32 {}
TearDownTestCase(void)33 void ImageInfoTest::TearDownTestCase(void)
34 {}
SetUp(void)35 void ImageInfoTest::SetUp(void)
36 {}
TearDown(void)37 void ImageInfoTest::TearDown(void)
38 {}
39
40 /*
41 * Feature: Image Info
42 * Function: Marshalling and Unmarshalling
43 * SubFunction: NA
44 * FunctionPoints: Image Marshalling
45 * EnvConditions: NA
46 * CaseDescription: Verify Marshalling
47 */
48 HWTEST_F(ImageInfoTest, image_info_marshalling_001, TestSize.Level1)
49 {
50 Parcel parcel;
51 ImageInfo* parcelable1 = new ImageInfo();
52 parcelable1->width = 1;
53 parcelable1->height = 2;
54 parcelable1->format = 3;
55 parcelable1->size = 4;
56 parcelable1->shmKey = 5;
57 EXPECT_EQ(true, parcelable1->Marshalling(parcel));
58 ImageInfo* parcelable2 = parcelable1->Unmarshalling(parcel);
59 EXPECT_EQ(parcelable2->width, static_cast<uint32_t>(1));
60 EXPECT_EQ(parcelable2->height, static_cast<uint32_t>(2));
61 EXPECT_EQ(parcelable2->format, static_cast<uint32_t>(3));
62 EXPECT_EQ(parcelable2->size, static_cast<uint32_t>(4));
63 EXPECT_EQ(parcelable2->shmKey, 5);
64 }
65 }
66 }