blob: df3329cd523169c326d0af67c1def8b262c2d521 [file] [log] [blame]
Prabir Pradhan48f8cb92021-08-26 14:05:36 -07001/*
2 * Copyright 2021 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <gtest/gtest.h>
18
19#include <binder/Parcel.h>
20
21#include <gui/DisplayInfo.h>
22
23namespace android {
24
25using gui::DisplayInfo;
26
27namespace test {
28
29TEST(DisplayInfo, Parcelling) {
30 DisplayInfo info;
31 info.displayId = 42;
32 info.logicalWidth = 99;
33 info.logicalHeight = 78;
34 info.transform.set({0.4, -1, 100, 0.5, 0, 40, 0, 0, 1});
35
36 Parcel p;
37 info.writeToParcel(&p);
38 p.setDataPosition(0);
39
40 DisplayInfo info2;
41 info2.readFromParcel(&p);
42 ASSERT_EQ(info.displayId, info2.displayId);
43 ASSERT_EQ(info.logicalWidth, info2.logicalWidth);
44 ASSERT_EQ(info.logicalHeight, info2.logicalHeight);
45 ASSERT_EQ(info.transform, info2.transform);
46}
47
48} // namespace test
49} // namespace android