2024-06-26 10:00:17 -07:00
/ * *
* Copyright ( c ) Meta Platforms , Inc . and affiliates .
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree .
*
2024-11-20 17:41:11 -08:00
* @generated SignedSource << e165faa25cdd4618d230e89144e2d780 >>
2024-06-26 10:00:17 -07:00
* generated by gentest / gentest - driver . ts from gentest / fixtures / YGIntrinsicSizeTest . html
* /
import { instrinsicSizeMeasureFunc } from '../tools/utils.ts'
import Yoga from 'yoga-layout' ;
import {
Align ,
2024-09-25 15:46:55 -07:00
BoxSizing ,
2024-06-26 10:00:17 -07:00
Direction ,
Display ,
Edge ,
Errata ,
ExperimentalFeature ,
FlexDirection ,
Gutter ,
Justify ,
MeasureMode ,
Overflow ,
PositionType ,
Unit ,
Wrap ,
} from 'yoga-layout' ;
test ( 'contains_inner_text_long_word' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "LoremipsumdolorsitametconsecteturadipiscingelitSedeleifasdfettortoracauctorFuscerhoncusipsumtemporerosaliquamconsequatPraesentsoda" ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 1300 ) ;
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 ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 700 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 1300 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 10 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_no_width_no_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at volutpat libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor, vitae finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo tincidunt finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam vulputate eleifasd lectus vel varius. Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel venenatis turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed nunc malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor lobortis. Sed at consectetur ipsum." ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 70 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 70 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_no_width_no_height_long_word_in_paragraph' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at volutpat libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor, vitae finibus loremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumloremipsumlorem Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo tincidunt finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam vulputate eleifasd lectus vel varius. Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel venenatis turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed nunc malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor lobortis. Sed at consectetur ipsum." ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 70 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 70 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_fixed_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0 . setWidth ( 100 ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at volutpat libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor, vitae finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo tincidunt finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam vulputate eleifasd lectus vel varius. Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel venenatis turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed nunc malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor lobortis. Sed at consectetur ipsum." ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 1290 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 1900 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 1290 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_no_width_fixed_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0 . setHeight ( 20 ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at volutpat libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor, vitae finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo tincidunt finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam vulputate eleifasd lectus vel varius. Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel venenatis turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed nunc malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor lobortis. Sed at consectetur ipsum." ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_fixed_width_fixed_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 20 ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at volutpat libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor, vitae finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo tincidunt finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam vulputate eleifasd lectus vel varius. Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel venenatis turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed nunc malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor lobortis. Sed at consectetur ipsum." ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 1950 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_max_width_max_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0 . setMaxWidth ( 50 ) ;
root_child0 . setMaxHeight ( 20 ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at volutpat libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor, vitae finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo tincidunt finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam vulputate eleifasd lectus vel varius. Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel venenatis turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed nunc malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor lobortis. Sed at consectetur ipsum." ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 1950 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_max_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0 . setMaxWidth ( 100 ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at volutpat libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor, vitae finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo tincidunt finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam vulputate eleifasd lectus vel varius. Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel venenatis turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed nunc malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor lobortis. Sed at consectetur ipsum." ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 1290 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 1900 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 1290 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_fixed_width_shorter_text' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0 . setWidth ( 100 ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum" ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 1900 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_fixed_height_shorter_text' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0 . setHeight ( 100 ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum" ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 110 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 100 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 1890 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 110 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 100 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'contains_inner_text_max_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setAlignItems ( Align . FlexStart ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setWidth ( 2000 ) ;
root . setHeight ( 2000 ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0 . setMaxHeight ( 20 ) ;
root . insertChild ( root_child0 , 0 ) ;
root_child0 . setMeasureFunc ( instrinsicSizeMeasureFunc . bind ( "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eleifasd et tortor ac auctor. Integer at volutpat libero, sed elementum dui interdum id. Aliquam consectetur massa vel neque aliquet, quis consequat risus fringilla. Fusce rhoncus ipsum tempor eros aliquam, vel tempus metus ullamcorper. Nam at nulla sed tellus vestibulum fringilla vel sit amet ligula. Proin velit lectus, euismod sit amet quam vel ultricies dolor, vitae finibus lorem ipsum. Pellentesque molestie at mi sit amet dictum. Donec vehicula lacinia felis sit amet consectetur. Praesent sodales enim sapien, sed varius ipsum pellentesque vel. Aenean eu mi eu justo tincidunt finibus vel sit amet ipsum. Sed bibasdum purus vel ipsum sagittis, quis fermentum dolor lobortis. Etiam vulputate eleifasd lectus vel varius. Phasellus imperdiet lectus sit amet ipsum egestas, ut bibasdum ipsum malesuada. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed mollis eros sit amet elit porttitor, vel venenatis turpis venenatis. Nulla tempus tortor at eros efficitur, sit amet dapibus ipsum malesuada. Ut at mauris sed nunc malesuada convallis. Duis id sem vel magna varius eleifasd vel at est. Donec eget orci a ipsum tempor lobortis. Sed at consectetur ipsum." ) ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 2000 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 20 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
2024-11-04 16:02:37 -08:00
test ( 'max_content_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setFlexDirection ( FlexDirection . Row ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setFlexWrap ( Wrap . Wrap ) ;
root . setWidth ( "max-content" ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 50 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child1 = Yoga . Node . create ( config ) ;
root_child1 . setWidth ( 100 ) ;
root_child1 . setHeight ( 50 ) ;
root . insertChild ( root_child1 , 1 ) ;
const root_child2 = Yoga . Node . create ( config ) ;
root_child2 . setWidth ( 25 ) ;
root_child2 . setHeight ( 50 ) ;
root . insertChild ( root_child2 , 2 ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 175 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 175 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 125 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 25 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'fit_content_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setWidth ( 90 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setWidth ( "fit-content" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 100 ) ;
root_child0_child0_child1 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 25 ) ;
root_child0_child0_child2 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 150 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( - 10 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 75 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'stretch_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setWidth ( 500 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setWidth ( "stretch" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 100 ) ;
root_child0_child0_child1 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 25 ) ;
root_child0_child0_child2 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 450 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 350 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 325 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'max_content_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setFlexWrap ( Wrap . Wrap ) ;
root . setHeight ( "max-content" ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 50 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child1 = Yoga . Node . create ( config ) ;
root_child1 . setWidth ( 50 ) ;
root_child1 . setHeight ( 100 ) ;
root . insertChild ( root_child1 , 1 ) ;
const root_child2 = Yoga . Node . create ( config ) ;
root_child2 . setWidth ( 50 ) ;
root_child2 . setHeight ( 25 ) ;
root . insertChild ( root_child2 , 2 ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'fit_content_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setHeight ( 90 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setHeight ( "fit-content" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 50 ) ;
root_child0_child0_child1 . setHeight ( 100 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 50 ) ;
root_child0_child0_child2 . setHeight ( 25 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'stretch_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setHeight ( 500 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setHeight ( "stretch" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 50 ) ;
root_child0_child0_child1 . setHeight ( 100 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 50 ) ;
root_child0_child0_child2 . setHeight ( 25 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test ( 'max_content_flex_basis_column' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setFlexWrap ( Wrap . Wrap ) ;
root . setFlexBasis ( "max-content" ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 50 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child1 = Yoga . Node . create ( config ) ;
root_child1 . setWidth ( 50 ) ;
root_child1 . setHeight ( 100 ) ;
root . insertChild ( root_child1 , 1 ) ;
const root_child2 = Yoga . Node . create ( config ) ;
root_child2 . setWidth ( 50 ) ;
root_child2 . setHeight ( 25 ) ;
root . insertChild ( root_child2 , 2 ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'fit_content_flex_basis_column' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setHeight ( 90 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setFlexBasis ( "fit-content" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 50 ) ;
root_child0_child0_child1 . setHeight ( 100 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 50 ) ;
root_child0_child0_child2 . setHeight ( 25 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'stretch_flex_basis_column' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setHeight ( 500 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 50 ) ;
root_child0_child0_child1 . setHeight ( 100 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 50 ) ;
root_child0_child0_child2 . setHeight ( 25 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
2024-11-20 17:41:11 -08:00
test . skip ( 'max_content_flex_basis_row' , ( ) = > {
2024-11-04 16:02:37 -08:00
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setFlexDirection ( FlexDirection . Row ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setFlexWrap ( Wrap . Wrap ) ;
root . setFlexBasis ( "max-content" ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 50 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child1 = Yoga . Node . create ( config ) ;
root_child1 . setWidth ( 100 ) ;
root_child1 . setHeight ( 500 ) ;
root . insertChild ( root_child1 , 1 ) ;
const root_child2 = Yoga . Node . create ( config ) ;
root_child2 . setWidth ( 25 ) ;
root_child2 . setHeight ( 50 ) ;
root . insertChild ( root_child2 , 2 ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 600 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 550 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 600 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 75 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 550 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'fit_content_flex_basis_row' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setWidth ( 90 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setFlexBasis ( "fit-content" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 100 ) ;
root_child0_child0_child1 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 25 ) ;
root_child0_child0_child2 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 40 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( - 10 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 65 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'stretch_flex_basis_row' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setWidth ( 500 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 100 ) ;
root_child0_child0_child1 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 25 ) ;
root_child0_child0_child2 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 450 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 350 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 325 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'max_content_max_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setFlexDirection ( FlexDirection . Row ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setFlexWrap ( Wrap . Wrap ) ;
root . setWidth ( 200 ) ;
root . setMaxWidth ( "max-content" ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 50 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child1 = Yoga . Node . create ( config ) ;
root_child1 . setWidth ( 100 ) ;
root_child1 . setHeight ( 50 ) ;
root . insertChild ( root_child1 , 1 ) ;
const root_child2 = Yoga . Node . create ( config ) ;
root_child2 . setWidth ( 25 ) ;
root_child2 . setHeight ( 50 ) ;
root . insertChild ( root_child2 , 2 ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 175 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 175 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 125 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 25 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'fit_content_max_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setWidth ( 90 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setWidth ( 110 ) ;
root_child0_child0 . setMaxWidth ( "fit-content" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 100 ) ;
root_child0_child0_child1 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 25 ) ;
root_child0_child0_child2 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 150 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( - 10 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 75 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'stretch_max_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setWidth ( 500 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setWidth ( 600 ) ;
root_child0_child0 . setMaxWidth ( "stretch" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 100 ) ;
root_child0_child0_child1 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 25 ) ;
root_child0_child0_child2 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 450 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 350 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 325 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'max_content_min_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setFlexDirection ( FlexDirection . Row ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setFlexWrap ( Wrap . Wrap ) ;
root . setWidth ( 100 ) ;
root . setMinWidth ( "max-content" ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 50 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child1 = Yoga . Node . create ( config ) ;
root_child1 . setWidth ( 100 ) ;
root_child1 . setHeight ( 50 ) ;
root . insertChild ( root_child1 , 1 ) ;
const root_child2 = Yoga . Node . create ( config ) ;
root_child2 . setWidth ( 25 ) ;
root_child2 . setHeight ( 50 ) ;
root . insertChild ( root_child2 , 2 ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 175 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 175 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 125 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 25 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'fit_content_min_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 90 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setWidth ( 90 ) ;
root_child0_child0 . setMinWidth ( "fit-content" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 100 ) ;
root_child0_child0_child1 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 25 ) ;
root_child0_child0_child2 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 90 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 150 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( - 10 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 75 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'stretch_min_width' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setWidth ( 500 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexDirection ( FlexDirection . Row ) ;
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setWidth ( 400 ) ;
root_child0_child0 . setMinWidth ( "stretch" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 100 ) ;
root_child0_child0_child1 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 25 ) ;
root_child0_child0_child2 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 450 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 350 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 325 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 25 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'max_content_max_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setFlexWrap ( Wrap . Wrap ) ;
root . setHeight ( 200 ) ;
root . setMaxHeight ( "max-content" ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 50 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child1 = Yoga . Node . create ( config ) ;
root_child1 . setWidth ( 50 ) ;
root_child1 . setHeight ( 100 ) ;
root . insertChild ( root_child1 , 1 ) ;
const root_child2 = Yoga . Node . create ( config ) ;
root_child2 . setWidth ( 50 ) ;
root_child2 . setHeight ( 25 ) ;
root . insertChild ( root_child2 , 2 ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'fit_content_max_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setHeight ( 90 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setHeight ( 110 ) ;
root_child0_child0 . setMaxHeight ( "fit-content" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 50 ) ;
root_child0_child0_child1 . setHeight ( 100 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 50 ) ;
root_child0_child0_child2 . setHeight ( 25 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 100 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( - 50 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( - 100 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'stretch_max_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setHeight ( 500 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setHeight ( 600 ) ;
root_child0_child0 . setMaxHeight ( "stretch" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 50 ) ;
root_child0_child0_child1 . setHeight ( 100 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 50 ) ;
root_child0_child0_child2 . setHeight ( 25 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 600 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 600 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'max_content_min_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
root . setPositionType ( PositionType . Absolute ) ;
root . setFlexWrap ( Wrap . Wrap ) ;
root . setHeight ( 100 ) ;
root . setMinHeight ( "max-content" ) ;
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setWidth ( 50 ) ;
root_child0 . setHeight ( 50 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child1 = Yoga . Node . create ( config ) ;
root_child1 . setWidth ( 50 ) ;
root_child1 . setHeight ( 100 ) ;
root . insertChild ( root_child1 , 1 ) ;
const root_child2 = Yoga . Node . create ( config ) ;
root_child2 . setWidth ( 50 ) ;
root_child2 . setHeight ( 25 ) ;
root . insertChild ( root_child2 , 2 ) ;
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'fit_content_min_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
root_child0 . setHeight ( 90 ) ;
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setHeight ( 90 ) ;
root_child0_child0 . setMinHeight ( "fit-content" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 50 ) ;
root_child0_child0_child1 . setHeight ( 100 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 50 ) ;
root_child0_child0_child2 . setHeight ( 25 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 90 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 90 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 175 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;
test . skip ( 'stretch_min_height' , ( ) = > {
const config = Yoga . Config . create ( ) ;
let root ;
try {
root = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root . setPositionType ( PositionType . Absolute ) ;
2024-11-04 16:02:37 -08:00
const root_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0 . setHeight ( 500 ) ;
2024-11-04 16:02:37 -08:00
root . insertChild ( root_child0 , 0 ) ;
const root_child0_child0 = Yoga . Node . create ( config ) ;
2024-11-20 17:41:11 -08:00
root_child0_child0 . setFlexWrap ( Wrap . Wrap ) ;
root_child0_child0 . setHeight ( 400 ) ;
root_child0_child0 . setMinHeight ( "stretch" ) ;
2024-11-04 16:02:37 -08:00
root_child0 . insertChild ( root_child0_child0 , 0 ) ;
2024-11-20 17:41:11 -08:00
const root_child0_child0_child0 = Yoga . Node . create ( config ) ;
root_child0_child0_child0 . setWidth ( 50 ) ;
root_child0_child0_child0 . setHeight ( 50 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child0 , 0 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
const root_child0_child0_child1 = Yoga . Node . create ( config ) ;
root_child0_child0_child1 . setWidth ( 50 ) ;
root_child0_child0_child1 . setHeight ( 100 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child1 , 1 ) ;
const root_child0_child0_child2 = Yoga . Node . create ( config ) ;
root_child0_child0_child2 . setWidth ( 50 ) ;
root_child0_child0_child2 . setHeight ( 25 ) ;
root_child0_child0 . insertChild ( root_child0_child0_child2 , 2 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . LTR ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 400 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
root . calculateLayout ( undefined , undefined , Direction . RTL ) ;
expect ( root . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-04 16:02:37 -08:00
expect ( root . getComputedHeight ( ) ) . toBe ( 500 ) ;
expect ( root_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0 . getComputedHeight ( ) ) . toBe ( 500 ) ;
2024-11-04 16:02:37 -08:00
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
2024-11-04 16:02:37 -08:00
expect ( root_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
2024-11-20 17:41:11 -08:00
expect ( root_child0_child0 . getComputedHeight ( ) ) . toBe ( 400 ) ;
expect ( root_child0_child0_child0 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedTop ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child0 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child0 . getComputedHeight ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child1 . getComputedTop ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child1 . getComputedHeight ( ) ) . toBe ( 100 ) ;
expect ( root_child0_child0_child2 . getComputedLeft ( ) ) . toBe ( 0 ) ;
expect ( root_child0_child0_child2 . getComputedTop ( ) ) . toBe ( 150 ) ;
expect ( root_child0_child0_child2 . getComputedWidth ( ) ) . toBe ( 50 ) ;
expect ( root_child0_child0_child2 . getComputedHeight ( ) ) . toBe ( 25 ) ;
2024-11-04 16:02:37 -08:00
} finally {
if ( typeof root !== 'undefined' ) {
root . freeRecursive ( ) ;
}
config . free ( ) ;
}
} ) ;