Merge "HDMICEC: Change hashcode for HdmiPortInfo" am: d8cd3c7d2d am: 8f4bb0a2a5
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1483970 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: If924ee797a4d75c93840ea2947d754de30a9f58a
This commit is contained in:
@@ -192,6 +192,7 @@ public final class HdmiPortInfo implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return mId;
|
return java.util.Objects.hash(
|
||||||
|
mId, mType, mAddress, mCecSupported, mArcSupported, mMhlSupported);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
62
core/tests/hdmitests/src/android/hardware/hdmi/HdmiPortInfoTest.java
Executable file
62
core/tests/hdmitests/src/android/hardware/hdmi/HdmiPortInfoTest.java
Executable file
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package android.hardware.hdmi;
|
||||||
|
|
||||||
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
|
import com.google.common.testing.EqualsTester;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.JUnit4;
|
||||||
|
|
||||||
|
/** Tests for {@link HdmiPortInfo} */
|
||||||
|
@RunWith(JUnit4.class)
|
||||||
|
@SmallTest
|
||||||
|
public class HdmiPortInfoTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEquals() {
|
||||||
|
int portId = 1;
|
||||||
|
int portType = 0;
|
||||||
|
int address = 0x123456;
|
||||||
|
boolean isCec = true;
|
||||||
|
boolean isMhl = false;
|
||||||
|
boolean isArcSupported = false;
|
||||||
|
|
||||||
|
new EqualsTester()
|
||||||
|
.addEqualityGroup(
|
||||||
|
new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported),
|
||||||
|
new HdmiPortInfo(portId, portType, address, isCec, isMhl, isArcSupported))
|
||||||
|
.addEqualityGroup(
|
||||||
|
new HdmiPortInfo(
|
||||||
|
portId + 1, portType, address, isCec, isMhl, isArcSupported))
|
||||||
|
.addEqualityGroup(
|
||||||
|
new HdmiPortInfo(
|
||||||
|
portId, portType + 1, address, isCec, isMhl, isArcSupported))
|
||||||
|
.addEqualityGroup(
|
||||||
|
new HdmiPortInfo(
|
||||||
|
portId, portType, address + 1, isCec, isMhl, isArcSupported))
|
||||||
|
.addEqualityGroup(
|
||||||
|
new HdmiPortInfo(portId, portType, address, !isCec, isMhl, isArcSupported))
|
||||||
|
.addEqualityGroup(
|
||||||
|
new HdmiPortInfo(portId, portType, address, isCec, !isMhl, isArcSupported))
|
||||||
|
.addEqualityGroup(
|
||||||
|
new HdmiPortInfo(portId, portType, address, isCec, isMhl, !isArcSupported))
|
||||||
|
.testEquals();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user