Code example for ViewGroup.MarginLayoutParams

0
  @Test 
  public void testApplyBoundsToViewOnNormalProgressBar() throws Exception { 
    TabrisActivity activity = UiTestUtil.createActivityWithMockedFields();
    ProgressBarSetter<ProgressBar> setter = new ProgressBarSetter<ProgressBar>( activity );
    ProgressBar progressBar = mock( ProgressBar.class );
    MarginLayoutParams layoutParams = new MarginLayoutParams( 0, 0 );
    when( progressBar.getLayoutParams() ).thenReturn( layoutParams );
    SetProperties props = new SetProperties();
    List<Integer> bounds = Arrays.asList( 10, 20, 30, 40 );
    props.setBounds( bounds );
    UiTestUtil.mockToolkitMultiplyIdentity( activity, 10, 34, 30, 12 );
 
    setter.execute( progressBar, props );
 
    assertEquals( 10, layoutParams.leftMargin );
    assertEquals( 34, layoutParams.topMargin );
    assertEquals( 30, layoutParams.width );
    assertEquals( 12, layoutParams.height );
  } 
 
Experience pair programming with AI  Get Codota for Java