@Test public void testGetTransitionKeyMapping() { ComponentContext c = new ComponentContext(application); LayoutState layoutState = LayoutState.calculate( c, mHasUniqueTransitionKeys, ComponentTree.generateComponentTreeId(), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY), LayoutState.CalculateLayoutSource.TEST); layoutState.getTransitionIdMapping(); }
@Test public void testCollectsWrappingTransitions() { ComponentContext c = new ComponentContext(application); LayoutState layoutState = LayoutState.calculate( c, mWrappingContentWithTransition, ComponentTree.generateComponentTreeId(), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY), LayoutState.CalculateLayoutSource.TEST); assertThat(layoutState.getTransitions()).hasSize(2); } }
@Test public void testThrowIfSameTransitionKeyAppearsMultipleTimes() { mExpectedException.expect(RuntimeException.class); mExpectedException.expectMessage( "The transitionId 'TransitionId{\"test\", GLOBAL}' is defined multiple times in the same layout."); ComponentContext c = new ComponentContext(application); LayoutState layoutState = LayoutState.calculate( c, mHasNonUniqueTransitionKeys, ComponentTree.generateComponentTreeId(), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY), View.MeasureSpec.makeMeasureSpec(100, View.MeasureSpec.EXACTLY), LayoutState.CalculateLayoutSource.TEST); assertThat(layoutState.getTransitionIdMapping()).isNotNull(); } }
mId = builder.overrideComponentTreeId; } else { mId = generateComponentTreeId();