2 * Copyright (C) 2007 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package android.widget.layout.table;
19 import android.widget.layout.table.VerticalGravity;
20 import com.android.frameworks.coretests.R;
22 import android.test.ActivityInstrumentationTestCase;
23 import android.test.suitebuilder.annotation.MediumTest;
24 import android.test.suitebuilder.annotation.Suppress;
25 import android.test.ViewAsserts;
26 import android.view.View;
29 * {@link android.widget.layout.table.VerticalGravity} is
30 * setup to exercise tables in which cells use vertical gravity.
32 public class VerticalGravityTest extends ActivityInstrumentationTestCase<VerticalGravity> {
33 private View mReference1;
34 private View mReference2;
35 private View mReference3;
40 public VerticalGravityTest() {
41 super("com.android.frameworks.coretests", VerticalGravity.class);
45 protected void setUp() throws Exception {
48 final VerticalGravity activity = getActivity();
49 mReference1 = activity.findViewById(R.id.reference1);
50 mReference2 = activity.findViewById(R.id.reference2);
51 mReference3 = activity.findViewById(R.id.reference3);
52 mTop = activity.findViewById(R.id.cell_top);
53 mCenter = activity.findViewById(R.id.cell_center);
54 mBottom = activity.findViewById(R.id.cell_bottom);
58 public void testSetUpConditions() throws Exception {
59 assertNotNull(mReference1);
60 assertNotNull(mReference2);
61 assertNotNull(mReference3);
63 assertNotNull(mCenter);
64 assertNotNull(mBottom);
68 public void testTopGravity() throws Exception {
69 ViewAsserts.assertTopAligned(mReference1, mTop);
73 public void testCenterGravity() throws Exception {
74 ViewAsserts.assertVerticalCenterAligned(mReference2, mCenter);
79 public void testBottomGravity() throws Exception {
80 ViewAsserts.assertBottomAligned(mReference3, mBottom);