本文整理了Java中com.facebook.yoga.YogaMeasureOutput.getHeight()
方法的一些代码示例,展示了YogaMeasureOutput.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YogaMeasureOutput.getHeight()
方法的具体详情如下:
包路径:com.facebook.yoga.YogaMeasureOutput
类名称:YogaMeasureOutput
方法名:getHeight
暂无
代码示例来源:origin: facebook/litho
@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);
}
代码示例来源:origin: facebook/litho
@Test
public void testLayoutSpecMeasureResolveNestedTree() {
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);
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);
}
代码示例来源:origin: facebook/litho
@Test
public void measureAndCreateDiffNode() {
final Component component = TestDrawableComponent.create(mContext)
.build();
InternalNode node = createInternalNodeForMeasurableComponent(component);
long output = measureInternalNode(
node,
UNDEFINED,
UNDEFINED);
node.setCachedMeasuresValid(false);
DiffNode diffNode = createDiffNode(node, null);
assertThat(getHeight(output) == (int) diffNode.getLastMeasuredHeight()).isTrue();
assertThat(getWidth(output) == (int) diffNode.getLastMeasuredWidth()).isTrue();
}
代码示例来源:origin: facebook/litho
@Test
public void testMountSpecYogaMeasureOutputSet() {
Component component = new TestMountSpecSettingSizesInOnMeasure(mNode);
YogaMeasureFunction measureFunction = getMeasureFunction(component);
long output = measureFunction.measure(mNode.mYogaNode, 0, EXACTLY, 0, EXACTLY);
assertThat(YogaMeasureOutput.getWidth(output)).isEqualTo(A_WIDTH);
assertThat(YogaMeasureOutput.getHeight(output)).isEqualTo(A_HEIGHT);
}
代码示例来源:origin: facebook/litho
@Test
public void tesLastConstraints() {
final Component component = TestDrawableComponent.create(mContext)
.build();
InternalNode node = createInternalNodeForMeasurableComponent(component);
DiffNode diffNode = new DiffNode();
diffNode.setLastWidthSpec(makeSizeSpec(10, SizeSpec.EXACTLY));
diffNode.setLastHeightSpec(makeSizeSpec(5, SizeSpec.EXACTLY));
diffNode.setLastMeasuredWidth(10f);
diffNode.setLastMeasuredHeight(5f);
diffNode.setComponent(component);
node.setCachedMeasuresValid(true);
node.setDiffNode(diffNode);
long output = measureInternalNode(node, 10f, 5f);
assertThat(getHeight(output) == (int) diffNode.getLastMeasuredHeight()).isTrue();
assertThat(getWidth(output) == (int) diffNode.getLastMeasuredWidth()).isTrue();
int lastWidthSpec = node.getLastWidthSpec();
int lastHeightSpec = node.getLastHeightSpec();
assertThat(getMode(lastWidthSpec) == SizeSpec.EXACTLY).isTrue();
assertThat(getMode(lastHeightSpec) == SizeSpec.EXACTLY).isTrue();
assertThat(getSize(lastWidthSpec) == 10).isTrue();
assertThat(getSize(lastHeightSpec) == 5).isTrue();
}
代码示例来源:origin: facebook/litho
@Test
public void testCachedMeasureFunction() {
final Component component = TestDrawableComponent.create(mContext)
.build();
InternalNode node = createInternalNodeForMeasurableComponent(component);
DiffNode diffNode = new DiffNode();
diffNode.setLastHeightSpec(mUnspecifiedSpec);
diffNode.setLastWidthSpec(mUnspecifiedSpec);
diffNode.setLastMeasuredWidth(10);
diffNode.setLastMeasuredHeight(5);
diffNode.setComponent(component);
node.setCachedMeasuresValid(true);
node.setDiffNode(diffNode);
long output = measureInternalNode(
node,
UNDEFINED,
UNDEFINED);
assertThat(getHeight(output) == (int) diffNode.getLastMeasuredHeight()).isTrue();
assertThat(getWidth(output) == (int) diffNode.getLastMeasuredWidth()).isTrue();
}
内容来源于网络,如有侵权,请联系作者删除!