27
27
import android .app .Activity ;
28
28
import android .view .View ;
29
29
import android .widget .LinearLayout ;
30
+ import android .widget .RelativeLayout ;
30
31
import android .widget .TextView ;
31
32
32
33
import androidx .test .platform .app .InstrumentationRegistry ;
@@ -69,6 +70,9 @@ public void testEmptyTable() throws Throwable {
69
70
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
70
71
Assert .assertNotNull (tableView );
71
72
73
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
74
+ rl .addView (tableView );
75
+
72
76
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
73
77
Assert .assertNotNull (simpleTestAdapter );
74
78
@@ -79,7 +83,7 @@ public void testEmptyTable() throws Throwable {
79
83
simpleTestAdapter .setAllItems (simpleData .getColumnHeaders (), simpleData .getRowHeaders (),
80
84
simpleData .getCells ());
81
85
82
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
86
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
83
87
84
88
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
85
89
@@ -96,6 +100,9 @@ public void testEmptyTableResetNonEmptyTable() throws Throwable {
96
100
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
97
101
Assert .assertNotNull (tableView );
98
102
103
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
104
+ rl .addView (tableView );
105
+
99
106
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
100
107
Assert .assertNotNull (simpleTestAdapter );
101
108
@@ -115,7 +122,7 @@ public void testEmptyTableResetNonEmptyTable() throws Throwable {
115
122
simpleTestAdapter .setAllItems (simpleDataReset .getColumnHeaders (), simpleDataReset .getRowHeaders (),
116
123
simpleDataReset .getCells ());
117
124
118
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
125
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
119
126
120
127
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
121
128
@@ -139,6 +146,9 @@ public void testEmptyTableResetEmptyTable() throws Throwable {
139
146
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
140
147
Assert .assertNotNull (tableView );
141
148
149
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
150
+ rl .addView (tableView );
151
+
142
152
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
143
153
Assert .assertNotNull (simpleTestAdapter );
144
154
@@ -158,7 +168,7 @@ public void testEmptyTableResetEmptyTable() throws Throwable {
158
168
simpleTestAdapter .setAllItems (simpleDataReset .getColumnHeaders (), simpleDataReset .getRowHeaders (),
159
169
simpleDataReset .getCells ());
160
170
161
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
171
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
162
172
163
173
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
164
174
@@ -176,6 +186,9 @@ public void testNonEmptyTable() throws Throwable {
176
186
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
177
187
Assert .assertNotNull (tableView );
178
188
189
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
190
+ rl .addView (tableView );
191
+
179
192
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
180
193
Assert .assertNotNull (simpleTestAdapter );
181
194
@@ -186,7 +199,7 @@ public void testNonEmptyTable() throws Throwable {
186
199
simpleTestAdapter .setAllItems (simpleData .getColumnHeaders (), simpleData .getRowHeaders (),
187
200
simpleData .getCells ());
188
201
189
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
202
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
190
203
191
204
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
192
205
@@ -210,6 +223,9 @@ public void testNonEmptyTableResetNonEmpty() throws Throwable {
210
223
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
211
224
Assert .assertNotNull (tableView );
212
225
226
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
227
+ rl .addView (tableView );
228
+
213
229
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
214
230
Assert .assertNotNull (simpleTestAdapter );
215
231
@@ -232,7 +248,7 @@ public void testNonEmptyTableResetNonEmpty() throws Throwable {
232
248
simpleTestAdapter .setAllItems (simpleDataReset .getColumnHeaders (), simpleDataReset .getRowHeaders (),
233
249
simpleDataReset .getCells ());
234
250
235
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
251
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
236
252
237
253
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
238
254
@@ -256,6 +272,9 @@ public void testNonEmptyTableResetEmpty() throws Throwable {
256
272
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
257
273
Assert .assertNotNull (tableView );
258
274
275
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
276
+ rl .addView (tableView );
277
+
259
278
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
260
279
Assert .assertNotNull (simpleTestAdapter );
261
280
@@ -276,7 +295,7 @@ public void testNonEmptyTableResetEmpty() throws Throwable {
276
295
simpleTestAdapter .setAllItems (simpleDataReset .getColumnHeaders (), simpleDataReset .getRowHeaders (),
277
296
simpleDataReset .getCells ());
278
297
279
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
298
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
280
299
281
300
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
282
301
@@ -296,6 +315,9 @@ public void testColumnHeadersOnlyTable() throws Throwable {
296
315
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
297
316
Assert .assertNotNull (tableView );
298
317
318
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
319
+ rl .addView (tableView );
320
+
299
321
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
300
322
Assert .assertNotNull (simpleTestAdapter );
301
323
@@ -307,7 +329,7 @@ public void testColumnHeadersOnlyTable() throws Throwable {
307
329
simpleTestAdapter .setAllItems (simpleData .getColumnHeaders (), simpleData .getRowHeaders (),
308
330
simpleData .getCells ());
309
331
310
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
332
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
311
333
312
334
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
313
335
@@ -325,6 +347,9 @@ public void testColumnHeadersOnlyTableResetNonEmptyTable() throws Throwable {
325
347
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
326
348
Assert .assertNotNull (tableView );
327
349
350
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
351
+ rl .addView (tableView );
352
+
328
353
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
329
354
Assert .assertNotNull (simpleTestAdapter );
330
355
@@ -346,7 +371,7 @@ public void testColumnHeadersOnlyTableResetNonEmptyTable() throws Throwable {
346
371
simpleTestAdapter .setAllItems (simpleDataReset .getColumnHeaders (), simpleDataReset .getRowHeaders (),
347
372
simpleDataReset .getCells ());
348
373
349
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
374
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
350
375
351
376
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
352
377
@@ -370,6 +395,9 @@ public void testColumnHeadersOnlyTableResetEmptyTable() throws Throwable {
370
395
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
371
396
Assert .assertNotNull (tableView );
372
397
398
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
399
+ rl .addView (tableView );
400
+
373
401
SimpleTestAdapter simpleTestAdapter = new SimpleTestAdapter ();
374
402
Assert .assertNotNull (simpleTestAdapter );
375
403
@@ -391,7 +419,7 @@ public void testColumnHeadersOnlyTableResetEmptyTable() throws Throwable {
391
419
simpleTestAdapter .setAllItems (simpleDataReset .getColumnHeaders (), simpleDataReset .getRowHeaders (),
392
420
simpleDataReset .getCells ());
393
421
394
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
422
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
395
423
396
424
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
397
425
@@ -409,6 +437,9 @@ public void testColumnHeadersOnlyTableShowCorner() throws Throwable {
409
437
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
410
438
Assert .assertNotNull (tableView );
411
439
440
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
441
+ rl .addView (tableView );
442
+
412
443
// Set the option to show corner view when there is not row data
413
444
tableView .setShowCornerView (true );
414
445
@@ -423,7 +454,7 @@ public void testColumnHeadersOnlyTableShowCorner() throws Throwable {
423
454
simpleTestAdapter .setAllItems (simpleData .getColumnHeaders (), simpleData .getRowHeaders (),
424
455
simpleData .getCells ());
425
456
426
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
457
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
427
458
428
459
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
429
460
@@ -447,6 +478,9 @@ public void testColumnHeadersOnlyTableShowCornerResetEmptyTable() throws Throwab
447
478
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
448
479
Assert .assertNotNull (tableView );
449
480
481
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
482
+ rl .addView (tableView );
483
+
450
484
// Set the option to show corner view when there is not row data
451
485
tableView .setShowCornerView (true );
452
486
@@ -471,7 +505,7 @@ public void testColumnHeadersOnlyTableShowCornerResetEmptyTable() throws Throwab
471
505
simpleTestAdapter .setAllItems (simpleDataReset .getColumnHeaders (), simpleDataReset .getRowHeaders (),
472
506
simpleDataReset .getCells ());
473
507
474
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
508
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
475
509
476
510
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
477
511
@@ -491,6 +525,9 @@ public void testColumnHeadersOnlyTableShowCornerResetNonEmptyTable() throws Thro
491
525
new TableView (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
492
526
Assert .assertNotNull (tableView );
493
527
528
+ RelativeLayout rl = new RelativeLayout (InstrumentationRegistry .getInstrumentation ().getTargetContext ());
529
+ rl .addView (tableView );
530
+
494
531
// Set the option to show corner view when there is not row data
495
532
tableView .setShowCornerView (true );
496
533
@@ -515,7 +552,7 @@ public void testColumnHeadersOnlyTableShowCornerResetNonEmptyTable() throws Thro
515
552
simpleTestAdapter .setAllItems (simpleDataReset .getColumnHeaders (), simpleDataReset .getRowHeaders (),
516
553
simpleDataReset .getCells ());
517
554
518
- mActivityTestRule .runOnUiThread (() -> activity .setContentView (tableView ));
555
+ mActivityTestRule .runOnUiThread (() -> activity .setContentView (rl ));
519
556
520
557
InstrumentationRegistry .getInstrumentation ().waitForIdleSync ();
521
558
0 commit comments