Code example for ImageView

Methods: layout, measure

0
		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 
		mView.measure(View.MeasureSpec.makeMeasureSpec(200, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(200, View.MeasureSpec.EXACTLY));
		mView.layout(0, 0, 200, 200);
 
		ImageSize expected = new ImageSize(200, 200);
		ImageSize result = ImageSizeUtils.defineTargetSizeForView(mImageAware, new ImageSize(590, 590));
		Assertions.assertThat(result).isNotNull();
		Assertions.assertThat(result.getWidth()).isEqualTo(expected.getWidth());
		Assertions.assertThat(result.getHeight()).isEqualTo(expected.getHeight());
	} 
 
	/**