OSDN Git Service

original
[gb-231r1-is01/Gingerbread_2.3.3_r1_IS01.git] / frameworks / base / core / tests / coretests / src / android / widget / layout / table / VerticalGravityTest.java
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.VerticalGravity;
20 import com.android.frameworks.coretests.R;
21
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;
27
28 /**
29  * {@link android.widget.layout.table.VerticalGravity} is
30  * setup to exercise tables in which cells use vertical gravity.
31  */
32 public class VerticalGravityTest extends ActivityInstrumentationTestCase<VerticalGravity> {
33     private View mReference1;
34     private View mReference2;
35     private View mReference3;
36     private View mTop;
37     private View mCenter;
38     private View mBottom;
39
40     public VerticalGravityTest() {
41         super("com.android.frameworks.coretests", VerticalGravity.class);
42     }
43
44     @Override
45     protected void setUp() throws Exception {
46         super.setUp();
47
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);
55     }
56
57     @MediumTest
58     public void testSetUpConditions() throws Exception {
59         assertNotNull(mReference1);
60         assertNotNull(mReference2);
61         assertNotNull(mReference3);
62         assertNotNull(mTop);
63         assertNotNull(mCenter);
64         assertNotNull(mBottom);
65     }
66
67     @MediumTest
68     public void testTopGravity() throws Exception {
69         ViewAsserts.assertTopAligned(mReference1, mTop);
70     }
71
72     @MediumTest
73     public void testCenterGravity() throws Exception {
74         ViewAsserts.assertVerticalCenterAligned(mReference2, mCenter);
75     }
76
77     @Suppress
78     @MediumTest
79     public void testBottomGravity() throws Exception {
80         ViewAsserts.assertBottomAligned(mReference3, mBottom);
81     }
82 }