44 * This source code is licensed under the MIT license found in the
55 * LICENSE file in the root directory of this source tree.
66 *
7- * @generated SignedSource<<87d73cbdff20a1dee711fdd1da51ceb9 >>
7+ * @generated SignedSource<<b4a0bba40273bb15f970b49ef1637a20 >>
88 * generated by gentest/gentest-driver.ts from gentest/fixtures/YGGridTest.html
99 */
1010
@@ -28,7 +28,7 @@ public static Iterable<TestParametrization.NodeFactory> nodeFactories() {
2828 @ Parameterized .Parameter public TestParametrization .NodeFactory mNodeFactory ;
2929
3030 @ Test
31- public void test_grid_template_all_properties () {
31+ public void test_grid_all_properties () {
3232 YogaConfig config = YogaConfigFactory .create ();
3333
3434 final YogaNode root = createNode (config );
@@ -159,7 +159,7 @@ public void test_grid_template_all_properties() {
159159 }
160160
161161 @ Test
162- public void test_grid_template_auto_tracks () {
162+ public void test_grid_auto_tracks () {
163163 YogaConfig config = YogaConfigFactory .create ();
164164
165165 final YogaNode root = createNode (config );
@@ -253,7 +253,7 @@ public void test_grid_template_auto_tracks() {
253253 }
254254
255255 @ Test
256- public void test_grid_template_auto_tracks_with_gap () {
256+ public void test_grid_auto_tracks_with_gap () {
257257 YogaConfig config = YogaConfigFactory .create ();
258258
259259 final YogaNode root = createNode (config );
@@ -347,6 +347,206 @@ public void test_grid_template_auto_tracks_with_gap() {
347347 assertEquals (80f , root_child2 .getLayoutHeight (), 0.0f );
348348 }
349349
350+ @ Test
351+ public void test_grid_auto_tracks_with_margins () {
352+ YogaConfig config = YogaConfigFactory .create ();
353+
354+ final YogaNode root = createNode (config );
355+ root .setPositionType (YogaPositionType .ABSOLUTE );
356+ root .setGap (YogaGutter .COLUMN , 10f );
357+ root .setGap (YogaGutter .ROW , 15f );
358+ root .setDisplay (YogaDisplay .GRID );
359+ YogaGridTrackList rootGridTemplateColumns = new YogaGridTrackList ();
360+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
361+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
362+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
363+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
364+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
365+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
366+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
367+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
368+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
369+ root .setGridTemplateColumns (rootGridTemplateColumns );
370+ YogaGridTrackList rootGridTemplateRows = new YogaGridTrackList ();
371+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
372+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
373+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
374+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
375+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
376+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
377+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
378+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
379+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
380+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
381+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
382+ root .setGridTemplateRows (rootGridTemplateRows );
383+
384+ final YogaNode root_child0 = createNode (config );
385+ root_child0 .setMargin (YogaEdge .TOP , 10f );
386+ root_child0 .setWidth (120f );
387+ root_child0 .setHeight (40f );
388+ root .addChildAt (root_child0 , 0 );
389+
390+ final YogaNode root_child1 = createNode (config );
391+ root_child1 .setMargin (YogaEdge .TOP , 10f );
392+ root_child1 .setWidth (120f );
393+ root_child1 .setHeight (40f );
394+ root .addChildAt (root_child1 , 1 );
395+
396+ final YogaNode root_child2 = createNode (config );
397+ root_child2 .setPadding (YogaEdge .LEFT , 40 );
398+ root_child2 .setPadding (YogaEdge .TOP , 40 );
399+ root_child2 .setPadding (YogaEdge .RIGHT , 40 );
400+ root_child2 .setPadding (YogaEdge .BOTTOM , 40 );
401+ root .addChildAt (root_child2 , 2 );
402+ root .setDirection (YogaDirection .LTR );
403+ root .calculateLayout (YogaConstants .UNDEFINED , YogaConstants .UNDEFINED );
404+
405+ assertEquals (0f , root .getLayoutX (), 0.0f );
406+ assertEquals (0f , root .getLayoutY (), 0.0f );
407+ assertEquals (250f , root .getLayoutWidth (), 0.0f );
408+ assertEquals (415f , root .getLayoutHeight (), 0.0f );
409+
410+ assertEquals (0f , root_child0 .getLayoutX (), 0.0f );
411+ assertEquals (10f , root_child0 .getLayoutY (), 0.0f );
412+ assertEquals (120f , root_child0 .getLayoutWidth (), 0.0f );
413+ assertEquals (40f , root_child0 .getLayoutHeight (), 0.0f );
414+
415+ assertEquals (130f , root_child1 .getLayoutX (), 0.0f );
416+ assertEquals (10f , root_child1 .getLayoutY (), 0.0f );
417+ assertEquals (120f , root_child1 .getLayoutWidth (), 0.0f );
418+ assertEquals (40f , root_child1 .getLayoutHeight (), 0.0f );
419+
420+ assertEquals (0f , root_child2 .getLayoutX (), 0.0f );
421+ assertEquals (215f , root_child2 .getLayoutY (), 0.0f );
422+ assertEquals (120f , root_child2 .getLayoutWidth (), 0.0f );
423+ assertEquals (200f , root_child2 .getLayoutHeight (), 0.0f );
424+
425+ root .setDirection (YogaDirection .RTL );
426+ root .calculateLayout (YogaConstants .UNDEFINED , YogaConstants .UNDEFINED );
427+
428+ assertEquals (0f , root .getLayoutX (), 0.0f );
429+ assertEquals (0f , root .getLayoutY (), 0.0f );
430+ assertEquals (250f , root .getLayoutWidth (), 0.0f );
431+ assertEquals (415f , root .getLayoutHeight (), 0.0f );
432+
433+ assertEquals (130f , root_child0 .getLayoutX (), 0.0f );
434+ assertEquals (10f , root_child0 .getLayoutY (), 0.0f );
435+ assertEquals (120f , root_child0 .getLayoutWidth (), 0.0f );
436+ assertEquals (40f , root_child0 .getLayoutHeight (), 0.0f );
437+
438+ assertEquals (0f , root_child1 .getLayoutX (), 0.0f );
439+ assertEquals (10f , root_child1 .getLayoutY (), 0.0f );
440+ assertEquals (120f , root_child1 .getLayoutWidth (), 0.0f );
441+ assertEquals (40f , root_child1 .getLayoutHeight (), 0.0f );
442+
443+ assertEquals (130f , root_child2 .getLayoutX (), 0.0f );
444+ assertEquals (215f , root_child2 .getLayoutY (), 0.0f );
445+ assertEquals (120f , root_child2 .getLayoutWidth (), 0.0f );
446+ assertEquals (200f , root_child2 .getLayoutHeight (), 0.0f );
447+ }
448+
449+ @ Test
450+ public void test_grid_spanning_items () {
451+ YogaConfig config = YogaConfigFactory .create ();
452+
453+ final YogaNode root = createNode (config );
454+ root .setPositionType (YogaPositionType .ABSOLUTE );
455+ root .setGap (YogaGutter .COLUMN , 10f );
456+ root .setGap (YogaGutter .ROW , 10f );
457+ root .setDisplay (YogaDisplay .GRID );
458+ YogaGridTrackList rootGridTemplateColumns = new YogaGridTrackList ();
459+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
460+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
461+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
462+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
463+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
464+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
465+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
466+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
467+ rootGridTemplateColumns .addTrack (YogaGridTrackValue .auto ());
468+ root .setGridTemplateColumns (rootGridTemplateColumns );
469+ YogaGridTrackList rootGridTemplateRows = new YogaGridTrackList ();
470+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
471+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
472+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
473+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
474+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
475+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
476+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
477+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
478+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
479+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
480+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
481+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
482+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
483+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
484+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
485+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
486+ rootGridTemplateRows .addTrack (YogaGridTrackValue .auto ());
487+ root .setGridTemplateRows (rootGridTemplateRows );
488+
489+ final YogaNode root_child0 = createNode (config );
490+ root .addChildAt (root_child0 , 0 );
491+
492+ final YogaNode root_child1 = createNode (config );
493+ root_child1 .setPadding (YogaEdge .LEFT , 40 );
494+ root_child1 .setPadding (YogaEdge .TOP , 40 );
495+ root_child1 .setPadding (YogaEdge .RIGHT , 40 );
496+ root_child1 .setPadding (YogaEdge .BOTTOM , 40 );
497+ root .addChildAt (root_child1 , 1 );
498+
499+ final YogaNode root_child2 = createNode (config );
500+ root_child2 .setWidth (100f );
501+ root_child2 .setHeight (100f );
502+ root .addChildAt (root_child2 , 2 );
503+ root .setDirection (YogaDirection .LTR );
504+ root .calculateLayout (YogaConstants .UNDEFINED , YogaConstants .UNDEFINED );
505+
506+ assertEquals (0f , root .getLayoutX (), 0.0f );
507+ assertEquals (0f , root .getLayoutY (), 0.0f );
508+ assertEquals (220f , root .getLayoutWidth (), 0.0f );
509+ assertEquals (320f , root .getLayoutHeight (), 0.0f );
510+
511+ assertEquals (0f , root_child0 .getLayoutX (), 0.0f );
512+ assertEquals (0f , root_child0 .getLayoutY (), 0.0f );
513+ assertEquals (220f , root_child0 .getLayoutWidth (), 0.0f );
514+ assertEquals (210f , root_child0 .getLayoutHeight (), 0.0f );
515+
516+ assertEquals (0f , root_child1 .getLayoutX (), 0.0f );
517+ assertEquals (220f , root_child1 .getLayoutY (), 0.0f );
518+ assertEquals (80f , root_child1 .getLayoutWidth (), 0.0f );
519+ assertEquals (100f , root_child1 .getLayoutHeight (), 0.0f );
520+
521+ assertEquals (90f , root_child2 .getLayoutX (), 0.0f );
522+ assertEquals (220f , root_child2 .getLayoutY (), 0.0f );
523+ assertEquals (100f , root_child2 .getLayoutWidth (), 0.0f );
524+ assertEquals (100f , root_child2 .getLayoutHeight (), 0.0f );
525+
526+ root .setDirection (YogaDirection .RTL );
527+ root .calculateLayout (YogaConstants .UNDEFINED , YogaConstants .UNDEFINED );
528+
529+ assertEquals (0f , root .getLayoutX (), 0.0f );
530+ assertEquals (0f , root .getLayoutY (), 0.0f );
531+ assertEquals (220f , root .getLayoutWidth (), 0.0f );
532+ assertEquals (320f , root .getLayoutHeight (), 0.0f );
533+
534+ assertEquals (0f , root_child0 .getLayoutX (), 0.0f );
535+ assertEquals (0f , root_child0 .getLayoutY (), 0.0f );
536+ assertEquals (220f , root_child0 .getLayoutWidth (), 0.0f );
537+ assertEquals (210f , root_child0 .getLayoutHeight (), 0.0f );
538+
539+ assertEquals (140f , root_child1 .getLayoutX (), 0.0f );
540+ assertEquals (220f , root_child1 .getLayoutY (), 0.0f );
541+ assertEquals (80f , root_child1 .getLayoutWidth (), 0.0f );
542+ assertEquals (100f , root_child1 .getLayoutHeight (), 0.0f );
543+
544+ assertEquals (30f , root_child2 .getLayoutX (), 0.0f );
545+ assertEquals (220f , root_child2 .getLayoutY (), 0.0f );
546+ assertEquals (100f , root_child2 .getLayoutWidth (), 0.0f );
547+ assertEquals (100f , root_child2 .getLayoutHeight (), 0.0f );
548+ }
549+
350550 private YogaNode createNode (YogaConfig config ) {
351551 return mNodeFactory .create (config );
352552 }
0 commit comments