|
@@ -2,6 +2,7 @@ package com.reactnativenavigation.viewcontrollers;
|
2
|
2
|
|
3
|
3
|
import android.app.Activity;
|
4
|
4
|
import android.content.Context;
|
|
5
|
+import android.graphics.Color;
|
5
|
6
|
import android.graphics.Typeface;
|
6
|
7
|
import android.view.Gravity;
|
7
|
8
|
import android.view.View;
|
|
@@ -12,9 +13,9 @@ import com.reactnativenavigation.mocks.BackDrawable;
|
12
|
13
|
import com.reactnativenavigation.mocks.ImageLoaderMock;
|
13
|
14
|
import com.reactnativenavigation.mocks.Mocks;
|
14
|
15
|
import com.reactnativenavigation.mocks.SimpleViewController;
|
|
16
|
+import com.reactnativenavigation.mocks.TitleBarButtonCreatorMock;
|
15
|
17
|
import com.reactnativenavigation.mocks.TitleBarReactViewCreatorMock;
|
16
|
18
|
import com.reactnativenavigation.mocks.TopBarBackgroundViewCreatorMock;
|
17
|
|
-import com.reactnativenavigation.mocks.TitleBarButtonCreatorMock;
|
18
|
19
|
import com.reactnativenavigation.parse.Alignment;
|
19
|
20
|
import com.reactnativenavigation.parse.Component;
|
20
|
21
|
import com.reactnativenavigation.parse.Options;
|
|
@@ -244,6 +245,7 @@ public class StackPresenterTest extends BaseTest {
|
244
|
245
|
@Test
|
245
|
246
|
public void mergeRightButtons_buttonsAreCreatedOnlyIfNeeded() {
|
246
|
247
|
Options toApply = new Options();
|
|
248
|
+ textBtn1.color = new Colour(Color.GREEN);
|
247
|
249
|
toApply.topBar.buttons.right = new ArrayList<>(asList(textBtn1, componentBtn1));
|
248
|
250
|
uut.applyChildOptions(toApply, parent, child);
|
249
|
251
|
|
|
@@ -254,6 +256,7 @@ public class StackPresenterTest extends BaseTest {
|
254
|
256
|
|
255
|
257
|
Options toMerge = new Options();
|
256
|
258
|
toMerge.topBar.buttons.right = new ArrayList(requireNonNull(map(toApply.topBar.buttons.right, Button::copy)));
|
|
259
|
+ toMerge.topBar.buttons.right.get(0).color = new Colour(Color.RED);
|
257
|
260
|
toMerge.topBar.buttons.right.add(1, componentBtn2);
|
258
|
261
|
uut.mergeChildOptions(toMerge, Options.EMPTY, parent, child);
|
259
|
262
|
|
|
@@ -262,7 +265,7 @@ public class StackPresenterTest extends BaseTest {
|
262
|
265
|
verify(topBarController).mergeRightButtons(captor2.capture(), any());
|
263
|
266
|
List<TitleBarButtonController> mergedButtons = captor2.getValue();
|
264
|
267
|
assertThat(mergedButtons).hasSize(3);
|
265
|
|
- assertThat(appliedButtons.get(0)).isEqualTo(mergedButtons.get(0));
|
|
268
|
+ assertThat(appliedButtons.get(0)).isNotEqualTo(mergedButtons.get(0));
|
266
|
269
|
assertThat(appliedButtons.get(1)).isEqualTo(mergedButtons.get(2));
|
267
|
270
|
}
|
268
|
271
|
|