|
@@ -22,7 +22,7 @@ public class OptionsTest extends BaseTest {
|
22
|
22
|
private static final int TOP_BAR_FONT_SIZE = 18;
|
23
|
23
|
private static final String TOP_BAR_FONT_FAMILY = "HelveticaNeue-CondensedBold";
|
24
|
24
|
private static final Typeface TOP_BAR_TYPEFACE = Typeface.create("HelveticaNeue-CondensedBold", Typeface.BOLD);
|
25
|
|
- private static final Bool TOP_BAR_HIDDEN = new Bool(true);
|
|
25
|
+ private static final Bool TOP_BAR_VISIBLE = new Bool(true);
|
26
|
26
|
private static final Bool TOP_BAR_DRAW_BEHIND = new Bool(true);
|
27
|
27
|
private static final Bool TOP_BAR_HIDE_ON_SCROLL = new Bool(true);
|
28
|
28
|
private static final Bool BOTTOM_TABS_ANIMATE_HIDE = new Bool(true);
|
|
@@ -46,7 +46,7 @@ public class OptionsTest extends BaseTest {
|
46
|
46
|
@Test
|
47
|
47
|
public void parsesJson() throws Exception {
|
48
|
48
|
JSONObject json = new JSONObject()
|
49
|
|
- .put("topBar", createTopBar(TOP_BAR_HIDDEN.get()))
|
|
49
|
+ .put("topBar", createTopBar(TOP_BAR_VISIBLE.get()))
|
50
|
50
|
.put("bottomTabs", createBottomTabs());
|
51
|
51
|
Options result = Options.parse(mockLoader, json);
|
52
|
52
|
assertResult(result);
|
|
@@ -58,7 +58,7 @@ public class OptionsTest extends BaseTest {
|
58
|
58
|
assertThat(result.topBarOptions.textColor.get()).isEqualTo(TOP_BAR_TEXT_COLOR);
|
59
|
59
|
assertThat(result.topBarOptions.textFontSize.get()).isEqualTo(TOP_BAR_FONT_SIZE);
|
60
|
60
|
assertThat(result.topBarOptions.textFontFamily).isEqualTo(TOP_BAR_TYPEFACE);
|
61
|
|
- assertThat(result.topBarOptions.hidden.get()).isEqualTo(TOP_BAR_HIDDEN.get());
|
|
61
|
+ assertThat(result.topBarOptions.visible.get()).isEqualTo(TOP_BAR_VISIBLE.get());
|
62
|
62
|
assertThat(result.topBarOptions.drawBehind.get()).isEqualTo(TOP_BAR_DRAW_BEHIND.get());
|
63
|
63
|
assertThat(result.topBarOptions.hideOnScroll.get()).isEqualTo(TOP_BAR_HIDE_ON_SCROLL.get());
|
64
|
64
|
assertThat(result.bottomTabsOptions.animateHide.get()).isEqualTo(BOTTOM_TABS_ANIMATE_HIDE.get());
|
|
@@ -77,14 +77,14 @@ public class OptionsTest extends BaseTest {
|
77
|
77
|
}
|
78
|
78
|
|
79
|
79
|
@NonNull
|
80
|
|
- private JSONObject createTopBar(boolean hidden) throws JSONException {
|
|
80
|
+ private JSONObject createTopBar(boolean visible) throws JSONException {
|
81
|
81
|
return new JSONObject()
|
82
|
82
|
.put("title", "the title")
|
83
|
83
|
.put("backgroundColor", TOP_BAR_BACKGROUND_COLOR)
|
84
|
84
|
.put("textColor", TOP_BAR_TEXT_COLOR)
|
85
|
85
|
.put("textFontSize", TOP_BAR_FONT_SIZE)
|
86
|
86
|
.put("textFontFamily", TOP_BAR_FONT_FAMILY)
|
87
|
|
- .put("hidden", hidden)
|
|
87
|
+ .put("visible", visible)
|
88
|
88
|
.put("drawBehind", TOP_BAR_DRAW_BEHIND.get())
|
89
|
89
|
.put("hideOnScroll", TOP_BAR_HIDE_ON_SCROLL.get());
|
90
|
90
|
}
|
|
@@ -97,7 +97,7 @@ public class OptionsTest extends BaseTest {
|
97
|
97
|
.put("textColor", TOP_BAR_TEXT_COLOR)
|
98
|
98
|
.put("textFontSize", TOP_BAR_FONT_SIZE)
|
99
|
99
|
.put("textFontFamily", TOP_BAR_FONT_FAMILY)
|
100
|
|
- .put("visible", TOP_BAR_HIDDEN);
|
|
100
|
+ .put("visible", TOP_BAR_VISIBLE);
|
101
|
101
|
}
|
102
|
102
|
|
103
|
103
|
@NonNull
|
|
@@ -117,22 +117,21 @@ public class OptionsTest extends BaseTest {
|
117
|
117
|
Options options1 = Options.parse(mockLoader, json1);
|
118
|
118
|
options1.topBarOptions.title = new Text("some title");
|
119
|
119
|
|
120
|
|
-
|
121
|
120
|
JSONObject json2 = new JSONObject();
|
122
|
121
|
json2.put("topBar", createTopBar(false));
|
123
|
122
|
Options options2 = Options.parse(mockLoader, json2);
|
124
|
123
|
options2.topBarOptions.title = new NullText();
|
125
|
124
|
|
126
|
125
|
Options merged = options1.mergeWith(options2);
|
127
|
|
- assertThat(options1.topBarOptions.hidden.get()).isTrue();
|
128
|
|
- assertThat(merged.topBarOptions.hidden.get()).isFalse();
|
|
126
|
+ assertThat(options1.topBarOptions.visible.get()).isTrue();
|
|
127
|
+ assertThat(merged.topBarOptions.visible.get()).isFalse();
|
129
|
128
|
assertThat(merged.topBarOptions.title.get()).isEqualTo("some title");
|
130
|
129
|
}
|
131
|
130
|
|
132
|
131
|
@Test
|
133
|
132
|
public void mergeDefaultOptions() throws Exception {
|
134
|
133
|
JSONObject json = new JSONObject();
|
135
|
|
- json.put("topBar", createTopBar(TOP_BAR_HIDDEN.get()));
|
|
134
|
+ json.put("topBar", createTopBar(TOP_BAR_VISIBLE.get()));
|
136
|
135
|
json.put("bottomTabs", createBottomTabs());
|
137
|
136
|
Options defaultOptions = Options.parse(mockLoader, json);
|
138
|
137
|
Options options = new Options();
|
|
@@ -148,7 +147,7 @@ public class OptionsTest extends BaseTest {
|
148
|
147
|
Options defaultOptions = Options.parse(mockLoader, defaultJson);
|
149
|
148
|
|
150
|
149
|
JSONObject json = new JSONObject()
|
151
|
|
- .put("topBar", createTopBar(TOP_BAR_HIDDEN.get()))
|
|
150
|
+ .put("topBar", createTopBar(TOP_BAR_VISIBLE.get()))
|
152
|
151
|
.put("bottomTabs", createBottomTabs());
|
153
|
152
|
Options options = Options.parse(mockLoader, json);
|
154
|
153
|
options.withDefaultOptions(defaultOptions);
|
|
@@ -164,7 +163,7 @@ public class OptionsTest extends BaseTest {
|
164
|
163
|
@Test
|
165
|
164
|
public void topBar_defaultOptions() throws Exception {
|
166
|
165
|
Options uut = new Options();
|
167
|
|
- assertThat(uut.topBarOptions.hidden.isFalseOrUndefined()).isTrue();
|
|
166
|
+ assertThat(uut.topBarOptions.visible.isFalseOrUndefined()).isTrue();
|
168
|
167
|
assertThat(uut.topBarOptions.animateHide.isTrueOrUndefined()).isTrue();
|
169
|
168
|
}
|
170
|
169
|
}
|