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
17package android.widget.layout.table;
18
19import android.widget.layout.table.FixedWidth;
20import com.android.frameworks.coretests.R;
21
22import android.test.ActivityInstrumentationTestCase;
23import android.test.suitebuilder.annotation.MediumTest;
24import android.view.View;
25
26/**
27 * {@link android.widget.layout.table.FixedWidth} is
28 * setup to exercise tables in which cells use fixed width and height.
29 */
30public class FixedWidthTest extends ActivityInstrumentationTestCase<FixedWidth> {
31    private View mFixedWidth;
32    private View mFixedHeight;
33    private View mNonFixedWidth;
34
35    public FixedWidthTest() {
36        super("com.android.frameworks.coretests", FixedWidth.class);
37    }
38
39    @Override
40    protected void setUp() throws Exception {
41        super.setUp();
42
43        final FixedWidth activity = getActivity();
44        mFixedWidth = activity.findViewById(R.id.fixed_width);
45        mNonFixedWidth = activity.findViewById(R.id.non_fixed_width);
46        mFixedHeight = activity.findViewById(R.id.fixed_height);
47    }
48
49    @MediumTest
50    public void testSetUpConditions() throws Exception {
51        assertNotNull(mFixedWidth);
52        assertNotNull(mFixedHeight);
53        assertNotNull(mNonFixedWidth);
54    }
55
56    // TODO: needs to be adjusted to pass on non-HVGA displays
57    // @MediumTest
58    public void testFixedWidth() throws Exception {
59        assertEquals(150, mFixedWidth.getWidth());
60        assertEquals(mFixedWidth.getWidth(), mNonFixedWidth.getWidth());
61    }
62
63    // TODO: needs to be adjusted to pass on non-HVGA displays
64    // @MediumTest
65    public void testFixedHeight() throws Exception {
66        assertEquals(48, mFixedHeight.getHeight());
67    }
68}
69