Skip to content

Commit 2a0b655

Browse files
authored
Update current screen data in T&G manager with template config (#1834)
* update current screen data in T&G manager with template config * Fix unit test to cover template config change * Remove line form unit test that didn't make sense * Fix unitTest from mergConflicts
1 parent 44b38cb commit 2a0b655

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperationTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public class TextAndGraphicUpdateOperationTest {
6969
private CompletionListener listener;
7070
private TextAndGraphicManager.CurrentScreenDataUpdatedListener currentScreenDataUpdatedListener;
7171
private SdlArtwork blankArtwork;
72-
private TemplateConfiguration configuration, configurationFail;
72+
private TemplateConfiguration configuration, configurationFail, configurationOld;
7373
ISdl internalInterface;
7474
FileManager fileManager;
7575

@@ -246,6 +246,8 @@ public void setUp() throws Exception {
246246
configuration = new TemplateConfiguration();
247247
configuration.setTemplate(PredefinedLayout.GRAPHIC_WITH_TEXT.toString());
248248

249+
configurationOld = new TemplateConfiguration();
250+
configurationOld.setTemplate(PredefinedLayout.TEXT_WITH_GRAPHIC.toString());
249251
configurationFail = new TemplateConfiguration();
250252
configurationFail.setTemplate("failConfiguration");
251253

@@ -276,7 +278,7 @@ public void setUp() throws Exception {
276278

277279
currentScreenData.setPrimaryGraphic(testArtwork1);
278280
currentScreenData.setSecondaryGraphic(testArtwork2);
279-
currentScreenData.setTemplateConfiguration(configuration);
281+
currentScreenData.setTemplateConfiguration(configurationOld);
280282

281283
currentScreenDataUpdatedListener = new TextAndGraphicManager.CurrentScreenDataUpdatedListener() {
282284
@Override
@@ -1047,7 +1049,6 @@ public void testOnShowFail() {
10471049
mediaTrackField, title, testArtwork3, testArtwork4, textAlignment, textField1Type, textField2Type, textField3Type, textField4Type, configuration);
10481050
textAndGraphicUpdateOperation = new TextAndGraphicUpdateOperation(internalInterface, fileManager, defaultMainWindowCapability, currentScreenData, textsAndGraphicsState, listener, currentScreenDataUpdatedListener);
10491051
textAndGraphicUpdateOperation.onExecute();
1050-
assertEquals(textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration().getStore(), configuration.getStore());
10511052

10521053
// Verifies that uploadArtworks does not get called because a sendShow failed with text and layout change
10531054
verify(fileManager, times(0)).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
@@ -1080,7 +1081,7 @@ public void testOnShowFailBadDataDoesNotUpdateScreen(){
10801081
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField2Type());
10811082
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField3Type());
10821083
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField4Type());
1083-
assertEquals(configuration, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration());
1084+
assertEquals(configurationOld, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration());
10841085
}
10851086

10861087
@Test
@@ -1120,7 +1121,7 @@ public void testUpdateTargetStateWithErrorStateNullDoesNotUpdateCurrentScreen()
11201121
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField2Type());
11211122
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField3Type());
11221123
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField4Type());
1123-
assertEquals(configuration, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration());
1124+
assertEquals(configurationOld, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration());
11241125
}
11251126

11261127
@Test
@@ -1160,7 +1161,7 @@ public void testUpdateTargetStateWithErrorBadDataDoesNotUpdateCurrentScreen() {
11601161
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField2Type());
11611162
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField3Type());
11621163
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField4Type());
1163-
assertEquals(configuration, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration());
1164+
assertEquals(configurationOld, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration());
11641165
}
11651166

11661167
@Test
@@ -1200,6 +1201,6 @@ public void testUpdateTargetStateWithErrorBadDataAndGoodData() {
12001201
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField2Type());
12011202
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField3Type());
12021203
TestCase.assertNull(textAndGraphicUpdateOperation.getCurrentScreenData().getTextField4Type());
1203-
assertEquals(configuration, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration());
1204+
assertEquals(configurationOld, textAndGraphicUpdateOperation.getCurrentScreenData().getTemplateConfiguration());
12041205
}
12051206
}

base/src/main/java/com/smartdevicelink/managers/screen/TextAndGraphicUpdateOperation.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,9 @@ private void updateCurrentScreenDataFromShow(Show show) {
633633
if (show.getSecondaryGraphic() != null) {
634634
currentScreenData.setSecondaryGraphic(updatedState.getSecondaryGraphic());
635635
}
636+
if (show.getTemplateConfiguration() != null) {
637+
currentScreenData.setTemplateConfiguration(updatedState.getTemplateConfiguration());
638+
}
636639
if (currentScreenDataUpdateListener != null) {
637640
currentScreenDataUpdateListener.onUpdate(currentScreenData);
638641
}

0 commit comments

Comments
 (0)