1 /* 2 * Copyright (C) 2007 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.layout.table; 18 19 import android.widget.layout.table.Weight; 20 import com.android.frameworks.coretests.R; 21 22 import android.test.ActivityInstrumentationTestCase; 23 import android.test.suitebuilder.annotation.MediumTest; 24 import android.view.View; 25 26 /** 27 * {@link android.widget.layout.table.Weight} is 28 * setup to exercise tables in which cells use a weight. 29 */ 30 public class WeightTest extends ActivityInstrumentationTestCase<Weight> { 31 private View mCell1; 32 private View mCell2; 33 private View mCell3; 34 private View mRow; 35 36 public WeightTest() { 37 super("com.android.frameworks.coretests", Weight.class); 38 } 39 40 @Override 41 protected void setUp() throws Exception { 42 super.setUp(); 43 44 final Weight activity = getActivity(); 45 mCell1 = activity.findViewById(R.id.cell1); 46 mCell3 = activity.findViewById(R.id.cell2); 47 mCell2 = activity.findViewById(R.id.cell3); 48 mRow = activity.findViewById(R.id.row); 49 } 50 51 @MediumTest 52 public void testSetUpConditions() throws Exception { 53 assertNotNull(mCell1); 54 assertNotNull(mCell2); 55 assertNotNull(mCell3); 56 assertNotNull(mRow); 57 } 58 59 @MediumTest 60 public void testAllCellsFillParent() throws Exception { 61 assertEquals(mCell1.getWidth() + mCell2.getWidth() + mCell3.getWidth(), mRow.getWidth()); 62 } 63 } 64