Skip to content

Commit acdc92b

Browse files
add justify content stretch and more test cases
1 parent ded011f commit acdc92b

File tree

8 files changed

+614
-34
lines changed

8 files changed

+614
-34
lines changed

gentest/fixtures/YGGridTest.html

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div
2-
id="grid_template_all_properties_2"
2+
id="grid_template_all_properties"
33
style="
44
display: grid;
55
grid-template-rows: 100px 100px 100px;
@@ -25,3 +25,32 @@
2525
"></div>
2626
<div></div>
2727
</div>
28+
29+
<div
30+
id="grid_template_auto_tracks"
31+
style="
32+
display: grid;
33+
width: 220px;
34+
height: 160px;
35+
grid-template-columns: auto 100px;
36+
grid-template-rows: 50px auto;
37+
justify-content: stretch;
38+
">
39+
<div style="height: 50px; padding: 10px"></div>
40+
<div></div>
41+
<div></div>
42+
</div>
43+
44+
<div
45+
id="grid_template_auto_tracks_with_gap"
46+
style="
47+
display: grid;
48+
grid-template-columns: auto auto;
49+
grid-template-rows: auto auto;
50+
column-gap: 10px;
51+
row-gap: 15px;
52+
">
53+
<div style="width: 120px; height: 40px"></div>
54+
<div style="width: 120px; height: 40px"></div>
55+
<div style="padding: 40px"></div>
56+
</div>

gentest/gentest-cpp.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
152152
YGJustifySpaceAround: {value: 'YGJustifySpaceAround'},
153153
YGJustifySpaceBetween: {value: 'YGJustifySpaceBetween'},
154154
YGJustifySpaceEvenly: {value: 'YGJustifySpaceEvenly'},
155+
YGJustifyStretch: {value: 'YGJustifyStretch'},
155156

156157
YGOverflowHidden: {value: 'YGOverflowHidden'},
157158
YGOverflowVisible: {value: 'YGOverflowVisible'},
@@ -543,9 +544,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
543544
this.push(
544545
`YGNodeStyleSetGridTemplateRows(${nodeName}, ${nodeName}_gridTemplateRows);`,
545546
);
546-
this.push(
547-
`YGGridTrackListFree(${nodeName}_gridTemplateRows);`,
548-
);
547+
this.push(`YGGridTrackListFree(${nodeName}_gridTemplateRows);`);
549548
},
550549
},
551550

@@ -560,7 +559,9 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
560559
return;
561560
}
562561

563-
this.push(`auto ${nodeName}_gridTemplateColumns = YGGridTrackListCreate();`);
562+
this.push(
563+
`auto ${nodeName}_gridTemplateColumns = YGGridTrackListCreate();`,
564+
);
564565

565566
for (const track of tracks) {
566567
if (track.type === 'minmax') {
@@ -580,9 +581,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
580581
this.push(
581582
`YGNodeStyleSetGridTemplateColumns(${nodeName}, ${nodeName}_gridTemplateColumns);`,
582583
);
583-
this.push(
584-
`YGGridTrackListFree(${nodeName}_gridTemplateColumns);`,
585-
);
584+
this.push(`YGGridTrackListFree(${nodeName}_gridTemplateColumns);`);
586585
},
587586
},
588587

@@ -641,9 +640,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
641640
this.push(
642641
`YGNodeStyleSetGridAutoColumns(${nodeName}, ${nodeName}_gridAutoColumns);`,
643642
);
644-
this.push(
645-
`YGGridTrackListFree(${nodeName}_gridAutoColumns);`,
646-
);
643+
this.push(`YGGridTrackListFree(${nodeName}_gridAutoColumns);`);
647644
},
648645
},
649646

@@ -678,9 +675,7 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
678675
this.push(
679676
`YGNodeStyleSetGridAutoRows(${nodeName}, ${nodeName}_gridAutoRows);`,
680677
);
681-
this.push(
682-
`YGGridTrackListFree(${nodeName}_gridAutoRows);`,
683-
);
678+
this.push(`YGGridTrackListFree(${nodeName}_gridAutoRows);`);
684679
},
685680
},
686681

gentest/gentest-java.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
193193
YGJustifySpaceAround: {value: 'YogaJustify.SPACE_AROUND'},
194194
YGJustifySpaceBetween: {value: 'YogaJustify.SPACE_BETWEEN'},
195195
YGJustifySpaceEvenly: {value: 'YogaJustify.SPACE_EVENLY'},
196+
YGJustifyStretch: {value: 'YogaJustify.STRETCH'},
196197

197198
YGOverflowHidden: {value: 'YogaOverflow.HIDDEN'},
198199
YGOverflowVisible: {value: 'YogaOverflow.VISIBLE'},
@@ -598,9 +599,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
598599
}
599600
}
600601

601-
this.push(
602-
`${nodeName}.setGridAutoColumns(${nodeName}GridAutoColumns);`,
603-
);
602+
this.push(`${nodeName}.setGridAutoColumns(${nodeName}GridAutoColumns);`);
604603
},
605604
},
606605

@@ -627,9 +626,7 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
627626
}
628627
}
629628

630-
this.push(
631-
`${nodeName}.setGridAutoRows(${nodeName}GridAutoRows);`,
632-
);
629+
this.push(`${nodeName}.setGridAutoRows(${nodeName}GridAutoRows);`);
633630
},
634631
},
635632

gentest/gentest-javascript.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
156156
YGJustifySpaceAround: {value: 'Justify.SpaceAround'},
157157
YGJustifySpaceBetween: {value: 'Justify.SpaceBetween'},
158158
YGJustifySpaceEvenly: {value: 'Justify.SpaceEvenly'},
159+
YGJustifyStretch: {value: 'Justify.Stretch'},
159160

160161
YGOverflowHidden: {value: 'Overflow.Hidden'},
161162
YGOverflowVisible: {value: 'Overflow.Visible'},
@@ -555,9 +556,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
555556
}
556557
}
557558

558-
this.push(
559-
`${nodeName}.setGridAutoColumns(${nodeName}GridAutoColumns);`,
560-
);
559+
this.push(`${nodeName}.setGridAutoColumns(${nodeName}GridAutoColumns);`);
561560
},
562561
},
563562

@@ -582,9 +581,7 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
582581
}
583582
}
584583

585-
this.push(
586-
`${nodeName}.setGridAutoRows(${nodeName}GridAutoRows);`,
587-
);
584+
this.push(`${nodeName}.setGridAutoRows(${nodeName}GridAutoRows);`);
588585
},
589586
},
590587

gentest/gentest.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,12 +541,18 @@ function setupTestTree(
541541
break;
542542
case 'grid-column-start':
543543
if (node.style[style] && node.style[style] !== 'auto') {
544-
e.YGNodeStyleSetGridColumnStart(nodeName, parseInt(node.style[style]));
544+
e.YGNodeStyleSetGridColumnStart(
545+
nodeName,
546+
parseInt(node.style[style]),
547+
);
545548
}
546549
break;
547550
case 'grid-column-end':
548551
if (node.style[style] && node.style[style] !== 'auto') {
549-
e.YGNodeStyleSetGridColumnEnd(nodeName, parseInt(node.style[style]));
552+
e.YGNodeStyleSetGridColumnEnd(
553+
nodeName,
554+
parseInt(node.style[style]),
555+
);
550556
}
551557
break;
552558
case 'grid-row-start':
@@ -649,6 +655,8 @@ function justifyValue(e, value) {
649655
return e.YGJustifyFlexStart;
650656
case 'flex-end':
651657
return e.YGJustifyFlexEnd;
658+
case 'stretch':
659+
return e.YGJustifyStretch;
652660
}
653661
}
654662

0 commit comments

Comments
 (0)