summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java
blob: 60e305d60785a9370088fbc54d7af80d1b0f70ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.

package com.mapbox.mapboxsdk.testapp.style;

import android.graphics.Color;
import android.support.test.annotation.UiThreadTest;
import android.support.test.runner.AndroidJUnit4;

import com.mapbox.mapboxsdk.maps.BaseLayerTest;
import org.junit.Before;
import timber.log.Timber;

import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.types.Formatted;
import com.mapbox.mapboxsdk.style.types.FormattedSection;

import org.junit.Test;
import org.junit.runner.RunWith;

import static com.mapbox.mapboxsdk.style.expressions.Expression.*;
import static org.junit.Assert.*;
import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;

import com.mapbox.mapboxsdk.style.layers.TransitionOptions;

/**
 * Basic smoke tests for SymbolLayer
 */
@RunWith(AndroidJUnit4.class)
public class SymbolLayerTest extends BaseLayerTest {

  private SymbolLayer layer;

  @Before
  @UiThreadTest
  public void beforeTest(){
    super.before();
    layer = new SymbolLayer("my-layer", "composite");
    layer.setSourceLayer("composite");
    setupLayer(layer);
  }

  @Test
  @UiThreadTest
  public void testSourceId() {
    Timber.i("SourceId");
    assertNotNull(layer);
    assertEquals(layer.getSourceId(), "composite");
  }

  @Test
  @UiThreadTest
  public void testSetVisibility() {
    Timber.i("Visibility");
    assertNotNull(layer);

    // Get initial
    assertEquals(layer.getVisibility().getValue(), VISIBLE);

    // Set
    layer.setProperties(visibility(NONE));
    assertEquals(layer.getVisibility().getValue(), NONE);
  }

  @Test
  @UiThreadTest
  public void testSourceLayer() {
    Timber.i("SourceLayer");
    assertNotNull(layer);

    // Get initial
    assertEquals(layer.getSourceLayer(), "composite");

    // Set
    final String sourceLayer = "test";
    layer.setSourceLayer(sourceLayer);
    assertEquals(layer.getSourceLayer(), sourceLayer);
  }

  @Test
  @UiThreadTest
  public void testFilter() {
    Timber.i("Filter");
    assertNotNull(layer);

    // Get initial
    assertEquals(layer.getFilter(), null);

    // Set
    Expression filter = eq(get("undefined"), literal(1.0));
    layer.setFilter(filter);
    assertEquals(layer.getFilter().toString(), filter.toString());

    // Set constant
    filter = literal(true);
    layer.setFilter(filter);
    assertEquals(layer.getFilter().toString(), filter.toString());
  }



  @Test
  @UiThreadTest
  public void testSymbolPlacementAsConstant() {
    Timber.i("symbol-placement");
    assertNotNull(layer);
    assertNull(layer.getSymbolPlacement().getValue());

    // Set and Get
    String propertyValue = SYMBOL_PLACEMENT_POINT;
    layer.setProperties(symbolPlacement(propertyValue));
    assertEquals(layer.getSymbolPlacement().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testSymbolSpacingAsConstant() {
    Timber.i("symbol-spacing");
    assertNotNull(layer);
    assertNull(layer.getSymbolSpacing().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(symbolSpacing(propertyValue));
    assertEquals(layer.getSymbolSpacing().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testSymbolAvoidEdgesAsConstant() {
    Timber.i("symbol-avoid-edges");
    assertNotNull(layer);
    assertNull(layer.getSymbolAvoidEdges().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(symbolAvoidEdges(propertyValue));
    assertEquals(layer.getSymbolAvoidEdges().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testSymbolSortKeyAsConstant() {
    Timber.i("symbol-sort-key");
    assertNotNull(layer);
    assertNull(layer.getSymbolSortKey().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(symbolSortKey(propertyValue));
    assertEquals(layer.getSymbolSortKey().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testSymbolSortKeyAsExpression() {
    Timber.i("symbol-sort-key-expression");
    assertNotNull(layer);
    assertNull(layer.getSymbolSortKey().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(symbolSortKey(expression));
    assertEquals(layer.getSymbolSortKey().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testSymbolZOrderAsConstant() {
    Timber.i("symbol-z-order");
    assertNotNull(layer);
    assertNull(layer.getSymbolZOrder().getValue());

    // Set and Get
    String propertyValue = SYMBOL_Z_ORDER_AUTO;
    layer.setProperties(symbolZOrder(propertyValue));
    assertEquals(layer.getSymbolZOrder().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconAllowOverlapAsConstant() {
    Timber.i("icon-allow-overlap");
    assertNotNull(layer);
    assertNull(layer.getIconAllowOverlap().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(iconAllowOverlap(propertyValue));
    assertEquals(layer.getIconAllowOverlap().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconIgnorePlacementAsConstant() {
    Timber.i("icon-ignore-placement");
    assertNotNull(layer);
    assertNull(layer.getIconIgnorePlacement().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(iconIgnorePlacement(propertyValue));
    assertEquals(layer.getIconIgnorePlacement().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconOptionalAsConstant() {
    Timber.i("icon-optional");
    assertNotNull(layer);
    assertNull(layer.getIconOptional().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(iconOptional(propertyValue));
    assertEquals(layer.getIconOptional().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconRotationAlignmentAsConstant() {
    Timber.i("icon-rotation-alignment");
    assertNotNull(layer);
    assertNull(layer.getIconRotationAlignment().getValue());

    // Set and Get
    String propertyValue = ICON_ROTATION_ALIGNMENT_MAP;
    layer.setProperties(iconRotationAlignment(propertyValue));
    assertEquals(layer.getIconRotationAlignment().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconSizeAsConstant() {
    Timber.i("icon-size");
    assertNotNull(layer);
    assertNull(layer.getIconSize().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(iconSize(propertyValue));
    assertEquals(layer.getIconSize().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconSizeAsExpression() {
    Timber.i("icon-size-expression");
    assertNotNull(layer);
    assertNull(layer.getIconSize().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(iconSize(expression));
    assertEquals(layer.getIconSize().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconTextFitAsConstant() {
    Timber.i("icon-text-fit");
    assertNotNull(layer);
    assertNull(layer.getIconTextFit().getValue());

    // Set and Get
    String propertyValue = ICON_TEXT_FIT_NONE;
    layer.setProperties(iconTextFit(propertyValue));
    assertEquals(layer.getIconTextFit().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconTextFitPaddingAsConstant() {
    Timber.i("icon-text-fit-padding");
    assertNotNull(layer);
    assertNull(layer.getIconTextFitPadding().getValue());

    // Set and Get
    Float[] propertyValue = new Float[] {0f, 0f, 0f, 0f};
    layer.setProperties(iconTextFitPadding(propertyValue));
    assertEquals(layer.getIconTextFitPadding().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconImageAsConstant() {
    Timber.i("icon-image");
    assertNotNull(layer);
    assertNull(layer.getIconImage().getValue());

    // Set and Get
    String propertyValue = "undefined";
    layer.setProperties(iconImage(propertyValue));
    assertEquals(layer.getIconImage().getValue(), propertyValue);

    layer.setProperties(iconImage("{token}"));
    assertEquals(layer.getIconImage().getExpression(), Expression.toString(Expression.get("token")));
  }

  @Test
  @UiThreadTest
  public void testIconImageAsExpression() {
    Timber.i("icon-image-expression");
    assertNotNull(layer);
    assertNull(layer.getIconImage().getExpression());

    // Set and Get
    Expression expression = string(Expression.get("undefined"));
    layer.setProperties(iconImage(expression));
    assertEquals(layer.getIconImage().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconRotateAsConstant() {
    Timber.i("icon-rotate");
    assertNotNull(layer);
    assertNull(layer.getIconRotate().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(iconRotate(propertyValue));
    assertEquals(layer.getIconRotate().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconRotateAsExpression() {
    Timber.i("icon-rotate-expression");
    assertNotNull(layer);
    assertNull(layer.getIconRotate().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(iconRotate(expression));
    assertEquals(layer.getIconRotate().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconPaddingAsConstant() {
    Timber.i("icon-padding");
    assertNotNull(layer);
    assertNull(layer.getIconPadding().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(iconPadding(propertyValue));
    assertEquals(layer.getIconPadding().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconKeepUprightAsConstant() {
    Timber.i("icon-keep-upright");
    assertNotNull(layer);
    assertNull(layer.getIconKeepUpright().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(iconKeepUpright(propertyValue));
    assertEquals(layer.getIconKeepUpright().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconOffsetAsConstant() {
    Timber.i("icon-offset");
    assertNotNull(layer);
    assertNull(layer.getIconOffset().getValue());

    // Set and Get
    Float[] propertyValue = new Float[] {0f, 0f};
    layer.setProperties(iconOffset(propertyValue));
    assertEquals(layer.getIconOffset().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconAnchorAsConstant() {
    Timber.i("icon-anchor");
    assertNotNull(layer);
    assertNull(layer.getIconAnchor().getValue());

    // Set and Get
    String propertyValue = ICON_ANCHOR_CENTER;
    layer.setProperties(iconAnchor(propertyValue));
    assertEquals(layer.getIconAnchor().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconAnchorAsExpression() {
    Timber.i("icon-anchor-expression");
    assertNotNull(layer);
    assertNull(layer.getIconAnchor().getExpression());

    // Set and Get
    Expression expression = string(Expression.get("undefined"));
    layer.setProperties(iconAnchor(expression));
    assertEquals(layer.getIconAnchor().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconPitchAlignmentAsConstant() {
    Timber.i("icon-pitch-alignment");
    assertNotNull(layer);
    assertNull(layer.getIconPitchAlignment().getValue());

    // Set and Get
    String propertyValue = ICON_PITCH_ALIGNMENT_MAP;
    layer.setProperties(iconPitchAlignment(propertyValue));
    assertEquals(layer.getIconPitchAlignment().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextPitchAlignmentAsConstant() {
    Timber.i("text-pitch-alignment");
    assertNotNull(layer);
    assertNull(layer.getTextPitchAlignment().getValue());

    // Set and Get
    String propertyValue = TEXT_PITCH_ALIGNMENT_MAP;
    layer.setProperties(textPitchAlignment(propertyValue));
    assertEquals(layer.getTextPitchAlignment().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextRotationAlignmentAsConstant() {
    Timber.i("text-rotation-alignment");
    assertNotNull(layer);
    assertNull(layer.getTextRotationAlignment().getValue());

    // Set and Get
    String propertyValue = TEXT_ROTATION_ALIGNMENT_MAP;
    layer.setProperties(textRotationAlignment(propertyValue));
    assertEquals(layer.getTextRotationAlignment().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextFieldAsConstant() {
    Timber.i("text-field");
    assertNotNull(layer);
    assertNull(layer.getTextField().getValue());

    // Set and Get
    Formatted propertyValue = new Formatted(new FormattedSection("default"));
    layer.setProperties(textField("default"));
    assertEquals(layer.getTextField().getValue(), propertyValue);
    layer.setProperties(textField(propertyValue));
    assertEquals(layer.getTextField().getValue(), propertyValue);

    layer.setProperties(textField("{token}"));
    assertEquals(layer.getTextField().getExpression(), format(Expression.formatEntry(Expression.toString(Expression.get("token")))));
  }

  @Test
  @UiThreadTest
  public void testTextFieldAsExpression() {
    Timber.i("text-field-expression");
    assertNotNull(layer);
    assertNull(layer.getTextField().getExpression());

    // Set and Get
    Expression expression = format(Expression.formatEntry(Expression.get("undefined"), FormatOption.formatFontScale(2.0), FormatOption.formatTextFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})));
    layer.setProperties(textField(expression));
    assertEquals(layer.getTextField().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextFontAsConstant() {
    Timber.i("text-font");
    assertNotNull(layer);
    assertNull(layer.getTextFont().getValue());

    // Set and Get
    String[] propertyValue = new String[]{"Open Sans Regular", "Arial Unicode MS Regular"};
    layer.setProperties(textFont(propertyValue));
    assertEquals(layer.getTextFont().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextSizeAsConstant() {
    Timber.i("text-size");
    assertNotNull(layer);
    assertNull(layer.getTextSize().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textSize(propertyValue));
    assertEquals(layer.getTextSize().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextSizeAsExpression() {
    Timber.i("text-size-expression");
    assertNotNull(layer);
    assertNull(layer.getTextSize().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(textSize(expression));
    assertEquals(layer.getTextSize().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextMaxWidthAsConstant() {
    Timber.i("text-max-width");
    assertNotNull(layer);
    assertNull(layer.getTextMaxWidth().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textMaxWidth(propertyValue));
    assertEquals(layer.getTextMaxWidth().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextMaxWidthAsExpression() {
    Timber.i("text-max-width-expression");
    assertNotNull(layer);
    assertNull(layer.getTextMaxWidth().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(textMaxWidth(expression));
    assertEquals(layer.getTextMaxWidth().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextLineHeightAsConstant() {
    Timber.i("text-line-height");
    assertNotNull(layer);
    assertNull(layer.getTextLineHeight().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textLineHeight(propertyValue));
    assertEquals(layer.getTextLineHeight().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextLetterSpacingAsConstant() {
    Timber.i("text-letter-spacing");
    assertNotNull(layer);
    assertNull(layer.getTextLetterSpacing().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textLetterSpacing(propertyValue));
    assertEquals(layer.getTextLetterSpacing().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextLetterSpacingAsExpression() {
    Timber.i("text-letter-spacing-expression");
    assertNotNull(layer);
    assertNull(layer.getTextLetterSpacing().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(textLetterSpacing(expression));
    assertEquals(layer.getTextLetterSpacing().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextJustifyAsConstant() {
    Timber.i("text-justify");
    assertNotNull(layer);
    assertNull(layer.getTextJustify().getValue());

    // Set and Get
    String propertyValue = TEXT_JUSTIFY_AUTO;
    layer.setProperties(textJustify(propertyValue));
    assertEquals(layer.getTextJustify().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextJustifyAsExpression() {
    Timber.i("text-justify-expression");
    assertNotNull(layer);
    assertNull(layer.getTextJustify().getExpression());

    // Set and Get
    Expression expression = string(Expression.get("undefined"));
    layer.setProperties(textJustify(expression));
    assertEquals(layer.getTextJustify().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextRadialOffsetAsConstant() {
    Timber.i("text-radial-offset");
    assertNotNull(layer);
    assertNull(layer.getTextRadialOffset().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textRadialOffset(propertyValue));
    assertEquals(layer.getTextRadialOffset().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextVariableAnchorAsConstant() {
    Timber.i("text-variable-anchor");
    assertNotNull(layer);
    assertNull(layer.getTextVariableAnchor().getValue());

    // Set and Get
    String[] propertyValue = new String[0];
    layer.setProperties(textVariableAnchor(propertyValue));
    assertEquals(layer.getTextVariableAnchor().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextAnchorAsConstant() {
    Timber.i("text-anchor");
    assertNotNull(layer);
    assertNull(layer.getTextAnchor().getValue());

    // Set and Get
    String propertyValue = TEXT_ANCHOR_CENTER;
    layer.setProperties(textAnchor(propertyValue));
    assertEquals(layer.getTextAnchor().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextAnchorAsExpression() {
    Timber.i("text-anchor-expression");
    assertNotNull(layer);
    assertNull(layer.getTextAnchor().getExpression());

    // Set and Get
    Expression expression = string(Expression.get("undefined"));
    layer.setProperties(textAnchor(expression));
    assertEquals(layer.getTextAnchor().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextMaxAngleAsConstant() {
    Timber.i("text-max-angle");
    assertNotNull(layer);
    assertNull(layer.getTextMaxAngle().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textMaxAngle(propertyValue));
    assertEquals(layer.getTextMaxAngle().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextRotateAsConstant() {
    Timber.i("text-rotate");
    assertNotNull(layer);
    assertNull(layer.getTextRotate().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textRotate(propertyValue));
    assertEquals(layer.getTextRotate().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextRotateAsExpression() {
    Timber.i("text-rotate-expression");
    assertNotNull(layer);
    assertNull(layer.getTextRotate().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(textRotate(expression));
    assertEquals(layer.getTextRotate().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextPaddingAsConstant() {
    Timber.i("text-padding");
    assertNotNull(layer);
    assertNull(layer.getTextPadding().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textPadding(propertyValue));
    assertEquals(layer.getTextPadding().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextKeepUprightAsConstant() {
    Timber.i("text-keep-upright");
    assertNotNull(layer);
    assertNull(layer.getTextKeepUpright().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(textKeepUpright(propertyValue));
    assertEquals(layer.getTextKeepUpright().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextTransformAsConstant() {
    Timber.i("text-transform");
    assertNotNull(layer);
    assertNull(layer.getTextTransform().getValue());

    // Set and Get
    String propertyValue = TEXT_TRANSFORM_NONE;
    layer.setProperties(textTransform(propertyValue));
    assertEquals(layer.getTextTransform().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextTransformAsExpression() {
    Timber.i("text-transform-expression");
    assertNotNull(layer);
    assertNull(layer.getTextTransform().getExpression());

    // Set and Get
    Expression expression = string(Expression.get("undefined"));
    layer.setProperties(textTransform(expression));
    assertEquals(layer.getTextTransform().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextOffsetAsConstant() {
    Timber.i("text-offset");
    assertNotNull(layer);
    assertNull(layer.getTextOffset().getValue());

    // Set and Get
    Float[] propertyValue = new Float[] {0f, 0f};
    layer.setProperties(textOffset(propertyValue));
    assertEquals(layer.getTextOffset().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextAllowOverlapAsConstant() {
    Timber.i("text-allow-overlap");
    assertNotNull(layer);
    assertNull(layer.getTextAllowOverlap().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(textAllowOverlap(propertyValue));
    assertEquals(layer.getTextAllowOverlap().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextIgnorePlacementAsConstant() {
    Timber.i("text-ignore-placement");
    assertNotNull(layer);
    assertNull(layer.getTextIgnorePlacement().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(textIgnorePlacement(propertyValue));
    assertEquals(layer.getTextIgnorePlacement().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextOptionalAsConstant() {
    Timber.i("text-optional");
    assertNotNull(layer);
    assertNull(layer.getTextOptional().getValue());

    // Set and Get
    Boolean propertyValue = true;
    layer.setProperties(textOptional(propertyValue));
    assertEquals(layer.getTextOptional().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconOpacityTransition() {
    Timber.i("icon-opacityTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setIconOpacityTransition(options);
    assertEquals(layer.getIconOpacityTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testIconOpacityAsConstant() {
    Timber.i("icon-opacity");
    assertNotNull(layer);
    assertNull(layer.getIconOpacity().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(iconOpacity(propertyValue));
    assertEquals(layer.getIconOpacity().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconOpacityAsExpression() {
    Timber.i("icon-opacity-expression");
    assertNotNull(layer);
    assertNull(layer.getIconOpacity().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(iconOpacity(expression));
    assertEquals(layer.getIconOpacity().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconColorTransition() {
    Timber.i("icon-colorTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setIconColorTransition(options);
    assertEquals(layer.getIconColorTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testIconColorAsConstant() {
    Timber.i("icon-color");
    assertNotNull(layer);
    assertNull(layer.getIconColor().getValue());

    // Set and Get
    String propertyValue = "rgba(255,128,0,0.7)";
    layer.setProperties(iconColor(propertyValue));
    assertEquals(layer.getIconColor().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconColorAsExpression() {
    Timber.i("icon-color-expression");
    assertNotNull(layer);
    assertNull(layer.getIconColor().getExpression());

    // Set and Get
    Expression expression = toColor(Expression.get("undefined"));
    layer.setProperties(iconColor(expression));
    assertEquals(layer.getIconColor().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconColorAsIntConstant() {
    Timber.i("icon-color");
    assertNotNull(layer);

    // Set and Get
    layer.setProperties(iconColor(Color.argb(127, 255, 127, 0)));
    assertEquals(layer.getIconColorAsInt(), Color.argb(127, 255, 127, 0));
  }

  @Test
  @UiThreadTest
  public void testIconHaloColorTransition() {
    Timber.i("icon-halo-colorTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setIconHaloColorTransition(options);
    assertEquals(layer.getIconHaloColorTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testIconHaloColorAsConstant() {
    Timber.i("icon-halo-color");
    assertNotNull(layer);
    assertNull(layer.getIconHaloColor().getValue());

    // Set and Get
    String propertyValue = "rgba(255,128,0,0.7)";
    layer.setProperties(iconHaloColor(propertyValue));
    assertEquals(layer.getIconHaloColor().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconHaloColorAsExpression() {
    Timber.i("icon-halo-color-expression");
    assertNotNull(layer);
    assertNull(layer.getIconHaloColor().getExpression());

    // Set and Get
    Expression expression = toColor(Expression.get("undefined"));
    layer.setProperties(iconHaloColor(expression));
    assertEquals(layer.getIconHaloColor().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconHaloColorAsIntConstant() {
    Timber.i("icon-halo-color");
    assertNotNull(layer);

    // Set and Get
    layer.setProperties(iconHaloColor(Color.argb(127, 255, 127, 0)));
    assertEquals(layer.getIconHaloColorAsInt(), Color.argb(127, 255, 127, 0));
  }

  @Test
  @UiThreadTest
  public void testIconHaloWidthTransition() {
    Timber.i("icon-halo-widthTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setIconHaloWidthTransition(options);
    assertEquals(layer.getIconHaloWidthTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testIconHaloWidthAsConstant() {
    Timber.i("icon-halo-width");
    assertNotNull(layer);
    assertNull(layer.getIconHaloWidth().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(iconHaloWidth(propertyValue));
    assertEquals(layer.getIconHaloWidth().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconHaloWidthAsExpression() {
    Timber.i("icon-halo-width-expression");
    assertNotNull(layer);
    assertNull(layer.getIconHaloWidth().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(iconHaloWidth(expression));
    assertEquals(layer.getIconHaloWidth().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconHaloBlurTransition() {
    Timber.i("icon-halo-blurTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setIconHaloBlurTransition(options);
    assertEquals(layer.getIconHaloBlurTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testIconHaloBlurAsConstant() {
    Timber.i("icon-halo-blur");
    assertNotNull(layer);
    assertNull(layer.getIconHaloBlur().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(iconHaloBlur(propertyValue));
    assertEquals(layer.getIconHaloBlur().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconHaloBlurAsExpression() {
    Timber.i("icon-halo-blur-expression");
    assertNotNull(layer);
    assertNull(layer.getIconHaloBlur().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(iconHaloBlur(expression));
    assertEquals(layer.getIconHaloBlur().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testIconTranslateTransition() {
    Timber.i("icon-translateTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setIconTranslateTransition(options);
    assertEquals(layer.getIconTranslateTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testIconTranslateAsConstant() {
    Timber.i("icon-translate");
    assertNotNull(layer);
    assertNull(layer.getIconTranslate().getValue());

    // Set and Get
    Float[] propertyValue = new Float[] {0f, 0f};
    layer.setProperties(iconTranslate(propertyValue));
    assertEquals(layer.getIconTranslate().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testIconTranslateAnchorAsConstant() {
    Timber.i("icon-translate-anchor");
    assertNotNull(layer);
    assertNull(layer.getIconTranslateAnchor().getValue());

    // Set and Get
    String propertyValue = ICON_TRANSLATE_ANCHOR_MAP;
    layer.setProperties(iconTranslateAnchor(propertyValue));
    assertEquals(layer.getIconTranslateAnchor().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextOpacityTransition() {
    Timber.i("text-opacityTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setTextOpacityTransition(options);
    assertEquals(layer.getTextOpacityTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testTextOpacityAsConstant() {
    Timber.i("text-opacity");
    assertNotNull(layer);
    assertNull(layer.getTextOpacity().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textOpacity(propertyValue));
    assertEquals(layer.getTextOpacity().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextOpacityAsExpression() {
    Timber.i("text-opacity-expression");
    assertNotNull(layer);
    assertNull(layer.getTextOpacity().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(textOpacity(expression));
    assertEquals(layer.getTextOpacity().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextColorTransition() {
    Timber.i("text-colorTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setTextColorTransition(options);
    assertEquals(layer.getTextColorTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testTextColorAsConstant() {
    Timber.i("text-color");
    assertNotNull(layer);
    assertNull(layer.getTextColor().getValue());

    // Set and Get
    String propertyValue = "rgba(255,128,0,0.7)";
    layer.setProperties(textColor(propertyValue));
    assertEquals(layer.getTextColor().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextColorAsExpression() {
    Timber.i("text-color-expression");
    assertNotNull(layer);
    assertNull(layer.getTextColor().getExpression());

    // Set and Get
    Expression expression = toColor(Expression.get("undefined"));
    layer.setProperties(textColor(expression));
    assertEquals(layer.getTextColor().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextColorAsIntConstant() {
    Timber.i("text-color");
    assertNotNull(layer);

    // Set and Get
    layer.setProperties(textColor(Color.argb(127, 255, 127, 0)));
    assertEquals(layer.getTextColorAsInt(), Color.argb(127, 255, 127, 0));
  }

  @Test
  @UiThreadTest
  public void testTextHaloColorTransition() {
    Timber.i("text-halo-colorTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setTextHaloColorTransition(options);
    assertEquals(layer.getTextHaloColorTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testTextHaloColorAsConstant() {
    Timber.i("text-halo-color");
    assertNotNull(layer);
    assertNull(layer.getTextHaloColor().getValue());

    // Set and Get
    String propertyValue = "rgba(255,128,0,0.7)";
    layer.setProperties(textHaloColor(propertyValue));
    assertEquals(layer.getTextHaloColor().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextHaloColorAsExpression() {
    Timber.i("text-halo-color-expression");
    assertNotNull(layer);
    assertNull(layer.getTextHaloColor().getExpression());

    // Set and Get
    Expression expression = toColor(Expression.get("undefined"));
    layer.setProperties(textHaloColor(expression));
    assertEquals(layer.getTextHaloColor().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextHaloColorAsIntConstant() {
    Timber.i("text-halo-color");
    assertNotNull(layer);

    // Set and Get
    layer.setProperties(textHaloColor(Color.argb(127, 255, 127, 0)));
    assertEquals(layer.getTextHaloColorAsInt(), Color.argb(127, 255, 127, 0));
  }

  @Test
  @UiThreadTest
  public void testTextHaloWidthTransition() {
    Timber.i("text-halo-widthTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setTextHaloWidthTransition(options);
    assertEquals(layer.getTextHaloWidthTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testTextHaloWidthAsConstant() {
    Timber.i("text-halo-width");
    assertNotNull(layer);
    assertNull(layer.getTextHaloWidth().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textHaloWidth(propertyValue));
    assertEquals(layer.getTextHaloWidth().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextHaloWidthAsExpression() {
    Timber.i("text-halo-width-expression");
    assertNotNull(layer);
    assertNull(layer.getTextHaloWidth().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(textHaloWidth(expression));
    assertEquals(layer.getTextHaloWidth().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextHaloBlurTransition() {
    Timber.i("text-halo-blurTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setTextHaloBlurTransition(options);
    assertEquals(layer.getTextHaloBlurTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testTextHaloBlurAsConstant() {
    Timber.i("text-halo-blur");
    assertNotNull(layer);
    assertNull(layer.getTextHaloBlur().getValue());

    // Set and Get
    Float propertyValue = 0.3f;
    layer.setProperties(textHaloBlur(propertyValue));
    assertEquals(layer.getTextHaloBlur().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextHaloBlurAsExpression() {
    Timber.i("text-halo-blur-expression");
    assertNotNull(layer);
    assertNull(layer.getTextHaloBlur().getExpression());

    // Set and Get
    Expression expression = number(Expression.get("undefined"));
    layer.setProperties(textHaloBlur(expression));
    assertEquals(layer.getTextHaloBlur().getExpression(), expression);
  }

  @Test
  @UiThreadTest
  public void testTextTranslateTransition() {
    Timber.i("text-translateTransitionOptions");
    assertNotNull(layer);

    // Set and Get
    TransitionOptions options = new TransitionOptions(300, 100);
    layer.setTextTranslateTransition(options);
    assertEquals(layer.getTextTranslateTransition(), options);
  }

  @Test
  @UiThreadTest
  public void testTextTranslateAsConstant() {
    Timber.i("text-translate");
    assertNotNull(layer);
    assertNull(layer.getTextTranslate().getValue());

    // Set and Get
    Float[] propertyValue = new Float[] {0f, 0f};
    layer.setProperties(textTranslate(propertyValue));
    assertEquals(layer.getTextTranslate().getValue(), propertyValue);
  }

  @Test
  @UiThreadTest
  public void testTextTranslateAnchorAsConstant() {
    Timber.i("text-translate-anchor");
    assertNotNull(layer);
    assertNull(layer.getTextTranslateAnchor().getValue());

    // Set and Get
    String propertyValue = TEXT_TRANSLATE_ANCHOR_MAP;
    layer.setProperties(textTranslateAnchor(propertyValue));
    assertEquals(layer.getTextTranslateAnchor().getValue(), propertyValue);
  }
}