|
@@ -20,13 +20,13 @@ public class OrientationOptionsTest extends BaseTest {
|
20
|
20
|
}
|
21
|
21
|
|
22
|
22
|
@Test
|
23
|
|
- public void parse() throws Exception {
|
|
23
|
+ public void parse() {
|
24
|
24
|
OrientationOptions options = OrientationOptions.parse(create("default"));
|
25
|
25
|
assertThat(options.orientations).hasSize(1);
|
26
|
26
|
}
|
27
|
27
|
|
28
|
28
|
@Test
|
29
|
|
- public void parseOrientations() throws Exception {
|
|
29
|
+ public void parseOrientations() {
|
30
|
30
|
OrientationOptions options = OrientationOptions.parse(create("default", "landscape", "portrait"));
|
31
|
31
|
assertThat(options.orientations.get(0)).isEqualTo(Orientation.Default);
|
32
|
32
|
assertThat(options.orientations.get(1)).isEqualTo(Orientation.Landscape);
|
|
@@ -34,36 +34,42 @@ public class OrientationOptionsTest extends BaseTest {
|
34
|
34
|
}
|
35
|
35
|
|
36
|
36
|
@Test
|
37
|
|
- public void parseSingleOrientation() throws Exception {
|
|
37
|
+ public void parseSingleOrientation() {
|
38
|
38
|
OrientationOptions options = OrientationOptions.parse(create("landscape"));
|
39
|
39
|
assertThat(options.orientations.get(0)).isEqualTo(Orientation.Landscape);
|
40
|
40
|
}
|
41
|
41
|
|
42
|
42
|
@Test
|
43
|
|
- public void landscapePortrait_regardedAsUserOrientation() throws Exception {
|
|
43
|
+ public void landscapePortrait_regardedAsUserOrientation() {
|
44
|
44
|
OrientationOptions options = OrientationOptions.parse(create("landscape", "portrait"));
|
45
|
45
|
assertThat(options.getValue()).isEqualTo(Orientation.PortraitLandscape.orientationCode);
|
46
|
46
|
}
|
47
|
47
|
|
48
|
48
|
@Test
|
49
|
|
- public void portraitLandscape_regardedAsUserOrientation() throws Exception {
|
|
49
|
+ public void portraitLandscape_regardedAsUserOrientation() {
|
50
|
50
|
OrientationOptions options = OrientationOptions.parse(create("portrait", "landscape"));
|
51
|
51
|
assertThat(options.getValue()).isEqualTo(Orientation.PortraitLandscape.orientationCode);
|
52
|
52
|
}
|
53
|
53
|
|
54
|
54
|
@Test
|
55
|
|
- public void unsupportedOrientationsAreIgnored() throws Exception {
|
|
55
|
+ public void unsupportedOrientationsAreIgnored() {
|
56
|
56
|
OrientationOptions options = OrientationOptions.parse(create("default", "autoRotate"));
|
57
|
57
|
assertThat(options.orientations).hasSize(1);
|
58
|
58
|
assertThat(options.orientations.get(0)).isEqualTo(Orientation.Default);
|
59
|
59
|
}
|
60
|
60
|
|
61
|
61
|
@Test
|
62
|
|
- public void getValue_returnsDefaultIfUndefined() throws Exception {
|
|
62
|
+ public void getValue_returnsDefaultIfUndefined() {
|
63
|
63
|
OrientationOptions options = new OrientationOptions();
|
64
|
64
|
assertThat(options.getValue()).isEqualTo(Orientation.Default.orientationCode);
|
65
|
65
|
}
|
66
|
66
|
|
|
67
|
+ @Test
|
|
68
|
+ public void hasValue_returnsFalseForOrientationDefault() {
|
|
69
|
+ OrientationOptions options = OrientationOptions.parse(create("default"));
|
|
70
|
+ assertThat(options.hasValue()).isFalse();
|
|
71
|
+ }
|
|
72
|
+
|
67
|
73
|
private JSONObject create(String... orientations) {
|
68
|
74
|
JSONObject orientation = new JSONObject();
|
69
|
75
|
try {
|