Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50395a12 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes I31ddbed9,I702a2449 am: a730b44c am: e2d2a4be

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1489240

Change-Id: I5c5abbb066032b7599f66ffb73767b8ab33b9c57
parents 2a948644 e2d2a4be
Loading
Loading
Loading
Loading
+49 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 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 com.android.server.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 HdmiCecMessage} class. */
@SmallTest
@RunWith(JUnit4.class)
public class HdmiCecMessageTest {

    @Test
    public void testEqualsHdmiCecMessage() {
        int source = 0;
        int destination = 1;
        int opcode = 0x7f;
        byte[] params1 = {0x00, 0x1a, 0x2b, 0x3c};
        byte[] params2 = {0x00, 0x1a, 0x2b, 0x3c, 0x4d};

        new EqualsTester()
                .addEqualityGroup(
                        new HdmiCecMessage(source, destination, opcode, params1),
                        new HdmiCecMessage(source, destination, opcode, params1))
                .addEqualityGroup(new HdmiCecMessage(source, destination, opcode, params2))
                .addEqualityGroup(new HdmiCecMessage(source + 1, destination, opcode, params1))
                .addEqualityGroup(new HdmiCecMessage(source, destination + 1, opcode, params1))
                .addEqualityGroup(new HdmiCecMessage(source, destination, opcode + 1, params1))
                .testEquals();
    }
}