1 /* 2 * Copyright (C) 2008 Esmertec AG 3 * Copyright (C) 2008 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 package android.widget.cts; 19 20 import static org.junit.Assert.assertEquals; 21 import static org.junit.Assert.assertNotNull; 22 import static org.junit.Assert.assertSame; 23 24 import android.widget.ExpandableListView; 25 import android.widget.ExpandableListView.ExpandableListContextMenuInfo; 26 import android.widget.ListView; 27 28 import androidx.test.InstrumentationRegistry; 29 import androidx.test.filters.MediumTest; 30 import androidx.test.runner.AndroidJUnit4; 31 32 import org.junit.Test; 33 import org.junit.runner.RunWith; 34 35 /** 36 * Test {@link ExpandableListContextMenuInfo}. 37 */ 38 @MediumTest 39 @RunWith(AndroidJUnit4.class) 40 public class ExpandableListView_ExpandableListContextMenuInfoTest { 41 @Test testConstructor()42 public void testConstructor() { 43 ListView listview = new ListView(InstrumentationRegistry.getTargetContext()); 44 ExpandableListContextMenuInfo expandableListContextMenuInfo = 45 new ExpandableListView.ExpandableListContextMenuInfo(listview, 100L, 80L); 46 assertNotNull(expandableListContextMenuInfo); 47 assertSame(listview, expandableListContextMenuInfo.targetView); 48 assertEquals(100L, expandableListContextMenuInfo.packedPosition); 49 assertEquals(80L, expandableListContextMenuInfo.id); 50 } 51 } 52