1 /* 2 * Copyright (C) 2008 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 package android.widget.listview; 18 19 import com.android.frameworks.coretests.R; 20 21 import android.test.ActivityInstrumentationTestCase; 22 import android.app.Activity; 23 import android.test.suitebuilder.annotation.MediumTest; 24 import android.widget.ListView; 25 26 public class ListUnspecifiedMeasure<T extends Activity> extends ActivityInstrumentationTestCase<T> { 27 private T mActivity; 28 private ListView mListView; 29 30 protected ListUnspecifiedMeasure(Class<T> klass) { 31 super("com.android.frameworks.coretests", klass); 32 } 33 34 @Override 35 protected void setUp() throws Exception { 36 super.setUp(); 37 38 mActivity = getActivity(); 39 mListView = (ListView) mActivity.findViewById(R.id.list); 40 } 41 42 @MediumTest 43 public void testPreconditions() { 44 assertNotNull(mActivity); 45 assertNotNull(mListView); 46 } 47 48 @MediumTest 49 public void testWasMeasured() { 50 assertTrue(mListView.getMeasuredWidth() > 0); 51 assertTrue(mListView.getWidth() > 0); 52 assertTrue(mListView.getMeasuredHeight() > 0); 53 assertTrue(mListView.getHeight() > 0); 54 } 55 } 56