@Test @Config(minSdk = LOLLIPOP) public void clipToOutline() { view.setClipToOutline(true); assertThat(view.getClipToOutline()).isTrue(); }
@Override public void onClick(View bt) { // Toggle whether the View is clipped to the outline if (clippedView.getClipToOutline()) { /* The Outline is set for the View, but disable clipping. */ clippedView.setClipToOutline(false); Log.d(TAG, String.format("Clipping to outline is disabled")); ((Button) bt).setText(R.string.clip_button); } else { /* Enables clipping on the View. */ clippedView.setClipToOutline(true); Log.d(TAG, String.format("Clipping to outline is enabled")); ((Button) bt).setText(R.string.unclip_button); } } });
/** * Triggers a click on the button and tests if the view is clipped afterwards. */ public void testClipping() { View clippedView = mTestActivity.findViewById(R.id.frame); // Initially, the view is not clipped. assertFalse(clippedView.getClipToOutline()); // Trigger a click on the button to activate clipping. TouchUtils.clickView(this, mTestActivity.findViewById(R.id.button)); // Check that the view has been clipped. assertTrue(clippedView.getClipToOutline()); } }
data.put("BackgroundTintList", String.valueOf(v.getBackgroundTintList())); data.put("BackgroundTintMode", String.valueOf(v.getBackgroundTintMode())); data.put("ClipToOutline", v.getClipToOutline()); data.put("Elevation", v.getElevation()); data.put("TransitionName", v.getTransitionName());