|
@@ -25,6 +25,7 @@ import org.junit.Test;
|
25
|
25
|
|
26
|
26
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
27
|
27
|
import static org.mockito.ArgumentMatchers.any;
|
|
28
|
+import static org.mockito.ArgumentMatchers.anyInt;
|
28
|
29
|
import static org.mockito.ArgumentMatchers.eq;
|
29
|
30
|
import static org.mockito.Mockito.spy;
|
30
|
31
|
import static org.mockito.Mockito.times;
|
|
@@ -100,7 +101,7 @@ public class TopBarButtonControllerTest extends BaseTest {
|
100
|
101
|
setIconButton(false);
|
101
|
102
|
button.disableIconTint = new Bool(true);
|
102
|
103
|
uut.addToMenu(getTitleBar(), 0);
|
103
|
|
- verify(optionsPresenter, times(0)).setTextColor();
|
|
104
|
+ verify(optionsPresenter, times(0)).tint(any(), anyInt());
|
104
|
105
|
}
|
105
|
106
|
|
106
|
107
|
@Test
|
|
@@ -116,19 +117,53 @@ public class TopBarButtonControllerTest extends BaseTest {
|
116
|
117
|
uut.addToMenu(getTitleBar(), 0);
|
117
|
118
|
verify(optionsPresenter, times(0)).setFontSize(getTitleBar().getMenu().getItem(0));
|
118
|
119
|
|
119
|
|
- getTitleBar().getMenu().clear();
|
|
120
|
+ clearMenu();
|
120
|
121
|
button.fontSize = new Number(10);
|
121
|
122
|
uut.addToMenu(getTitleBar(), 0);
|
122
|
123
|
verify(optionsPresenter, times(1)).setFontSize(getTitleBar().getMenu().getItem(0));
|
123
|
124
|
}
|
124
|
125
|
|
|
126
|
+ @Test
|
|
127
|
+ public void textColor_enabled() {
|
|
128
|
+ setTextButton();
|
|
129
|
+ button.enabled = new Bool(false);
|
|
130
|
+ uut.addToMenu(getTitleBar(), 0);
|
|
131
|
+ dispatchPreDraw(getTitleBar());
|
|
132
|
+ verify(optionsPresenter, times(0)).setEnabledColor(any());
|
|
133
|
+
|
|
134
|
+ clearMenu();
|
|
135
|
+ button.enabled = new Bool(true);
|
|
136
|
+ button.color = new Color(android.graphics.Color.RED);
|
|
137
|
+ uut.addToMenu(getTitleBar(), 0);
|
|
138
|
+ dispatchPreDraw(getTitleBar());
|
|
139
|
+ verify(optionsPresenter, times(1)).setEnabledColor(any());
|
|
140
|
+ }
|
|
141
|
+
|
|
142
|
+ private void clearMenu() {
|
|
143
|
+ getTitleBar().getMenu().clear();
|
|
144
|
+ }
|
|
145
|
+
|
|
146
|
+ @Test
|
|
147
|
+ public void textColor_disabled() {
|
|
148
|
+ setTextButton();
|
|
149
|
+ button.enabled = new Bool(false);
|
|
150
|
+ uut.addToMenu(getTitleBar(), 0);
|
|
151
|
+ dispatchPreDraw(getTitleBar());
|
|
152
|
+ verify(optionsPresenter, times(1)).setDisabledColor(any(), eq(android.graphics.Color.LTGRAY));
|
|
153
|
+
|
|
154
|
+ clearMenu();
|
|
155
|
+ button.disabledColor = new Color(android.graphics.Color.BLACK);
|
|
156
|
+ uut.addToMenu(getTitleBar(), 0);
|
|
157
|
+ dispatchPreDraw(getTitleBar());
|
|
158
|
+ verify(optionsPresenter, times(1)).setDisabledColor(any(), eq(android.graphics.Color.BLACK));
|
|
159
|
+ }
|
|
160
|
+
|
125
|
161
|
private Toolbar getTitleBar() {
|
126
|
162
|
return stackController.getTopBar().getTitleBar();
|
127
|
163
|
}
|
128
|
164
|
|
129
|
165
|
private void setTextButton() {
|
130
|
166
|
button.id = "btn1";
|
131
|
|
- button.color = new Color(android.graphics.Color.RED);
|
132
|
167
|
button.title = new Text("Button");
|
133
|
168
|
button.fontFamily = Typeface.MONOSPACE;
|
134
|
169
|
button.showAsAction = MenuItem.SHOW_AS_ACTION_ALWAYS;
|