@Override Component makeShallowCopyWithNewId() { shallowCopy = (TestComponent) super.makeShallowCopy(); shallowCopy.mId = sIdGenerator.getAndIncrement(); if (getScopedContext().isNestedTreeResolutionExperimentEnabled()) { shallowCopy.setGlobalKey(getGlobalKey()); } return shallowCopy; }
if (component.getScopedContext().isNestedTreeResolutionExperimentEnabled()) { synchronized (this) {
@Test public void testLayoutSpecMeasureResolveNestedTree_withExperiment() { Component component = setUpSpyComponentForCreateLayout(false /* isMountSpec */, true /* canMeasure */); YogaMeasureFunction measureFunction = getMeasureFunction(component); final int nestedTreeWidth = 20; final int nestedTreeHeight = 25; InternalNode nestedTree = mock(InternalNode.class); when(nestedTree.getWidth()).thenReturn(nestedTreeWidth); when(nestedTree.getHeight()).thenReturn(nestedTreeHeight); when(LayoutState.resolveNestedTree(eq(mContext), eq(mNode), anyInt(), anyInt())) .thenReturn(nestedTree); when(mNode.getContext()).thenReturn(mContext); when(mContext.isNestedTreeResolutionExperimentEnabled()).thenReturn(true); when(mNode.getParent()).thenReturn(mNode); when(mNode.getContext()).thenReturn(mContext); long output = measureFunction.measure(mNode.mYogaNode, 0, EXACTLY, 0, EXACTLY); PowerMockito.verifyStatic(); LayoutState.resolveNestedTree(eq(mContext), eq(mNode), anyInt(), anyInt()); assertThat(YogaMeasureOutput.getWidth(output)).isEqualTo(nestedTreeWidth); assertThat(YogaMeasureOutput.getHeight(output)).isEqualTo(nestedTreeHeight); }
protected void init( ComponentContext c, @AttrRes int defStyleAttr, @StyleRes int defStyleRes, Component component) { mResourceResolver = new ResourceResolver(c); mComponent = component; mContext = c; mComponent.mIsNestedTreeResolutionExperimentEnabled = mContext.isNestedTreeResolutionExperimentEnabled(); final Component owner = getOwner(); if (owner != null) { mComponent.mOwnerGlobalKey = owner.getGlobalKey(); } if (defStyleAttr != 0 || defStyleRes != 0) { mComponent.getOrCreateCommonPropsHolder().setStyle(defStyleAttr, defStyleRes); component.loadStyle(c, defStyleAttr, defStyleRes); } }
parentContext.isNestedTreeResolutionExperimentEnabled() ? parentContext : node.getContext(),
if (context.isNestedTreeResolutionExperimentEnabled() && root != null) {
if (context.isNestedTreeResolutionExperimentEnabled()) { if (node.getParent() != null) { context = node.getParent().getContext();