/***
	Copyright (c) 2008-2011 CommonsWare, LLC
	Licensed under the Apache License, Version 2.0 (the "License"); you may not
	use this file except in compliance with the License. You may obtain a copy
	of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required
	by applicable law or agreed to in writing, software distributed under the
	License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
	OF ANY KIND, either express or implied. See the License for the specific
	language governing permissions and limitations under the License.
	
	From _The Busy Coder's Guide to Android Development_
		http://commonsware.com/Android
*/

package com.commonsware.android.contacts.spinners;

import android.test.AndroidTestCase;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.Spinner;

public class ContactsDemoBaseTest extends AndroidTestCase {
	private ListView list=null;
	private Spinner spinner=null;
	private ViewGroup root=null;
	
	@Override
	protected void setUp() throws Exception {
		super.setUp();
		
		LayoutInflater inflater=LayoutInflater.from(getContext());
		
		root=(ViewGroup)inflater.inflate(R.layout.main, null);
		root.measure(480, 320);
		root.layout(0, 0, 480, 320);

		list=(ListView)root.findViewById(android.R.id.list);
		spinner=(Spinner)root.findViewById(R.id.spinner);
	}
	
	public void testExists() {
		assertNotNull(list);
		assertNotNull(spinner);
	}
	
	public void testRelativePosition() {
		assertTrue(list.getTop()>=spinner.getBottom());
		assertTrue(list.getLeft()==spinner.getLeft());
		assertTrue(list.getRight()==spinner.getRight());
	}
}