|
@@ -1,346 +1,323 @@
|
1
|
1
|
package com.reactnativenavigation.layout;
|
2
|
2
|
|
3
|
|
-import android.app.Activity;
|
4
|
|
-import android.support.v7.app.AppCompatActivity;
|
5
|
|
-import android.view.View;
|
6
|
|
-import android.view.ViewGroup;
|
7
|
|
-
|
8
|
3
|
import com.reactnativenavigation.BaseTest;
|
9
|
|
-import com.reactnativenavigation.layout.bottomtabs.BottomTabs;
|
10
|
|
-import com.reactnativenavigation.layout.bottomtabs.BottomTabsCreator;
|
11
|
|
-import com.reactnativenavigation.layout.bottomtabs.BottomTabsLayout;
|
12
|
4
|
|
13
|
|
-import org.json.JSONException;
|
14
|
|
-import org.json.JSONObject;
|
15
|
|
-import org.junit.Before;
|
16
|
5
|
import org.junit.Ignore;
|
17
|
|
-import org.junit.Test;
|
18
|
|
-import org.robolectric.Robolectric;
|
19
|
|
-
|
20
|
|
-import java.util.Arrays;
|
21
|
|
-import java.util.Collections;
|
22
|
|
-import java.util.List;
|
23
|
|
-
|
24
|
|
-import static org.assertj.core.api.Java6Assertions.assertThat;
|
25
|
|
-import static org.mockito.ArgumentMatchers.eq;
|
26
|
|
-import static org.mockito.Mockito.mock;
|
27
|
|
-import static org.mockito.Mockito.verify;
|
28
|
|
-import static org.mockito.Mockito.when;
|
29
|
6
|
|
30
|
7
|
@Ignore
|
31
|
|
-public class LayoutFactoryTest extends BaseTest {
|
32
|
|
-
|
33
|
|
- private final static String NODE_ID = "myUniqueId";
|
34
|
|
- private final static String REACT_ROOT_VIEW_KEY = "myName";
|
35
|
|
-
|
36
|
|
- private final static String OTHER_NODE_ID = "anotherUniqueId";
|
37
|
|
- private final static String OTHER_REACT_ROOT_VIEW_KEY = "anotherName";
|
38
|
|
-
|
39
|
|
- private Activity activity;
|
40
|
|
- private View mockView;
|
41
|
|
- private View otherMockView;
|
42
|
|
- private LayoutFactory.ReactRootViewCreator reactRootViewCreator;
|
43
|
|
-
|
44
|
|
- @Before
|
45
|
|
- public void setUp() {
|
46
|
|
- activity = Robolectric.buildActivity(AppCompatActivity.class).get();
|
47
|
|
- mockView = new View(activity);
|
48
|
|
- otherMockView = new View(activity);
|
49
|
|
- reactRootViewCreator = mock(LayoutFactory.ReactRootViewCreator.class);
|
50
|
|
- }
|
51
|
|
-
|
52
|
|
- @Test
|
53
|
|
- public void returnsContainerThatHoldsTheRootView() throws Exception {
|
54
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
55
|
|
- final LayoutNode node = createContainerNode();
|
56
|
|
-
|
57
|
|
- final ViewGroup result = (ViewGroup) createLayoutFactory().create(node);
|
58
|
|
-
|
59
|
|
- assertThat(result).isInstanceOf(Container.class);
|
60
|
|
- TestUtils.assertViewChildren(result, mockView);
|
61
|
|
- }
|
62
|
|
-
|
63
|
|
- @Test
|
64
|
|
- public void returnsContainerStack() throws Exception {
|
65
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
66
|
|
- final LayoutNode containerNode = createContainerNode();
|
67
|
|
- final LayoutNode stackNode = createContainerStackNode(containerNode);
|
68
|
|
-
|
69
|
|
- final ViewGroup result = (ViewGroup) createLayoutFactory().create(stackNode);
|
70
|
|
-
|
71
|
|
- assertThat(result).isInstanceOf(ContainerStackLayout.class);
|
72
|
|
- ViewGroup container = (ViewGroup) TestUtils.assertViewChildrenCount(result, 1).get(0);
|
73
|
|
- TestUtils.assertViewChildren(container, mockView);
|
74
|
|
- }
|
75
|
|
-
|
76
|
|
- @Test
|
77
|
|
- public void returnsContainerStackWithMultipleViews() throws Exception {
|
78
|
|
- final View mockView1 = mock(View.class);
|
79
|
|
- final View mockView2 = mock(View.class);
|
80
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView1);
|
81
|
|
- when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(mockView2);
|
82
|
|
-
|
83
|
|
- final LayoutNode containerNode1 = createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY);
|
84
|
|
- final LayoutNode containerNode2 = createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY);
|
85
|
|
- final LayoutNode stackNode = createContainerStackNode(containerNode1, containerNode2);
|
86
|
|
-
|
87
|
|
- final ViewGroup result = (ViewGroup) createLayoutFactory().create(stackNode);
|
88
|
|
-
|
89
|
|
- assertThat(result).isInstanceOf(ContainerStackLayout.class);
|
90
|
|
- List<View> containers = TestUtils.assertViewChildrenCount(result, 2);
|
91
|
|
- ViewGroup container1 = (ViewGroup) containers.get(0);
|
92
|
|
- ViewGroup container2 = (ViewGroup) containers.get(1);
|
93
|
|
- TestUtils.assertViewChildren(container1, mockView1);
|
94
|
|
- TestUtils.assertViewChildren(container2, mockView2);
|
95
|
|
- }
|
96
|
|
-
|
97
|
|
- @Test
|
98
|
|
- public void returnsSideMenuRoot() throws Exception {
|
99
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
100
|
|
- final LayoutNode containerNode = createSideMenuContainerNode(Arrays.asList(createContainerNode()));
|
101
|
|
- final ViewGroup result = (ViewGroup) createLayoutFactory().create(containerNode);
|
102
|
|
- assertThat(result).isInstanceOf(SideMenuLayout.class);
|
103
|
|
- }
|
104
|
|
-
|
105
|
|
- @Test
|
106
|
|
- public void hasContentContainer() throws Exception {
|
107
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
108
|
|
- LayoutNode contentContainer = createContainerNode();
|
109
|
|
- final LayoutNode sideMenu = createSideMenuContainerNode(Arrays.asList(contentContainer));
|
110
|
|
- final ViewGroup result = (ViewGroup) createLayoutFactory().create(sideMenu);
|
111
|
|
- assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
|
112
|
|
- }
|
113
|
|
-
|
114
|
|
- @Test
|
115
|
|
- public void hasLeftMenu() throws Exception {
|
116
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
117
|
|
- LayoutNode sideMenuLeft = createSideMenuLeftNode();
|
118
|
|
- final LayoutNode sideMenu = createSideMenuContainerNode(Arrays.asList(sideMenuLeft));
|
119
|
|
- final ViewGroup result = (ViewGroup) createLayoutFactory().create(sideMenu);
|
120
|
|
- assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
|
121
|
|
- }
|
122
|
|
-
|
123
|
|
- @Test
|
124
|
|
- public void hasRightMenu() throws Exception {
|
125
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
126
|
|
- LayoutNode sideMenuRight = createSideMenuRightNode();
|
127
|
|
- final LayoutNode sideMenu = createSideMenuContainerNode(Arrays.asList(sideMenuRight));
|
128
|
|
- final ViewGroup result = (ViewGroup) createLayoutFactory().create(sideMenu);
|
129
|
|
- assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
|
130
|
|
- }
|
131
|
|
-
|
132
|
|
- @Test
|
133
|
|
- public void returnsSingleTabContent() throws Exception {
|
134
|
|
- BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
135
|
|
- when(bottomTabsMock.size()).thenReturn(0);
|
136
|
|
-
|
137
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
138
|
|
- final LayoutNode containerNode = createContainerStackNode(createContainerNode());
|
139
|
|
- final LayoutNode tabNode = createBottomTabNode(containerNode);
|
140
|
|
-
|
141
|
|
- final View result = createLayoutFactory(bottomTabsMock).create(tabNode);
|
142
|
|
-
|
143
|
|
- verify(bottomTabsMock).add("#0");
|
144
|
|
-
|
145
|
|
- assertThat(result).isInstanceOf(BottomTabsLayout.class);
|
146
|
|
- ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount((BottomTabsLayout) result, 1).get(0);
|
147
|
|
- Container container = (Container) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
148
|
|
- View view = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
149
|
|
- assertThat(view).isEqualTo(mockView);
|
150
|
|
- }
|
151
|
|
-
|
152
|
|
- @Test
|
153
|
|
- public void returnsTwoTabContent() throws Exception {
|
154
|
|
- BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
155
|
|
- when(bottomTabsMock.size()).thenReturn(0, 1);
|
156
|
|
-
|
157
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
158
|
|
- final LayoutNode firstTabRootNode = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
159
|
|
-
|
160
|
|
- when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(otherMockView);
|
161
|
|
- final LayoutNode secondTabRootNode = createContainerStackNode(createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY));
|
162
|
|
-
|
163
|
|
- final LayoutNode tabNode = createBottomTabNode(firstTabRootNode, secondTabRootNode);
|
164
|
|
-
|
165
|
|
- final View result = createLayoutFactory(bottomTabsMock).create(tabNode);
|
166
|
|
-
|
167
|
|
- assertThat(result).isInstanceOf(BottomTabsLayout.class);
|
168
|
|
- verify(bottomTabsMock).add(eq("#0"));
|
169
|
|
- verify(bottomTabsMock).add(eq("#1"));
|
170
|
|
- }
|
171
|
|
-
|
172
|
|
- @Test
|
173
|
|
- public void pushScreenToFirstBottomTab() throws Exception {
|
174
|
|
- BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
175
|
|
- when(bottomTabsMock.size()).thenReturn(0, 1);
|
176
|
|
-
|
177
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
178
|
|
- final LayoutNode firstTabContainerStack = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
179
|
|
-
|
180
|
|
- final LayoutNode tabNode = createBottomTabNode(firstTabContainerStack);
|
181
|
|
- final BottomTabsLayout bottomTabsContainer = (BottomTabsLayout) createLayoutFactory(bottomTabsMock).create(tabNode);
|
182
|
|
- verify(bottomTabsMock).add(eq("#0"));
|
183
|
|
-
|
184
|
|
- View pushedReactView = new View(activity);
|
185
|
|
- when(reactRootViewCreator.create(eq("pushedReactViewId"), eq("pushedReactViewKey"))).thenReturn(pushedReactView);
|
186
|
|
- View view = createLayoutFactory().create(createContainerNode("pushedReactViewId", "pushedReactViewKey"));
|
187
|
|
- bottomTabsContainer.push(view);
|
188
|
|
-
|
189
|
|
- ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount(bottomTabsContainer, 1).get(0);
|
190
|
|
- ViewGroup container = (ViewGroup) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
191
|
|
- View result = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
192
|
|
- assertThat(result).isEqualTo(pushedReactView);
|
193
|
|
- }
|
194
|
|
-
|
195
|
|
- @Test
|
196
|
|
- public void popScreenFromFirstBottomTab() throws Exception {
|
197
|
|
- BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
198
|
|
- when(bottomTabsMock.size()).thenReturn(0, 1);
|
199
|
|
-
|
200
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
201
|
|
- final LayoutNode firstTabContainerStack = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
202
|
|
-
|
203
|
|
- final LayoutNode tabNode = createBottomTabNode(firstTabContainerStack);
|
204
|
|
- final BottomTabsLayout bottomTabsContainer = (BottomTabsLayout) createLayoutFactory(bottomTabsMock).create(tabNode);
|
205
|
|
- verify(bottomTabsMock).add(eq("#0"));
|
206
|
|
-
|
207
|
|
- pushContainer(bottomTabsContainer, "pushedReactViewId", "pushedReactViewKey", new View(activity));
|
208
|
|
-
|
209
|
|
- bottomTabsContainer.pop();
|
210
|
|
-
|
211
|
|
- ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount(bottomTabsContainer, 1).get(0);
|
212
|
|
- ViewGroup container = (ViewGroup) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
213
|
|
- View result = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
214
|
|
- assertThat(result).isEqualTo(mockView);
|
215
|
|
- }
|
216
|
|
-
|
217
|
|
- @Test
|
218
|
|
- public void pushScreenToScreenStackLayout() throws Exception {
|
219
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
220
|
|
- final LayoutNode container = createContainerNode();
|
221
|
|
- final LayoutNode stackNode = createContainerStackNode(container);
|
222
|
|
- final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
223
|
|
-
|
224
|
|
- when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(otherMockView);
|
225
|
|
- final LayoutNode pushedContainer = createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY);
|
226
|
|
- containerStackLayout.push(createLayoutFactory().create(pushedContainer));
|
227
|
|
-
|
228
|
|
- ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
229
|
|
- assertThat(result.getChildAt(0)).isEqualTo(otherMockView);
|
230
|
|
- }
|
231
|
|
-
|
232
|
|
- @Test
|
233
|
|
- public void pushTwoScreensToStackLayout() throws Exception {
|
234
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
235
|
|
- final LayoutNode container = createContainerNode();
|
236
|
|
- final LayoutNode stackNode = createContainerStackNode(container);
|
237
|
|
- final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
238
|
|
-
|
239
|
|
- View first = new View(activity);
|
240
|
|
- pushContainer(containerStackLayout, OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY, first);
|
241
|
|
-
|
242
|
|
- View second = new View(activity);
|
243
|
|
- pushContainer(containerStackLayout, "secondPushedScreenId", "secondPushedScreenKey", second);
|
244
|
|
-
|
245
|
|
- ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
246
|
|
- assertThat(result.getChildAt(0)).isEqualTo(second);
|
247
|
|
- }
|
248
|
|
-
|
249
|
|
- @Test
|
250
|
|
- public void popTwoScreensFromStackLayout() throws Exception {
|
251
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
252
|
|
- final LayoutNode container = createContainerNode();
|
253
|
|
- final LayoutNode stackNode = createContainerStackNode(container);
|
254
|
|
- final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
255
|
|
-
|
256
|
|
- pushContainer(containerStackLayout, OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY, new View(activity));
|
257
|
|
- pushContainer(containerStackLayout, "secondPushedScreenId", "secondPushedScreenKey", new View(activity));
|
258
|
|
-
|
259
|
|
- containerStackLayout.pop();
|
260
|
|
- containerStackLayout.pop();
|
261
|
|
-
|
262
|
|
- ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
263
|
|
- assertThat(result.getChildAt(0)).isEqualTo(mockView);
|
264
|
|
- }
|
265
|
|
-
|
266
|
|
- private void pushContainer(ContainerStackLayout containerStackLayout, String screenId, String reactRootViewKey, View rootView) throws Exception {
|
267
|
|
- when(reactRootViewCreator.create(eq(screenId), eq(reactRootViewKey))).thenReturn(rootView);
|
268
|
|
- View pushedContainer = createLayoutFactory().create(createContainerNode(screenId, reactRootViewKey));
|
269
|
|
- containerStackLayout.push(pushedContainer);
|
270
|
|
- }
|
271
|
|
-
|
272
|
|
- private void pushContainer(BottomTabsLayout containerStackLayout, String screenId, String reactRootViewKey, View rootView) throws Exception {
|
273
|
|
- when(reactRootViewCreator.create(eq(screenId), eq(reactRootViewKey))).thenReturn(rootView);
|
274
|
|
- View pushedContainer = createLayoutFactory().create(createContainerNode(screenId, reactRootViewKey));
|
275
|
|
- containerStackLayout.push(pushedContainer);
|
276
|
|
- }
|
277
|
|
-
|
278
|
|
- @Test
|
279
|
|
- public void popScreenFromScreenStackLayout() throws Exception {
|
280
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
281
|
|
- final LayoutNode container = createContainerNode();
|
282
|
|
- final LayoutNode stackNode = createContainerStackNode(container);
|
283
|
|
- final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
284
|
|
-
|
285
|
|
- when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(otherMockView);
|
286
|
|
- final LayoutNode pushedContainer = createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY);
|
287
|
|
- containerStackLayout.push(createLayoutFactory().create(pushedContainer));
|
288
|
|
-
|
289
|
|
- containerStackLayout.pop();
|
290
|
|
- ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
291
|
|
- assertThat(result.getChildAt(0)).isEqualTo(mockView);
|
292
|
|
- }
|
293
|
|
-
|
294
|
|
- @Test(expected = IllegalArgumentException.class)
|
295
|
|
- @Ignore
|
296
|
|
- public void throwsExceptionForUnknownType() throws Exception {
|
297
|
|
- when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
298
|
|
- final LayoutNode node = new LayoutNode(NODE_ID, null, new JSONObject(), Collections.<LayoutNode>emptyList());
|
299
|
|
-
|
300
|
|
- createLayoutFactory().create(node);
|
301
|
|
- }
|
302
|
|
-
|
303
|
|
- private LayoutFactory createLayoutFactory() {
|
304
|
|
- return createLayoutFactory(null);
|
305
|
|
- }
|
306
|
|
-
|
307
|
|
- private LayoutFactory createLayoutFactory(BottomTabs bottomTabs) {
|
308
|
|
- BottomTabsCreator bottomTabsCreator = null;
|
309
|
|
- if (bottomTabs != null) {
|
310
|
|
- bottomTabsCreator = mock(BottomTabsCreator.class);
|
311
|
|
- when(bottomTabsCreator.create()).thenReturn(bottomTabs);
|
312
|
|
- }
|
313
|
|
-
|
314
|
|
- return new LayoutFactory(activity, reactRootViewCreator, bottomTabsCreator);
|
315
|
|
- }
|
316
|
|
-
|
317
|
|
- private LayoutNode createContainerNode() throws Exception {
|
318
|
|
- return createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY);
|
319
|
|
- }
|
320
|
|
-
|
321
|
|
- private LayoutNode createSideMenuLeftNode() throws Exception {
|
322
|
|
- List<LayoutNode> children = Arrays.asList(createContainerNode());
|
323
|
|
- return new LayoutNode("SideMenuLeft", LayoutNode.Type.SideMenuLeft, null, children);
|
324
|
|
- }
|
325
|
|
-
|
326
|
|
- private LayoutNode createSideMenuRightNode() throws Exception {
|
327
|
|
- List<LayoutNode> children = Arrays.asList(createContainerNode());
|
328
|
|
- return new LayoutNode("SideMenuRight", LayoutNode.Type.SideMenuRight, null, children);
|
329
|
|
- }
|
330
|
|
-
|
331
|
|
- private LayoutNode createContainerNode(final String id, final String name) throws JSONException {
|
332
|
|
- return new LayoutNode(id, LayoutNode.Type.Container, new JSONObject().put("name", name), null);
|
333
|
|
- }
|
334
|
|
-
|
335
|
|
- private LayoutNode createSideMenuContainerNode(List<LayoutNode> children) {
|
336
|
|
- return new LayoutNode("SideMenuRoot", LayoutNode.Type.SideMenuRoot, null, children);
|
337
|
|
- }
|
338
|
|
-
|
339
|
|
- private LayoutNode createContainerStackNode(LayoutNode... children) {
|
340
|
|
- return new LayoutNode("ContainerStack", LayoutNode.Type.ContainerStack, null, Arrays.asList(children));
|
341
|
|
- }
|
342
|
|
-
|
343
|
|
- private LayoutNode createBottomTabNode(LayoutNode... children) {
|
344
|
|
- return new LayoutNode("BottomTabs", LayoutNode.Type.BottomTabs, null, Arrays.asList(children));
|
345
|
|
- }
|
|
8
|
+public abstract class LayoutFactoryTest extends BaseTest {
|
|
9
|
+
|
|
10
|
+// private final static String NODE_ID = "myUniqueId";
|
|
11
|
+// private final static String REACT_ROOT_VIEW_KEY = "myName";
|
|
12
|
+//
|
|
13
|
+// private final static String OTHER_NODE_ID = "anotherUniqueId";
|
|
14
|
+// private final static String OTHER_REACT_ROOT_VIEW_KEY = "anotherName";
|
|
15
|
+//
|
|
16
|
+// private Activity activity;
|
|
17
|
+// private View mockView;
|
|
18
|
+// private View otherMockView;
|
|
19
|
+// private LayoutFactory.ReactRootViewCreator reactRootViewCreator;
|
|
20
|
+//
|
|
21
|
+// @Before
|
|
22
|
+// public void setUp() {
|
|
23
|
+// activity = Robolectric.buildActivity(AppCompatActivity.class).get();
|
|
24
|
+// mockView = new View(activity);
|
|
25
|
+// otherMockView = new View(activity);
|
|
26
|
+// reactRootViewCreator = mock(LayoutFactory.ReactRootViewCreator.class);
|
|
27
|
+// }
|
|
28
|
+//
|
|
29
|
+// @Test
|
|
30
|
+// public void returnsContainerThatHoldsTheRootView() throws Exception {
|
|
31
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
32
|
+// final LayoutNode node = createContainerNode();
|
|
33
|
+//
|
|
34
|
+// final ViewGroup result = (ViewGroup) createLayoutFactory().create(node);
|
|
35
|
+//
|
|
36
|
+// assertThat(result).isInstanceOf(Container.class);
|
|
37
|
+// TestUtils.assertViewChildren(result, mockView);
|
|
38
|
+// }
|
|
39
|
+//
|
|
40
|
+// @Test
|
|
41
|
+// public void returnsContainerStack() throws Exception {
|
|
42
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
43
|
+// final LayoutNode containerNode = createContainerNode();
|
|
44
|
+// final LayoutNode stackNode = createContainerStackNode(containerNode);
|
|
45
|
+//
|
|
46
|
+// final ViewGroup result = (ViewGroup) createLayoutFactory().create(stackNode);
|
|
47
|
+//
|
|
48
|
+// assertThat(result).isInstanceOf(ContainerStackLayout.class);
|
|
49
|
+// ViewGroup container = (ViewGroup) TestUtils.assertViewChildrenCount(result, 1).get(0);
|
|
50
|
+// TestUtils.assertViewChildren(container, mockView);
|
|
51
|
+// }
|
|
52
|
+//
|
|
53
|
+// @Test
|
|
54
|
+// public void returnsContainerStackWithMultipleViews() throws Exception {
|
|
55
|
+// final View mockView1 = mock(View.class);
|
|
56
|
+// final View mockView2 = mock(View.class);
|
|
57
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView1);
|
|
58
|
+// when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(mockView2);
|
|
59
|
+//
|
|
60
|
+// final LayoutNode containerNode1 = createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY);
|
|
61
|
+// final LayoutNode containerNode2 = createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY);
|
|
62
|
+// final LayoutNode stackNode = createContainerStackNode(containerNode1, containerNode2);
|
|
63
|
+//
|
|
64
|
+// final ViewGroup result = (ViewGroup) createLayoutFactory().create(stackNode);
|
|
65
|
+//
|
|
66
|
+// assertThat(result).isInstanceOf(ContainerStackLayout.class);
|
|
67
|
+// List<View> containers = TestUtils.assertViewChildrenCount(result, 2);
|
|
68
|
+// ViewGroup container1 = (ViewGroup) containers.get(0);
|
|
69
|
+// ViewGroup container2 = (ViewGroup) containers.get(1);
|
|
70
|
+// TestUtils.assertViewChildren(container1, mockView1);
|
|
71
|
+// TestUtils.assertViewChildren(container2, mockView2);
|
|
72
|
+// }
|
|
73
|
+//
|
|
74
|
+// @Test
|
|
75
|
+// public void returnsSideMenuRoot() throws Exception {
|
|
76
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
77
|
+// final LayoutNode containerNode = createSideMenuContainerNode(Arrays.asList(createContainerNode()));
|
|
78
|
+// final ViewGroup result = (ViewGroup) createLayoutFactory().create(containerNode);
|
|
79
|
+// assertThat(result).isInstanceOf(SideMenuLayout.class);
|
|
80
|
+// }
|
|
81
|
+//
|
|
82
|
+// @Test
|
|
83
|
+// public void hasContentContainer() throws Exception {
|
|
84
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
85
|
+// LayoutNode contentContainer = createContainerNode();
|
|
86
|
+// final LayoutNode sideMenu = createSideMenuContainerNode(Arrays.asList(contentContainer));
|
|
87
|
+// final ViewGroup result = (ViewGroup) createLayoutFactory().create(sideMenu);
|
|
88
|
+// assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
|
|
89
|
+// }
|
|
90
|
+//
|
|
91
|
+// @Test
|
|
92
|
+// public void hasLeftMenu() throws Exception {
|
|
93
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
94
|
+// LayoutNode sideMenuLeft = createSideMenuLeftNode();
|
|
95
|
+// final LayoutNode sideMenu = createSideMenuContainerNode(Arrays.asList(sideMenuLeft));
|
|
96
|
+// final ViewGroup result = (ViewGroup) createLayoutFactory().create(sideMenu);
|
|
97
|
+// assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
|
|
98
|
+// }
|
|
99
|
+//
|
|
100
|
+// @Test
|
|
101
|
+// public void hasRightMenu() throws Exception {
|
|
102
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
103
|
+// LayoutNode sideMenuRight = createSideMenuRightNode();
|
|
104
|
+// final LayoutNode sideMenu = createSideMenuContainerNode(Arrays.asList(sideMenuRight));
|
|
105
|
+// final ViewGroup result = (ViewGroup) createLayoutFactory().create(sideMenu);
|
|
106
|
+// assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
|
|
107
|
+// }
|
|
108
|
+//
|
|
109
|
+// @Test
|
|
110
|
+// public void returnsSingleTabContent() throws Exception {
|
|
111
|
+// BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
|
112
|
+// when(bottomTabsMock.size()).thenReturn(0);
|
|
113
|
+//
|
|
114
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
115
|
+// final LayoutNode containerNode = createContainerStackNode(createContainerNode());
|
|
116
|
+// final LayoutNode tabNode = createBottomTabNode(containerNode);
|
|
117
|
+//
|
|
118
|
+// final View result = createLayoutFactory(bottomTabsMock).create(tabNode);
|
|
119
|
+//
|
|
120
|
+// verify(bottomTabsMock).add("#0");
|
|
121
|
+//
|
|
122
|
+// assertThat(result).isInstanceOf(BottomTabsLayout.class);
|
|
123
|
+// ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount((BottomTabsLayout) result, 1).get(0);
|
|
124
|
+// Container container = (Container) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
|
125
|
+// View view = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
|
126
|
+// assertThat(view).isEqualTo(mockView);
|
|
127
|
+// }
|
|
128
|
+//
|
|
129
|
+// @Test
|
|
130
|
+// public void returnsTwoTabContent() throws Exception {
|
|
131
|
+// BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
|
132
|
+// when(bottomTabsMock.size()).thenReturn(0, 1);
|
|
133
|
+//
|
|
134
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
135
|
+// final LayoutNode firstTabRootNode = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
|
136
|
+//
|
|
137
|
+// when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(otherMockView);
|
|
138
|
+// final LayoutNode secondTabRootNode = createContainerStackNode(createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY));
|
|
139
|
+//
|
|
140
|
+// final LayoutNode tabNode = createBottomTabNode(firstTabRootNode, secondTabRootNode);
|
|
141
|
+//
|
|
142
|
+// final View result = createLayoutFactory(bottomTabsMock).create(tabNode);
|
|
143
|
+//
|
|
144
|
+// assertThat(result).isInstanceOf(BottomTabsLayout.class);
|
|
145
|
+// verify(bottomTabsMock).add(eq("#0"));
|
|
146
|
+// verify(bottomTabsMock).add(eq("#1"));
|
|
147
|
+// }
|
|
148
|
+//
|
|
149
|
+// @Test
|
|
150
|
+// public void pushScreenToFirstBottomTab() throws Exception {
|
|
151
|
+// BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
|
152
|
+// when(bottomTabsMock.size()).thenReturn(0, 1);
|
|
153
|
+//
|
|
154
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
155
|
+// final LayoutNode firstTabContainerStack = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
|
156
|
+//
|
|
157
|
+// final LayoutNode tabNode = createBottomTabNode(firstTabContainerStack);
|
|
158
|
+// final BottomTabsLayout bottomTabsContainer = (BottomTabsLayout) createLayoutFactory(bottomTabsMock).create(tabNode);
|
|
159
|
+// verify(bottomTabsMock).add(eq("#0"));
|
|
160
|
+//
|
|
161
|
+// View pushedReactView = new View(activity);
|
|
162
|
+// when(reactRootViewCreator.create(eq("pushedReactViewId"), eq("pushedReactViewKey"))).thenReturn(pushedReactView);
|
|
163
|
+// View view = createLayoutFactory().create(createContainerNode("pushedReactViewId", "pushedReactViewKey"));
|
|
164
|
+// bottomTabsContainer.push(view);
|
|
165
|
+//
|
|
166
|
+// ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount(bottomTabsContainer, 1).get(0);
|
|
167
|
+// ViewGroup container = (ViewGroup) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
|
168
|
+// View result = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
|
169
|
+// assertThat(result).isEqualTo(pushedReactView);
|
|
170
|
+// }
|
|
171
|
+//
|
|
172
|
+// @Test
|
|
173
|
+// public void popScreenFromFirstBottomTab() throws Exception {
|
|
174
|
+// BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
|
175
|
+// when(bottomTabsMock.size()).thenReturn(0, 1);
|
|
176
|
+//
|
|
177
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
178
|
+// final LayoutNode firstTabContainerStack = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
|
179
|
+//
|
|
180
|
+// final LayoutNode tabNode = createBottomTabNode(firstTabContainerStack);
|
|
181
|
+// final BottomTabsLayout bottomTabsContainer = (BottomTabsLayout) createLayoutFactory(bottomTabsMock).create(tabNode);
|
|
182
|
+// verify(bottomTabsMock).add(eq("#0"));
|
|
183
|
+//
|
|
184
|
+// pushContainer(bottomTabsContainer, "pushedReactViewId", "pushedReactViewKey", new View(activity));
|
|
185
|
+//
|
|
186
|
+// bottomTabsContainer.pop();
|
|
187
|
+//
|
|
188
|
+// ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount(bottomTabsContainer, 1).get(0);
|
|
189
|
+// ViewGroup container = (ViewGroup) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
|
190
|
+// View result = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
|
191
|
+// assertThat(result).isEqualTo(mockView);
|
|
192
|
+// }
|
|
193
|
+//
|
|
194
|
+// @Test
|
|
195
|
+// public void pushScreenToScreenStackLayout() throws Exception {
|
|
196
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
197
|
+// final LayoutNode container = createContainerNode();
|
|
198
|
+// final LayoutNode stackNode = createContainerStackNode(container);
|
|
199
|
+// final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
|
200
|
+//
|
|
201
|
+// when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(otherMockView);
|
|
202
|
+// final LayoutNode pushedContainer = createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY);
|
|
203
|
+// containerStackLayout.push(createLayoutFactory().create(pushedContainer));
|
|
204
|
+//
|
|
205
|
+// ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
|
206
|
+// assertThat(result.getChildAt(0)).isEqualTo(otherMockView);
|
|
207
|
+// }
|
|
208
|
+//
|
|
209
|
+// @Test
|
|
210
|
+// public void pushTwoScreensToStackLayout() throws Exception {
|
|
211
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
212
|
+// final LayoutNode container = createContainerNode();
|
|
213
|
+// final LayoutNode stackNode = createContainerStackNode(container);
|
|
214
|
+// final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
|
215
|
+//
|
|
216
|
+// View first = new View(activity);
|
|
217
|
+// pushContainer(containerStackLayout, OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY, first);
|
|
218
|
+//
|
|
219
|
+// View second = new View(activity);
|
|
220
|
+// pushContainer(containerStackLayout, "secondPushedScreenId", "secondPushedScreenKey", second);
|
|
221
|
+//
|
|
222
|
+// ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
|
223
|
+// assertThat(result.getChildAt(0)).isEqualTo(second);
|
|
224
|
+// }
|
|
225
|
+//
|
|
226
|
+// @Test
|
|
227
|
+// public void popTwoScreensFromStackLayout() throws Exception {
|
|
228
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
229
|
+// final LayoutNode container = createContainerNode();
|
|
230
|
+// final LayoutNode stackNode = createContainerStackNode(container);
|
|
231
|
+// final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
|
232
|
+//
|
|
233
|
+// pushContainer(containerStackLayout, OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY, new View(activity));
|
|
234
|
+// pushContainer(containerStackLayout, "secondPushedScreenId", "secondPushedScreenKey", new View(activity));
|
|
235
|
+//
|
|
236
|
+// containerStackLayout.pop();
|
|
237
|
+// containerStackLayout.pop();
|
|
238
|
+//
|
|
239
|
+// ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
|
240
|
+// assertThat(result.getChildAt(0)).isEqualTo(mockView);
|
|
241
|
+// }
|
|
242
|
+//
|
|
243
|
+// private void pushContainer(ContainerStackLayout containerStackLayout, String screenId, String reactRootViewKey, View rootView) throws Exception {
|
|
244
|
+// when(reactRootViewCreator.create(eq(screenId), eq(reactRootViewKey))).thenReturn(rootView);
|
|
245
|
+// View pushedContainer = createLayoutFactory().create(createContainerNode(screenId, reactRootViewKey));
|
|
246
|
+// containerStackLayout.push(pushedContainer);
|
|
247
|
+// }
|
|
248
|
+//
|
|
249
|
+// private void pushContainer(BottomTabsLayout containerStackLayout, String screenId, String reactRootViewKey, View rootView) throws Exception {
|
|
250
|
+// when(reactRootViewCreator.create(eq(screenId), eq(reactRootViewKey))).thenReturn(rootView);
|
|
251
|
+// View pushedContainer = createLayoutFactory().create(createContainerNode(screenId, reactRootViewKey));
|
|
252
|
+// containerStackLayout.push(pushedContainer);
|
|
253
|
+// }
|
|
254
|
+//
|
|
255
|
+// @Test
|
|
256
|
+// public void popScreenFromScreenStackLayout() throws Exception {
|
|
257
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
258
|
+// final LayoutNode container = createContainerNode();
|
|
259
|
+// final LayoutNode stackNode = createContainerStackNode(container);
|
|
260
|
+// final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
|
261
|
+//
|
|
262
|
+// when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(otherMockView);
|
|
263
|
+// final LayoutNode pushedContainer = createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY);
|
|
264
|
+// containerStackLayout.push(createLayoutFactory().create(pushedContainer));
|
|
265
|
+//
|
|
266
|
+// containerStackLayout.pop();
|
|
267
|
+// ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
|
268
|
+// assertThat(result.getChildAt(0)).isEqualTo(mockView);
|
|
269
|
+// }
|
|
270
|
+//
|
|
271
|
+// @Test(expected = IllegalArgumentException.class)
|
|
272
|
+// @Ignore
|
|
273
|
+// public void throwsExceptionForUnknownType() throws Exception {
|
|
274
|
+// when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
275
|
+// final LayoutNode node = new LayoutNode(NODE_ID, null, new JSONObject(), Collections.<LayoutNode>emptyList());
|
|
276
|
+//
|
|
277
|
+// createLayoutFactory().create(node);
|
|
278
|
+// }
|
|
279
|
+//
|
|
280
|
+// private LayoutFactory createLayoutFactory() {
|
|
281
|
+// return createLayoutFactory(null);
|
|
282
|
+// }
|
|
283
|
+//
|
|
284
|
+// private LayoutFactory createLayoutFactory(BottomTabs bottomTabs) {
|
|
285
|
+// BottomTabsCreator bottomTabsCreator = null;
|
|
286
|
+// if (bottomTabs != null) {
|
|
287
|
+// bottomTabsCreator = mock(BottomTabsCreator.class);
|
|
288
|
+// when(bottomTabsCreator.create()).thenReturn(bottomTabs);
|
|
289
|
+// }
|
|
290
|
+//
|
|
291
|
+// return new LayoutFactory(activity, reactRootViewCreator, bottomTabsCreator);
|
|
292
|
+// }
|
|
293
|
+//
|
|
294
|
+// private LayoutNode createContainerNode() throws Exception {
|
|
295
|
+// return createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY);
|
|
296
|
+// }
|
|
297
|
+//
|
|
298
|
+// private LayoutNode createSideMenuLeftNode() throws Exception {
|
|
299
|
+// List<LayoutNode> children = Arrays.asList(createContainerNode());
|
|
300
|
+// return new LayoutNode("SideMenuLeft", LayoutNode.Type.SideMenuLeft, null, children);
|
|
301
|
+// }
|
|
302
|
+//
|
|
303
|
+// private LayoutNode createSideMenuRightNode() throws Exception {
|
|
304
|
+// List<LayoutNode> children = Arrays.asList(createContainerNode());
|
|
305
|
+// return new LayoutNode("SideMenuRight", LayoutNode.Type.SideMenuRight, null, children);
|
|
306
|
+// }
|
|
307
|
+//
|
|
308
|
+// private LayoutNode createContainerNode(final String id, final String name) throws JSONException {
|
|
309
|
+// return new LayoutNode(id, LayoutNode.Type.Container, new JSONObject().put("name", name), null);
|
|
310
|
+// }
|
|
311
|
+//
|
|
312
|
+// private LayoutNode createSideMenuContainerNode(List<LayoutNode> children) {
|
|
313
|
+// return new LayoutNode("SideMenuRoot", LayoutNode.Type.SideMenuRoot, null, children);
|
|
314
|
+// }
|
|
315
|
+//
|
|
316
|
+// private LayoutNode createContainerStackNode(LayoutNode... children) {
|
|
317
|
+// return new LayoutNode("ContainerStack", LayoutNode.Type.ContainerStack, null, Arrays.asList(children));
|
|
318
|
+// }
|
|
319
|
+//
|
|
320
|
+// private LayoutNode createBottomTabNode(LayoutNode... children) {
|
|
321
|
+// return new LayoutNode("BottomTabs", LayoutNode.Type.BottomTabs, null, Arrays.asList(children));
|
|
322
|
+// }
|
346
|
323
|
}
|