Code example for Activity

0
@RunWith(RobolectricTestRunner.class) 
public class ImageSizeTest { 
	private Activity mActivity;
	private ImageView mView;
	private ImageAware mImageAware;
 
	@Before 
	public void setUp() throws Exception { 
		mActivity = new Activity();
 
		// Make and set view with some prelim values to test 
		mView = new TestImageView(mActivity);
		mView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
		mView.measure(View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(250, View.MeasureSpec.EXACTLY));
 
		mImageAware = new ImageViewAware(mView);
	} 
 
	@Test 
	public void testGetImageSizeScaleTo_useImageActualSize() throws Exception { 
		// We layout the view to give it a width and height