作者热门文章
- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.facebook.yoga.YogaMeasureFunction
类的一些代码示例,展示了YogaMeasureFunction
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YogaMeasureFunction
类的具体详情如下:
包路径:com.facebook.yoga.YogaMeasureFunction
类名称:YogaMeasureFunction
暂无
代码示例来源:origin: facebook/litho
private long measureInternalNode(
InternalNode node,
float widthConstranint,
float heightConstraint) {
final YogaMeasureFunction measureFunc =
Whitebox.getInternalState(
node.mYogaNode,
"mMeasureFunction");
return measureFunc.measure(
node.mYogaNode,
widthConstranint,
EXACTLY,
heightConstraint,
EXACTLY);
}
代码示例来源:origin: facebook/litho
@Test
public void testOnMeasureNotOverriden() {
Component component = setUpSpyComponentForCreateLayout(true, true);
YogaMeasureFunction measureFunction = getMeasureFunction(component);
try {
measureFunction.measure(mNode.mYogaNode, 0, EXACTLY, 0, EXACTLY);
fail();
} catch (Exception e) {
assertThat(e).isExactlyInstanceOf(IllegalStateException.class);
assertThat(e.getMessage()).contains("canMeasure()");
}
}
代码示例来源:origin: facebook/litho
@Test
public void testMountSpecYogaMeasureOutputNotSet() {
Component component = new TestMountSpecWithEmptyOnMeasure(mNode);
YogaMeasureFunction measureFunction = getMeasureFunction(component);
try {
measureFunction.measure(mNode.mYogaNode, 0, EXACTLY, 0, EXACTLY);
fail();
} catch (Exception e) {
assertThat(e).isExactlyInstanceOf(IllegalStateException.class);
assertThat(e.getMessage()).contains("MeasureOutput not set");
}
}
代码示例来源: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 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 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: koudle/AndYogaSample
@DoNotStrip
public final long measure(float width, int widthMode, float height, int heightMode) {
if (!isMeasureDefined()) {
throw new RuntimeException("Measure function isn't defined!");
}
return mMeasureFunction.measure(
this,
width,
YogaMeasureMode.values()[widthMode],
height,
YogaMeasureMode.values()[heightMode]);
}
本文整理了Java中com.facebook.yoga.YogaMeasureFunction.measure()方法的一些代码示例,展示了YogaMeasureFunction.measure()的
我是一名优秀的程序员,十分优秀!