1 /*
2 * Copyright (c) 2024 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
18 #include "window_config.h"
19
20 namespace OHOS {
21 namespace AbilityRuntime {
22 using namespace testing::ext;
23 using namespace AAFwk;
24 using namespace AbilityRuntime;
25
26 class WindowConfigTest : public testing::Test {
27 public:
28 static void SetUpTestCase(void);
29 static void TearDownTestCase(void);
30 void SetUp();
31 void TearDown();
32 };
33
SetUpTestCase(void)34 void WindowConfigTest::SetUpTestCase(void)
35 {}
36
TearDownTestCase(void)37 void WindowConfigTest::TearDownTestCase(void)
38 {}
39
SetUp(void)40 void WindowConfigTest::SetUp(void)
41 {}
42
TearDown(void)43 void WindowConfigTest::TearDown(void)
44 {}
45
46 /**
47 * @tc.number: Marshalling_001
48 * @tc.name: Marshalling
49 * @tc.desc: Test whether Marshalling is called normally.
50 * @tc.type: FUNC
51 */
HWTEST_F(WindowConfigTest, Marshalling_001, Function | MediumTest | Level1)52 HWTEST_F(WindowConfigTest, Marshalling_001, Function | MediumTest | Level1)
53 {
54 GTEST_LOG_(INFO) << "Marshalling_001 start";
55 WindowConfig windowConfig;
56 Parcel parcel;
57 int32_t windowType = 1;
58 uint32_t windowId = 2;
59 parcel.WriteInt32(windowType);
60 parcel.WriteUint32(windowId);
61
62 auto res = windowConfig.Unmarshalling(parcel);
63 EXPECT_EQ(res->windowType, windowType);
64 EXPECT_EQ(res->windowId, windowId);
65 GTEST_LOG_(INFO) << "Marshalling_001 end";
66 }
67 } // namespace AbilityRuntime
68 } // namespace OHOS
69