MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / GridLayoutTest

Class GridLayoutTest

apps/automated/src/ui/layouts/grid-layout-tests.ts:46–836  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46export class GridLayoutTest extends testModule.UITest<RemovalTrackingGridLayout> {
47 public create(): RemovalTrackingGridLayout {
48 return new RemovalTrackingGridLayout();
49 }
50
51 public test_recycling() {
52 helper.nativeView_recycling_test(() => new GridLayout());
53 }
54
55 public test_item_recycling() {
56 helper.nativeView_recycling_test(
57 () => new Button(),
58 () => new GridLayout(),
59 );
60 }
61
62 private row(view: view.View): number {
63 return GridLayout.getRow(view);
64 }
65
66 private rowSpan(view: view.View): number {
67 return GridLayout.getRowSpan(view);
68 }
69
70 private col(view: view.View): number {
71 return GridLayout.getColumn(view);
72 }
73
74 private colSpan(view: view.View): number {
75 return GridLayout.getColumnSpan(view);
76 }
77
78 private prepareGridLayout(wait?: boolean) {
79 this.testView.addRow(new ItemSpec(1, 'star'));
80 this.testView.addRow(new ItemSpec(2, 'star'));
81 this.testView.addRow(new ItemSpec(layoutHelper.dp(50), 'pixel'));
82 this.testView.addRow(new ItemSpec(50, 'auto'));
83
84 this.testView.addColumn(new ItemSpec(1, 'star'));
85 this.testView.addColumn(new ItemSpec(2, 'star'));
86 this.testView.addColumn(new ItemSpec(layoutHelper.dp(50), 'pixel'));
87 this.testView.addColumn(new ItemSpec(50, 'auto'));
88
89 for (var r = 0; r < 4; r++) {
90 for (var c = 0; c < 4; c++) {
91 var btn = new layoutHelper.MyButton();
92 btn.text = 'R' + r + 'C' + c;
93 GridLayout.setColumn(btn, c);
94 GridLayout.setRow(btn, r);
95 if (c === 3) {
96 btn.width = { value: 100, unit: 'px' }; // Auto column should take 100px for this test.
97 }
98
99 if (r === 3) {
100 btn.height = { value: 100, unit: 'px' }; // Auto row should take 100px for this test.
101 }
102
103 this.testView.addChild(btn);

Callers

nothing calls this directly

Calls 6

addChildMethod · 0.45
setColumnMethod · 0.45
setRowMethod · 0.45
setColumnSpanMethod · 0.45
addColumnMethod · 0.45
addRowMethod · 0.45

Tested by

no test coverage detected