Fix bug where leaf nodes do not bound innerWidth/Height before measure
Differential Revision: D66983314
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5478812db3
commit
7e65d7a3a1
@@ -4,7 +4,7 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<1bd782301afbab34ed3c9a296c3ecaa6>>
|
||||
* @generated SignedSource<<d9428d2e524c7d665f61ccdad7697504>>
|
||||
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGMinMaxDimensionTest.html
|
||||
*/
|
||||
|
||||
@@ -1444,3 +1444,48 @@ test('min_max_percent_no_width_height', () => {
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
test('min_width_leaf_node_bigger_than_width', () => {
|
||||
const config = Yoga.Config.create();
|
||||
let root;
|
||||
|
||||
try {
|
||||
root = Yoga.Node.create(config);
|
||||
root.setPositionType(PositionType.Absolute);
|
||||
root.setWidth(200);
|
||||
|
||||
const root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setWidth(200);
|
||||
root_child0.setMinWidth(10000);
|
||||
root.insertChild(root_child0, 0);
|
||||
root_child0.setMeasureFunc(instrinsicSizeMeasureFunc.bind("Lorem ipsum sdafhasdfkjlasdhlkajsfhasldkfhasdlkahsdflkjasdhflaksdfasdlkjhasdlfjahsdfljkasdhalsdfhas dolor sit amet"));
|
||||
root.calculateLayout(undefined, undefined, Direction.LTR);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(200);
|
||||
expect(root.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(0);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(10000);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
|
||||
root.calculateLayout(undefined, undefined, Direction.RTL);
|
||||
|
||||
expect(root.getComputedLeft()).toBe(0);
|
||||
expect(root.getComputedTop()).toBe(0);
|
||||
expect(root.getComputedWidth()).toBe(200);
|
||||
expect(root.getComputedHeight()).toBe(10);
|
||||
|
||||
expect(root_child0.getComputedLeft()).toBe(-9800);
|
||||
expect(root_child0.getComputedTop()).toBe(0);
|
||||
expect(root_child0.getComputedWidth()).toBe(10000);
|
||||
expect(root_child0.getComputedHeight()).toBe(10);
|
||||
} finally {
|
||||
if (typeof root !== 'undefined') {
|
||||
root.freeRecursive();
|
||||
}
|
||||
|
||||
config.free();
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user