| Prabir Pradhan | 48f8cb9 | 2021-08-26 14:05:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 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 |  | 
|  | 23 | namespace android { | 
|  | 24 |  | 
|  | 25 | using gui::DisplayInfo; | 
|  | 26 |  | 
|  | 27 | namespace test { | 
|  | 28 |  | 
|  | 29 | TEST(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 |